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 |
|---|---|---|---|---|---|---|
The name or ARN of the Lambda Layer, which you want to grant access to. | def layer_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "layer_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"layer_name\")",
"def layer_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"layer_name\")",
"def acl_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"acl_name\")",
"def lambda_arn_lookup(sessi... | [
"0.5789041",
"0.5575224",
"0.5253762",
"0.52358145",
"0.5168338",
"0.51173204",
"0.5072476",
"0.50693405",
"0.5058182",
"0.50481194",
"0.49972597",
"0.49902233",
"0.49775085",
"0.49649116",
"0.49155802",
"0.49155802",
"0.49155802",
"0.49155802",
"0.49155802",
"0.4912209",
"0.... | 0.56280416 | 1 |
A unique identifier for the current revision of the policy. | def revision_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "revision_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revision_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"revision_id\")",
"def latest_revision_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"latest_revision_id\")",
"def get_revision(self) -> str:\n raise NotImplementedError",
"def revision_name(self):\n ... | [
"0.78379637",
"0.7106381",
"0.6847565",
"0.684722",
"0.68028283",
"0.68028283",
"0.67027724",
"0.66752213",
"0.6671427",
"0.66240454",
"0.6572217",
"0.6550364",
"0.65445673",
"0.65339625",
"0.6516019",
"0.651004",
"0.64864427",
"0.64808464",
"0.64780784",
"0.6473563",
"0.6459... | 0.72732586 | 1 |
Provides a Lambda Layer Version Permission resource. It allows you to share you own Lambda Layers to another account by account ID, to all accounts in AWS organization or even to all AWS accounts. For information about Lambda Layer Permissions and how to use them, see [Using Resourcebased Policies for AWS Lambda][1] Ex... | def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
action: Optional[pulumi.Input[str]] = None,
layer_name: Optional[pulumi.Input[str]] = None,
organization_id: Optional[pulumi.Input[str]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n action: Optional[pulumi.Input[str]] = None,\n layer_name: Optional[pulumi.Input[str]] = None,\n organization_id: Optional[pulumi.Input[str]] = None,\n ... | [
"0.69493496",
"0.6033564",
"0.5581532",
"0.49989533",
"0.4824022",
"0.4769936",
"0.4717544",
"0.46567935",
"0.46463144",
"0.46421468",
"0.46124303",
"0.45529887",
"0.45258075",
"0.44883686",
"0.44764137",
"0.4469333",
"0.44468176",
"0.44388527",
"0.44277146",
"0.43830875",
"0... | 0.0 | -1 |
Provides a Lambda Layer Version Permission resource. It allows you to share you own Lambda Layers to another account by account ID, to all accounts in AWS organization or even to all AWS accounts. For information about Lambda Layer Permissions and how to use them, see [Using Resourcebased Policies for AWS Lambda][1] Ex... | def __init__(__self__,
resource_name: str,
args: LayerVersionPermissionArgs,
opts: Optional[pulumi.ResourceOptions] = None):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n action: Optional[pulumi.Input[str]] = None,\n layer_name: Optional[pulumi.Input[str]] = None,\n organization_id: Optional[pulumi.Input[str]] = None,\n ... | [
"0.6949601",
"0.55815214",
"0.49987805",
"0.48233932",
"0.47691092",
"0.47171196",
"0.46552166",
"0.4646889",
"0.4641556",
"0.46110705",
"0.45507914",
"0.45272997",
"0.44889033",
"0.44747144",
"0.44692746",
"0.44467375",
"0.44383657",
"0.4425697",
"0.43819165",
"0.43572584",
... | 0.6034117 | 1 |
The name or ARN of the Lambda Layer, which you want to grant access to. | def layer_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "layer_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"layer_name\")",
"def layer_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"layer_name\")",
"def acl_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"acl_name\")",
"def lambda_arn_loo... | [
"0.57892317",
"0.56282675",
"0.5254285",
"0.5237775",
"0.5168856",
"0.5118703",
"0.5071833",
"0.50694805",
"0.5057739",
"0.50490546",
"0.49976078",
"0.49891877",
"0.4979181",
"0.4963721",
"0.49135265",
"0.49135265",
"0.49135265",
"0.49135265",
"0.49135265",
"0.49104932",
"0.4... | 0.5575078 | 2 |
A unique identifier for the current revision of the policy. | def revision_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "revision_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revision_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"revision_id\")",
"def latest_revision_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"latest_revision_id\")",
"def get_revision(self) -> str:\n raise NotImplementedError",
"def revision_name(sel... | [
"0.72729635",
"0.71065503",
"0.6848489",
"0.6848388",
"0.6805351",
"0.6805351",
"0.6703689",
"0.6675212",
"0.66721183",
"0.66244864",
"0.65745425",
"0.65519875",
"0.6541956",
"0.65314144",
"0.6516355",
"0.6511019",
"0.6484605",
"0.64794147",
"0.647816",
"0.6471837",
"0.646010... | 0.7837867 | 0 |
Setup and teardown steps for integration tests. | def integration_lifecycle(svc_client, mock_redis, identity_headers, it_remote_repo_url):
from renku.core.models.git import GitURL
url_components = GitURL.parse(it_remote_repo_url)
payload = {"git_url": it_remote_repo_url, "depth": -1}
response = svc_client.post("/cache.project_clone", data=json.dumps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integration_test_setup(request):\n configs = configholder.table_func_retrieve_additional_configs(\n ACTION_IDENTIFIER, request.function.__name__\n )\n load_configs(configholder, configs)\n os.mkdir(ARCHIVE_TARGET)\n os.mkdir(MODEL_TARGET)\n\n def integration_test_teardown():\n o... | [
"0.7209486",
"0.6876546",
"0.67949224",
"0.67816275",
"0.6774925",
"0.6722145",
"0.6720639",
"0.6720639",
"0.6671091",
"0.657291",
"0.657291",
"0.6572524",
"0.65464824",
"0.65423363",
"0.6538496",
"0.6534096",
"0.6533172",
"0.6530413",
"0.6520503",
"0.65055865",
"0.6503019",
... | 0.0 | -1 |
Return the timestamp of the last updated. | def last_update(self):
serie = self._root.find('Series')
return int(serie.find('lastupdated').text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_update_time(self):\n return self._last_update_time",
"def last_updated_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"last_updated_time\")",
"def last_updated_time(self) -> str:\n return pulumi.get(self, \"last_updated_time\")",
"def get_last_update_time(self):\n ... | [
"0.86287206",
"0.862703",
"0.86085945",
"0.8588392",
"0.8465085",
"0.8465085",
"0.84054095",
"0.8326915",
"0.83089936",
"0.82876444",
"0.82876444",
"0.8082455",
"0.8060271",
"0.8060271",
"0.80328745",
"0.80249065",
"0.79466575",
"0.79294693",
"0.7904606",
"0.78613704",
"0.782... | 0.7708634 | 40 |
Initializes a compressed stream file system. | def __init__(self, resolver_context, path_spec):
super(CompressedStreamFileSystem, self).__init__(
resolver_context, path_spec)
self._compression_method = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_stream, level=9):\n super(Gzip, self).__init__(input_stream)\n\n self._level = level",
"def __init__(self, path: str):\n self._path = path\n self._fp = gzip.open(self._path, mode=\"r\")",
"def __init__(self, input_stream, threads=DEFAULT_THREADS, level=9):\n... | [
"0.6894656",
"0.6868437",
"0.6651103",
"0.6628973",
"0.6483769",
"0.6393246",
"0.6393246",
"0.6382003",
"0.63639224",
"0.62684125",
"0.6226761",
"0.6175761",
"0.61671835",
"0.6137461",
"0.6115498",
"0.60987544",
"0.60849273",
"0.60679126",
"0.60272384",
"0.60077786",
"0.59938... | 0.73946583 | 0 |
Public method returning the ID of the next wizard page. next wizard page ID (integer) | def nextId(self):
Preferences.setWebBrowser(
"SyncEncryptData", self.encryptionGroupBox.isChecked())
Preferences.setWebBrowser(
"SyncEncryptionKey", self.encryptionKeyEdit.text())
Preferences.setWebBrowser(
"SyncEncryptionKeyLength", self.keySizeComboBox.itemD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nextId(self):\r\n \r\n nextId = -1\r\n if self._wizard.currentId() == SOURCE_PAGE_ID:\r\n nextId = TARGET_PAGE_ID\r\n elif self._wizard.currentId() == TARGET_PAGE_ID:\r\n nextId = DATASTORE_PAGE_ID\r\n elif self._wizard.currentId() == DATASTORE_PAGE_ID:\... | [
"0.8632845",
"0.69702977",
"0.67104495",
"0.6623095",
"0.63788253",
"0.63480014",
"0.63027465",
"0.6302685",
"0.6287295",
"0.62713313",
"0.62656814",
"0.6236532",
"0.62166005",
"0.6151381",
"0.6125491",
"0.6125491",
"0.6100827",
"0.6097789",
"0.6036077",
"0.59867",
"0.5959308... | 0.6581145 | 4 |
initializes as an empty list. | def __init__(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n # Initializing an empty list.\n self.mylist = []",
"def __init__(self):\n self.list = []",
"def __init__(self):\n self.l = []",
"def __init__(self):\r\n self.lis = []",
"def _init_empty(self):\n self._data = []",
"def __init__(self) -> None:... | [
"0.8061926",
"0.7705379",
"0.75269085",
"0.74026906",
"0.7333518",
"0.7324015",
"0.7324015",
"0.7313845",
"0.73030347",
"0.7275592",
"0.72257286",
"0.71308845",
"0.7050044",
"0.7032899",
"0.69494677",
"0.69494677",
"0.6936615",
"0.6933047",
"0.69316167",
"0.69303095",
"0.6929... | 0.0 | -1 |
Symmetrically normalize adjacency matrix. | def preprocess_adj(adj):
adj = adj + sp.eye(adj.shape[0])
adj = sp.coo_matrix(adj)
row_sum = np.array(adj.sum(1))
d_inv_sqrt = np.power(row_sum, -0.5).flatten()
d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.
d_mat_inv_sqrt = sp.diags(d_inv_sqrt)
return d_mat_inv_sqrt.dot(adj).dot(d_mat_inv_sqrt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)",
"def normalize_adj(adj):\n adj = sp.coo_mat... | [
"0.788518",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7691616",
"0.759434",
"0.7566608",
"0.7335597",
"0.730491",
"0.72684425",
"0.688461",
"0.68616927",
"0.686005",
"0.6832041",
"0.682895",
"0.67... | 0.67278 | 23 |
Convert sparse matrix to tuple representation. | def sparse_to_tuple(sparse_mx):
def to_tuple(mx):
if not sp.isspmatrix_coo(mx):
mx = mx.tocoo()
coords = np.vstack((mx.row, mx.col)).transpose()
values = mx.data
shape = mx.shape
return coords, values, shape
if isinstance(sparse_mx, list):
for i in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape",
"def sparse_to_tuple(sparse_mx):\r\n ... | [
"0.8587024",
"0.82530713",
"0.82530713",
"0.80922216",
"0.79865575",
"0.6029632",
"0.5984507",
"0.5971696",
"0.59700304",
"0.59448373",
"0.5944532",
"0.5910549",
"0.5910549",
"0.5910549",
"0.5910549",
"0.5910549",
"0.5895647",
"0.58501476",
"0.5847931",
"0.57742304",
"0.56900... | 0.826598 | 1 |
Initialize conv layer weights using normal distribution. | def normal_init(m, mean, std):
if isinstance(m, nn.ConvTranspose2d) or isinstance(m, nn.Conv2d):
m.weight.data.normal_(mean, std)
m.bias.data.zero_() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weights_init_normal(m):\r\n if isinstance(m, nn.Conv2d):\r\n m.weight.data.normal_(0.0, 0.02)\r\n elif isinstance(m, nn.BatchNorm2d):\r\n m.weight.data.normal_(1.0, 0.02)\r\n m.bias.data.fill_(0)",
"def conv_init(conv, act='linear'):\r\n n = conv.kernel_size[0] * conv.kernel_siz... | [
"0.7945652",
"0.7846255",
"0.7829847",
"0.7829847",
"0.77009904",
"0.76455104",
"0.7631445",
"0.7524873",
"0.75135696",
"0.7503895",
"0.74939555",
"0.7475864",
"0.7451924",
"0.74415576",
"0.73742336",
"0.73644084",
"0.7327606",
"0.7327606",
"0.7327606",
"0.73196614",
"0.72888... | 0.74049366 | 14 |
Error message returned when we need to know a user's timezone to execute the command. | def error_unknown_timezone(user: discord.User) -> str:
return (
f"Uh-oh, {user.mention}! I need to file some paperwork with the Inter-island"
f" Revenue Service. Please let me know your timezone by typing: `$timezone"
f" your-timezone`. Example: $timezone America/Los_Angeles."
f"\n\n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_bad_timezone(user: discord.User, bad_tz: str) -> str:\n return (\n f\"{error_bad_value(user, 'timezone', bad_tz)} Try a timezone from the \"\n f\"'TZ database name' column here: {TIMEZONE_REFERENCE_URL}\"\n )",
"def timezone():\n \n pass",
"def __init__(self):\n self.m... | [
"0.6949094",
"0.67067605",
"0.63413435",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6293536",
"0.6093204",
"0.59195817",
... | 0.780624 | 0 |
Error message returned when a user tries to set a bad timezone value for themselves. | def error_bad_timezone(user: discord.User, bad_tz: str) -> str:
return (
f"{error_bad_value(user, 'timezone', bad_tz)} Try a timezone from the "
f"'TZ database name' column here: {TIMEZONE_REFERENCE_URL}"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.message = \"Invalid time zone string, choose one from https://stackoverflow.com/questions/13866926/is-there-a-list-of-pytz-timezones.\"",
"def error_unknown_timezone(user: discord.User) -> str:\n return (\n f\"Uh-oh, {user.mention}! I need to file some paperwork with t... | [
"0.7300762",
"0.68756074",
"0.65495026",
"0.6192673",
"0.60383666",
"0.6018291",
"0.60180426",
"0.5912216",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",... | 0.74170685 | 0 |
Compute the log density under a parameterized normal distribution | def mse_loss(angles_gt, angles_gen):
loss = (angles_gt - angles_gen)**2
# loss = torch.sum(loss, dim=-1) # sum loss over dimensions
loss = torch.mean(loss, dim=-1) # mean loss over images per task
loss = torch.mean(loss, dim=-1) # mean loss over tasks
return loss | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_normal_density(x, mean, log_std, std):\n\n variance = std.pow(2)\n log_density = -(x - mean).pow(2) / (2 * variance) - 0.5 *\\\n np.log(2 * np.pi) - log_std # num_env * frames * act_size\n log_density = log_density.sum(dim=-1, keepdim=True) # num_env * frames * 1\n return log_density"... | [
"0.78388333",
"0.77320075",
"0.77114064",
"0.76379883",
"0.7347923",
"0.7307497",
"0.71299165",
"0.7071661",
"0.7003927",
"0.69591385",
"0.69464034",
"0.6882262",
"0.6851331",
"0.6847058",
"0.6831052",
"0.6827708",
"0.6825447",
"0.68209887",
"0.6789535",
"0.6781004",
"0.67729... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, LoadBalancer):
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 |
Remove and return the top item in the stack (corresponds to the last item in the list). Should throw an error if the list is empty. | def pop(self):
return self.the_stack.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n raise IndexError('Cannot pop item, stack is empty.')\n except IndexError as err:\n print(err)\n ... | [
"0.82423335",
"0.8146311",
"0.8048215",
"0.7979118",
"0.7954354",
"0.7953999",
"0.7838656",
"0.781221",
"0.7808183",
"0.7733349",
"0.7620208",
"0.75598115",
"0.7512124",
"0.75088835",
"0.7475759",
"0.74708265",
"0.74703103",
"0.7460515",
"0.74370337",
"0.7425978",
"0.7423908"... | 0.70241606 | 63 |
Return the top item in the stack (corresponds to the last item in the list) but do not remove it. Should throw an error if the list is empty. | def peek(self):
return self.the_stack[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Pop(self):\n # Alternativly use built-in pop()\n #return self.list.pop()\n top = self.list[len(self.list) - 1]\n self.list.remove(top)\n return top",
"def pop(stack):\n item = top(stack)\n stack.top = stack.top.next\n stack.size = stack.size - 1\n return item",
"def pop(self):\n ... | [
"0.7836278",
"0.7791389",
"0.7781807",
"0.7668221",
"0.76064265",
"0.7525029",
"0.74624777",
"0.74484223",
"0.7384397",
"0.73156554",
"0.731005",
"0.72699183",
"0.7269757",
"0.7226614",
"0.71927875",
"0.7165802",
"0.7136121",
"0.70973605",
"0.7096389",
"0.70906496",
"0.705363... | 0.0 | -1 |
Constructor for a queue Set the queue up with the given list if any is provided Otherwise, start with an empty list | def __init__(self, initial=[]):
self.the_queue = copy.copy(initial) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.queue = []\n self.queue.append(Queue())\n self.queue.append(Queue())\n self.tag = 0 # using to record which queue contain the data",
"def test_new_queue_from_list(self):\n data = [1, 3, 5, 7, 2, 4]\n queue = Queue_(data)\n self.assertFal... | [
"0.7106728",
"0.70358354",
"0.70053774",
"0.6883639",
"0.68504465",
"0.6753064",
"0.6751428",
"0.6751428",
"0.6751428",
"0.6751428",
"0.6751428",
"0.67322475",
"0.67322475",
"0.67176795",
"0.67030764",
"0.66669494",
"0.666393",
"0.6662223",
"0.66533154",
"0.66533154",
"0.6647... | 0.708757 | 1 |
Calculate the uncerainty on x using standard poisson error. In case x=0 the error=1 is assigned. | def get_poisson_uncertainty(x:float) -> float:
err = np.sqrt(x) if x>=1 else 1.0
return err | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uncertainty(x:float, CI_method:str='poisson') -> float: \n assert CI_method in ['exact_poisson', 'poisson'], 'CI method %s not valid' % CI_method\n assert x>=0, 'x must be equal or greater than zero'\n\n if CI_method=='exact_poisson':\n xerr = get_exact_poisson_uncertainty(x)\n if CI_... | [
"0.80541664",
"0.76959187",
"0.6351666",
"0.63265157",
"0.63265157",
"0.624425",
"0.61445516",
"0.61076474",
"0.60794795",
"0.60089463",
"0.5982115",
"0.5847117",
"0.5752191",
"0.57136834",
"0.56578106",
"0.5657796",
"0.5656355",
"0.5606732",
"0.5580502",
"0.549753",
"0.54906... | 0.879651 | 0 |
Calculate the uncerainty on x using an exact poisson confidence interval. Calculate the uncerainty on x using an exact poisson confidence interval. The width of the confidence interval can be specified using the number of sigmas. The default number of sigmas is set to 1, resulting in an error that is approximated by th... | def get_exact_poisson_uncertainty(x:float, nsigmas:float=1) -> float:
# see formula at:
# https://en.wikipedia.org/wiki/Poisson_distribution#Confidence_interval
pl = stats.norm.cdf(-1*nsigmas, loc=0, scale=1)
pu = stats.norm.cdf(1*nsigmas, loc=0, scale=1)
lb = stats.chi2.ppf(pl, 2*x)/2 if x!= 0 els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_poisson_uncertainty(x:float) -> float:\n err = np.sqrt(x) if x>=1 else 1.0\n return err",
"def get_uncertainty(x:float, CI_method:str='poisson') -> float: \n assert CI_method in ['exact_poisson', 'poisson'], 'CI method %s not valid' % CI_method\n assert x>=0, 'x must be equal or greater th... | [
"0.7382792",
"0.6720881",
"0.57460254",
"0.5639007",
"0.56025535",
"0.54036623",
"0.5397073",
"0.5147336",
"0.51038814",
"0.51038814",
"0.508014",
"0.5056147",
"0.5050447",
"0.5041562",
"0.49790117",
"0.49585232",
"0.49344343",
"0.4929233",
"0.49169314",
"0.49082965",
"0.4892... | 0.7793864 | 0 |
remove ordinal words like 2nd, 3rd etc | def remove_ordinal(string):
o_string = []
for numWord in string.split():
regexNum = re.search(r'^[0-9]+', numWord)
if regexNum:
num = regexNum.group()
# ordinal = numWord[regexNum.end():]
"""
django's ordinal method will return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordinal_filter(value):\n digit = value % 10\n if 10 < value < 20:\n o = 'th'\n elif digit is 1:\n o = 'st'\n elif digit is 2:\n o = 'nd'\n elif digit is 3:\n o = 'rd'\n else:\n o = 'th'\n return '%d%s' % (value, o)",
"def _ordinal2word(wordsList, indice... | [
"0.6429053",
"0.62991005",
"0.6207442",
"0.61744726",
"0.604867",
"0.6040155",
"0.60187316",
"0.6006414",
"0.59980196",
"0.59980196",
"0.5993802",
"0.59888166",
"0.59679365",
"0.5945343",
"0.5934979",
"0.592039",
"0.592039",
"0.592039",
"0.592039",
"0.592039",
"0.592039",
"... | 0.78597766 | 0 |
matdatepicker returns a datetime object in UTC time. Need to convert this to local time as only date is stored in db | def convert_timezone(time):
if time is None:
return None
from_zone = tz.tzutc()
to_zone = tz.tzlocal()
try:
utc = datetime.strptime(time, "%Y-%m-%dT%H:%M:%S.%fZ")
except:
utc = datetime.strptime(time, "%Y-%m-%d")
utc = utc.replace(tzinfo=from_zone)
local_date = utc.as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_drf_datetime(cls, obj_dt):\n return timezone.localtime(\n obj_dt, pytz.timezone(settings.TIME_ZONE)\n ).isoformat()",
"def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)",
"def get_local_date(self):\n tz = pytz.timezone(self.timezone)\n utc = pytz... | [
"0.6188217",
"0.60599726",
"0.6032114",
"0.56912565",
"0.56912565",
"0.56912565",
"0.567119",
"0.5656134",
"0.56453806",
"0.56245893",
"0.56029826",
"0.55478525",
"0.55242014",
"0.55148244",
"0.55099577",
"0.5502953",
"0.54969275",
"0.5494267",
"0.546935",
"0.5461582",
"0.545... | 0.0 | -1 |
Initialize an SHC battery reporting sensor. | def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
super().__init__(device, parent_id, entry_id)
self._attr_unique_id = f"{device.serial}_battery" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_battery(self, init_batt, min_batt, batt_rate):\n rospy.loginfo('%s is setting up battery requirements...' %\n self.namespace)\n self.INIT_VOLTAGE = init_batt\n self.MINIMUM_VOLTAGE = min_batt\n self.battery_voltages = [self.INIT_VOLTAGE for _ in range(20)]\n... | [
"0.63642806",
"0.61931205",
"0.6180415",
"0.61236924",
"0.61236924",
"0.61236924",
"0.61181754",
"0.6106114",
"0.6106114",
"0.6085121",
"0.60774827",
"0.6073295",
"0.6064937",
"0.6034938",
"0.6014024",
"0.59749854",
"0.59557635",
"0.5938438",
"0.592197",
"0.5896491",
"0.58838... | 0.5693537 | 27 |
Gets reactions for a post. | def get_reactions(self, post_id, access_token):
base = "https://graph.facebook.com/v2.6"
node = "/%s" % post_id
reactions = "/?fields=" \
"reactions.type(LIKE).limit(0).summary(total_count).as(like)," \
"reactions.type(LOVE).limit(0).summary(total_count).... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reactions(self, request, *args, **kwargs):\n comment = self.get_object()\n reactions = ReactionComment.objects.filter(comment=comment)\n serializer = ReactionCommentModelSummarySerializer(\n reactions, many=True)\n return Response(serializer.data, status=status.HTTP_200_O... | [
"0.64626664",
"0.6311682",
"0.6273457",
"0.6238129",
"0.6225465",
"0.5904503",
"0.58653104",
"0.5809893",
"0.5789368",
"0.57145655",
"0.5663063",
"0.5543826",
"0.54799944",
"0.54720527",
"0.54021895",
"0.53409445",
"0.53374374",
"0.5316452",
"0.5260594",
"0.52495414",
"0.5062... | 0.74790514 | 0 |
Normalizes this vector. Returns this vector normalized. | def normal(self):
l = self.get_length()
if l > 0:
return self / l
else:
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self):\n\t\tnorm = self.norm()\n\t\tif norm == 0:\n\t\t\traise ValueError(\"Can't normalize zero vector\")\n\t\treturn self / norm",
"def normalize(self):\n self.vector /= np.linalg.norm(self.vector)",
"def normalize(self):\n\n if not self.magnitude():\n return Vector(0, ... | [
"0.87486655",
"0.8664258",
"0.8414623",
"0.82462287",
"0.8238958",
"0.81453484",
"0.8122067",
"0.8027879",
"0.7949573",
"0.7933268",
"0.7917107",
"0.78367937",
"0.783173",
"0.7735349",
"0.7674718",
"0.7665272",
"0.76244736",
"0.7621567",
"0.76197714",
"0.7595488",
"0.7540936"... | 0.68148273 | 89 |
Returns a dictionary of data_asset_names that the specified dataconnector can provide. Note that some data_connectors may not be capable of describing specific named data assets, and some (such as inferred_asset_data_connector) require the user to configure data asset names. | def get_available_data_asset_names(
self, data_connector_names: Optional[Union[list, str]] = None
) -> Dict[str, List[str]]:
available_data_asset_names: dict = {}
if data_connector_names is None:
data_connector_names = self.data_connectors.keys() # type: ignore[assignment]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_data_asset_names_and_types(\n self, data_connector_names: Optional[Union[list, str]] = None\n ) -> Dict[str, List[Tuple[str, str]]]:\n # NOTE: Josh 20211001 This feature is only implemented for the InferredAssetSqlDataConnector\n\n available_data_asset_names_and_types: dic... | [
"0.7629658",
"0.6620089",
"0.63857347",
"0.63581",
"0.5779478",
"0.5652032",
"0.5630023",
"0.55991054",
"0.5535054",
"0.5039068",
"0.49782687",
"0.4871556",
"0.48294225",
"0.48022482",
"0.47182837",
"0.4683549",
"0.46774465",
"0.4655647",
"0.46224207",
"0.4579121",
"0.4562053... | 0.8004287 | 0 |
Returns a dictionary of data_asset_names that the specified data connector can provide. Note that some data_connectors may not be capable of describing specific named data assets, and some (such as inferred_asset_data_connector) require the user to configure data asset names. | def get_available_data_asset_names_and_types(
self, data_connector_names: Optional[Union[list, str]] = None
) -> Dict[str, List[Tuple[str, str]]]:
# NOTE: Josh 20211001 This feature is only implemented for the InferredAssetSqlDataConnector
available_data_asset_names_and_types: dict = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_data_asset_names(\n self, data_connector_names: Optional[Union[list, str]] = None\n ) -> Dict[str, List[str]]:\n available_data_asset_names: dict = {}\n if data_connector_names is None:\n data_connector_names = self.data_connectors.keys() # type: ignore[assignm... | [
"0.7872672",
"0.6639935",
"0.6493197",
"0.63307625",
"0.5857078",
"0.57826906",
"0.5619141",
"0.5488284",
"0.5350111",
"0.51913816",
"0.50933343",
"0.4921183",
"0.48984528",
"0.48881686",
"0.48536113",
"0.4793871",
"0.47100058",
"0.4633258",
"0.45951614",
"0.45789376",
"0.457... | 0.75471514 | 1 |
Return the first item from a list, or None of the list is empty. | def first(l):
return next(iter(l), None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(items):\n return next(iter(items or []), None)",
"def first(xs):\n if not xs:\n return None\n return xs[0]",
"def first(xs):\n if not xs:\n return None\n return xs[0]",
"def first(items):\r\n return items[0]",
"def hd(lst):\n return lst[0] if lst else None",
"... | [
"0.84877914",
"0.8179549",
"0.8179549",
"0.78328145",
"0.77095103",
"0.76711464",
"0.7347254",
"0.7347254",
"0.73275274",
"0.7300961",
"0.72951573",
"0.72829545",
"0.7073666",
"0.7064445",
"0.70553625",
"0.70425475",
"0.7029603",
"0.7025803",
"0.699919",
"0.6982931",
"0.69651... | 0.8317913 | 1 |
Copy an AttrDict (or create an AttrDict from a dict or argparse Namespace object. | def _attrdict_copy(d):
if isinstance(d, collections.Iterable):
return AttrDict(dict(d))
else:
return AttrDict(vars(d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return AttrDict(dict(self).copy())",
"def _deep_copy_arg_dict(input_arg_dict):\n output_arg_dict = {}\n for name, param in input_arg_dict.items():\n output_arg_dict[name] = param.copy()\n return output_arg_dict",
"def __init__(self, *args, **kwargs):\n super(Attr... | [
"0.71632177",
"0.6679515",
"0.63089556",
"0.6178478",
"0.60999316",
"0.60923344",
"0.58597386",
"0.57898307",
"0.57547146",
"0.5735377",
"0.5726225",
"0.56758964",
"0.56730634",
"0.5659268",
"0.55869025",
"0.55737454",
"0.55718267",
"0.5511325",
"0.5498638",
"0.5482552",
"0.5... | 0.7873107 | 0 |
If a board has a winner, the index of the winner is returned. Returns 1 if loss, 1 if win, 0 if draw and nan if game is not finished | def get_winner(self, board):
for p_id in self.player_ids:
win_array = np.array([p_id] * self.board_width, dtype=np.int8)
for i in range(self.board_width):
# check rows
if np.array_equal(board[i], win_array):
return p_id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner(self):\n\n\t\tfor player in [1,2]:\n\t\t\twon = np.full((self.boardSize), player)\n\n\t\t\t# Check diagonals\n\t\t\tif(np.array_equal(np.diag(self.board), won)): return player\n\t\t\tif(np.array_equal(np.diag(np.fliplr(self.board)), won)): return player\n\n\t\t\t# Check lines and columns\n\t\t\tfor i in... | [
"0.79655766",
"0.7818375",
"0.7752329",
"0.77509093",
"0.76915735",
"0.76499224",
"0.7610605",
"0.75878346",
"0.7580997",
"0.75696623",
"0.7541646",
"0.7526972",
"0.75199854",
"0.7518737",
"0.751468",
"0.75039655",
"0.74901164",
"0.7454761",
"0.744647",
"0.7436912",
"0.740952... | 0.8132879 | 0 |
Returns the inital board state (an empty 3 3 grid) | def start_state(self):
return np.zeros((3, 3), dtype=np.int8) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_state():\n board = [[EMPTY, EMPTY, EMPTY],\n [EMPTY, EMPTY, EMPTY],\n [EMPTY, EMPTY, EMPTY]]\n return board",
"def initial_state() -> Board:\n board = (\"rnbqkbnr\", \"pppppppp\", \"........\", \"........\", \"........\",\n \"........\", \"PPPPPPPP\"... | [
"0.82677513",
"0.8157843",
"0.74516153",
"0.74474454",
"0.7257367",
"0.7216153",
"0.703617",
"0.703617",
"0.69935256",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",... | 0.68845016 | 36 |
If a board has a winner, the index of the winner is returned. Returns 1 if loss, 1 if win, 0 if draw and nan if game is not finished | def get_winner(self, board):
ids = self.player_ids
board_size = self.board_size
return self.get_winner_c(board, ids, board_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_winner(self, board):\r\n for p_id in self.player_ids:\r\n win_array = np.array([p_id] * self.board_width, dtype=np.int8)\r\n for i in range(self.board_width):\r\n # check rows\r\n if np.array_equal(board[i], win_array):\r\n retur... | [
"0.81321263",
"0.7964025",
"0.7817175",
"0.77527773",
"0.7750282",
"0.7691007",
"0.765047",
"0.76108587",
"0.7586196",
"0.75815034",
"0.7569897",
"0.7542088",
"0.7527536",
"0.7519068",
"0.7519068",
"0.75156504",
"0.75045377",
"0.74888",
"0.7453029",
"0.7445166",
"0.74357814",... | 0.0 | -1 |
Returns the inital board state (an empty 3 3 grid) | def start_state(self):
return np.zeros(self.board_size, dtype=np.int8) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_state():\n board = [[EMPTY, EMPTY, EMPTY],\n [EMPTY, EMPTY, EMPTY],\n [EMPTY, EMPTY, EMPTY]]\n return board",
"def initial_state() -> Board:\n board = (\"rnbqkbnr\", \"pppppppp\", \"........\", \"........\", \"........\",\n \"........\", \"PPPPPPPP\"... | [
"0.82677513",
"0.8157843",
"0.74474454",
"0.7257367",
"0.7216153",
"0.703617",
"0.703617",
"0.69935256",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
"0.697439",
... | 0.74516153 | 2 |
A decorator for functions that define TensorFlow operations. The wrapped function will only be executed once. Subsequent calls to it will directly return the result so that operations are added to the graph only once. The operations added by the function live within a tf.variable_scope(). If this decorator is used with... | def define_scope(function, scope=None, *args, **kwargs):
attribute = '_cache_' + function.__name__
name = scope or function.__name__
@property
@functools.wraps(function)
def decorator(self):
if not hasattr(self, attribute):
with tf.variable_scope(name, *args, **kwargs):
setattr(self, attribu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_op(name=None):\n def decorator(function):\n @functools.wraps(function)\n def wrapper(*args, **kwargs):\n with tf.name_scope(name or function.__name__):\n return function(*args, **kwargs)\n return wrapper\n return decorator",
"def scoped_fn(fn: Callab... | [
"0.7893259",
"0.75132984",
"0.7376399",
"0.73762685",
"0.7162695",
"0.6325148",
"0.6180199",
"0.61687905",
"0.6148385",
"0.6102126",
"0.6102126",
"0.6033043",
"0.60233563",
"0.601053",
"0.6005897",
"0.5979651",
"0.5931579",
"0.5874336",
"0.5866276",
"0.5849357",
"0.5847309",
... | 0.73559076 | 4 |
Test if either sampling_size or max_age are given. | async def test_sampling_boundaries_given(hass: HomeAssistant) -> None:
assert await async_setup_component(
hass,
"sensor",
{
"sensor": [
{
"platform": "statistics",
"name": "test_boundaries_none",
"entity... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sampler_validation(self):\n parameter_count = len(self._parameter_names)\n if self.sampler_class == \"sobol\" and parameter_count < 2:\n raise ValueError(\"The SALib Sobol sampler requires at least two parameters\")\n if self.sampler_class == \"morris\" and parameter_count < 2:... | [
"0.5970296",
"0.5917047",
"0.5917047",
"0.5917047",
"0.5917047",
"0.5765537",
"0.5601575",
"0.5524721",
"0.54639345",
"0.53821194",
"0.5319769",
"0.5317422",
"0.5307988",
"0.5209279",
"0.51981956",
"0.51981956",
"0.51981956",
"0.51866037",
"0.51835877",
"0.5174781",
"0.517251... | 0.0 | -1 |
Ensure error when user with email already exists | def test_add_user_duplicate_email(self):
with self.client:
auth_headers = login_test_user(self.client)
payload = json.dumps(dict(email="neilb14@mailinator.com",username="neilb14",password="password123"))
self.client.post('/users',
data = payload,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_registeration_duplicate_user_email(self):\n self.signup_a_user(self.user_data)\n response_duplicate = self.signup_a_user(self.user_data_duplicate_email)\n self.assertEqual(response_duplicate.status_code,\n status.HTTP_400_BAD_REQUEST)\n self.assertEqual(... | [
"0.7806436",
"0.76810056",
"0.76723284",
"0.7657439",
"0.7624962",
"0.7602125",
"0.75722635",
"0.7564638",
"0.7550504",
"0.75343406",
"0.74420446",
"0.73806894",
"0.73768765",
"0.7374714",
"0.735679",
"0.7344151",
"0.7336011",
"0.73280907",
"0.73201513",
"0.72754484",
"0.7273... | 0.7179427 | 25 |
Helper to determine whether the SelectorThread's Event is set or not. | def stopped(self):
return self._stop_event.is_set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_event(self):\n return self.ser.inWaiting()",
"def is_event(self):\n return self._is_name_type(self.EVENT)",
"def check_event_status(self):\n pass",
"def __bool__(self) -> bool:\n return self._connected_event.is_set()",
"def wantsReadEvent(self):\r\n if self.result... | [
"0.662462",
"0.64208007",
"0.63329613",
"0.6168364",
"0.610194",
"0.60943824",
"0.60943824",
"0.60943824",
"0.60943824",
"0.60943824",
"0.60477734",
"0.59797597",
"0.5966458",
"0.5822161",
"0.58190066",
"0.58050895",
"0.5782903",
"0.57627386",
"0.5754684",
"0.5729477",
"0.572... | 0.0 | -1 |
Get path sample data directory. | def get_resource_path():
return os.path.join(os.path.dirname(__file__), "resources") + os.path.sep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sample_data_dir():\n \n return resource_filename('cdat_lite.test.test_cdms', 'sample_data')",
"def data_dir():\n return os.path.join(os.path.dirname(_here), 'test', 'data')",
"def get_data_path():\n\treturn _paths[_DATA_DIRECTORY_KEY]",
"def test_data_dir(self):\n return os.path.join(... | [
"0.86374456",
"0.8041521",
"0.80072814",
"0.79392594",
"0.7937919",
"0.78806025",
"0.78588456",
"0.7838425",
"0.7835312",
"0.7823318",
"0.7790869",
"0.7762655",
"0.77520645",
"0.7723476",
"0.7717625",
"0.76549894",
"0.76238036",
"0.7535317",
"0.75302595",
"0.7503783",
"0.7503... | 0.0 | -1 |
For Windows system method, open a new tab to open new url and switch to the newly tab. | def open_new_tab_for_Windows(self, url):
ActionChains(self.driver).send_keys(Keys.CONTROL + 't').perform()
self.driver.get(url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newtab(url):\n\n # Open the URL\n webbrowser.open_new_tab(url)",
"def open_tab(self, url):\n orig_handles = self.driver.window_handles\n\n if mozinfo.os == \"mac\":\n self.driver.find_element_by_tag_name(\n 'body').send_keys(Keys.COMMAND + \"t\")\n else:\n... | [
"0.80515075",
"0.78553426",
"0.78061086",
"0.7716401",
"0.7569369",
"0.7494092",
"0.72918606",
"0.6958922",
"0.68938196",
"0.68808514",
"0.67729956",
"0.6738624",
"0.6625011",
"0.66083467",
"0.65953755",
"0.65714705",
"0.6545127",
"0.65213716",
"0.65082157",
"0.64994586",
"0.... | 0.8412881 | 0 |
returns a mask that can sharpen the img input thresWhite above which will be set to 1 thresBlack above which will be set to 0 | def sharpen(img, thresWhite, thresBlack):
mask = np.zeros(np.shape(img))
for i in range(np.shape(img)[0]):
for j in range(np.shape(img)[1]):
if img[i][j] <= thresBlack:
mask[i][j] = 0
elif img[i][j] >= thresWhite:
mask[i][j] = -1
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_and_grayscale(mask):\n r, _, _, _ = Image.Image.split(mask)\n\n r = np.asarray(r)\n\n water = np.logical_and(r <= 190, r > 63)\n buildings = r > 190\n\n np_mask = np.zeros_like(r)\n np_mask[water] = 127\n np_mask[buildings] = 255\n\n gray_mask = Image.fromarray(np_mask)\n\n re... | [
"0.72110546",
"0.6902545",
"0.67832756",
"0.6764658",
"0.6605018",
"0.6601766",
"0.65719724",
"0.65399534",
"0.65356773",
"0.6527565",
"0.6527392",
"0.65057516",
"0.65001386",
"0.64843166",
"0.6442885",
"0.6441745",
"0.6396851",
"0.6395036",
"0.6380215",
"0.6367057",
"0.63641... | 0.7312915 | 0 |
Create application instance and insert necessary information into the database before each test. | def setUp(self):
self.app = create_app("testing", False)
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
Role.insert_roles()
self.client = self.app.test_client() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = create_app()\n self.client = self.app.test_client\n setup_db(self.app, TEST_DB_PATH)\n\n # binds the app to the current context\n with self.app.app_context():\n # create all tables\n db.create_all()\n self._populate_d... | [
"0.80844826",
"0.79564685",
"0.7953849",
"0.7934207",
"0.79035836",
"0.78995645",
"0.7899217",
"0.7889022",
"0.78845286",
"0.7884239",
"0.7868128",
"0.7838388",
"0.7822287",
"0.7811759",
"0.7801983",
"0.78002733",
"0.7797955",
"0.7797955",
"0.7796609",
"0.77886605",
"0.778781... | 0.741536 | 75 |
Pop application context, remove the db session, and drop all tables in the database. | def tearDown(self):
db.session.remove()
db.drop_all()
self.app_context.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown(self):\n\n db.session.remove()\n db.drop_all()",
"def tearDown(self):\n\t\twith self.app.app_context():\n\t\t\tdb.session.remove()\n\t\t\tdb.drop_all()",
"def tearDown(self):\n\t\twith self.app.app_context():\n\t\t\tdb.session.remove()\n\t\t\tdb.drop_all()",
"def tearDown(self):\n ... | [
"0.8309088",
"0.8282203",
"0.8282203",
"0.8239269",
"0.8177826",
"0.81763947",
"0.81763947",
"0.8158042",
"0.8131037",
"0.8131037",
"0.8131037",
"0.8131037",
"0.80409175",
"0.80164206",
"0.7986464",
"0.7975581",
"0.7913618",
"0.7913618",
"0.7913618",
"0.7913618",
"0.7913618",... | 0.8615345 | 0 |
Get the current page break policy. | def get_page_break_policy(self) -> gui.textformat.PageBreakFlagStr:
return gui.textformat.PAGE_BREAK_FLAG.inverse[self.pageBreakPolicy()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy(self):\n return self.agent.get_policy()",
"def policy(self) -> HwPolicy:\n return self._policy",
"def get_policy(self):\n\n return",
"def allocation_policy(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"allocation_policy\")",
"def getPolicy(sel... | [
"0.65196323",
"0.64900684",
"0.6388173",
"0.6055758",
"0.5913532",
"0.5913532",
"0.59131837",
"0.5886313",
"0.5885606",
"0.58422494",
"0.58407116",
"0.58407116",
"0.58164155",
"0.58164155",
"0.58164155",
"0.5798522",
"0.57752925",
"0.5766659",
"0.57221544",
"0.5687986",
"0.56... | 0.75597614 | 0 |
Returns true if this 'remote' account is actually local. This is only a heuristic, but should work for simple local testing. | def local(self):
return self.hostname == "localhost" and self.user is None and self.ssh_args is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_remote(self):\n if socket.gethostbyname(socket.gethostname()).startswith('10.7'):\n return False\n else:\n return True",
"def isLocal(self, connectionInfo):\n return False",
"def is_remote(self):\n return False",
"def is_local(self):\n if not \"... | [
"0.7280411",
"0.7229916",
"0.71854585",
"0.7070716",
"0.6954592",
"0.6924973",
"0.691409",
"0.68221706",
"0.6725732",
"0.66835994",
"0.6666308",
"0.6666308",
"0.66441625",
"0.6595177",
"0.6581372",
"0.64993596",
"0.64631015",
"0.6428503",
"0.64129007",
"0.6409343",
"0.6360782... | 0.773912 | 0 |
Returns the key if the date is in the dictionary, otherwise None. | def present_in(d: dict, date: str) -> str:
for k in d["scheduled_on"]:
if d["scheduled_on"][k]["date"] == date:
return k | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key(dict, key):\n return dict.get(key, None)",
"def _search_list(list, key, status_date):\n\n for l in list:\n if l[key] == status_date:\n return l",
"def get_first_key_from_dict(ad_dict):\n\n try:\n key = list(ad_dict.keys())[0]\n\n return key\n ... | [
"0.61991227",
"0.59354377",
"0.585624",
"0.582938",
"0.5823154",
"0.5798048",
"0.5750999",
"0.5736293",
"0.57180315",
"0.5716478",
"0.57045114",
"0.56889",
"0.56770825",
"0.5654329",
"0.55944014",
"0.55911547",
"0.5584515",
"0.55055493",
"0.5503428",
"0.5503037",
"0.5477036",... | 0.76852965 | 0 |
Sets the CUDA_VISIBLE_DEVICES setting to all free GPUS by default to num_gpu free GPUS when num_gpus is set | def cuda_set_n_free_gpus(num_gpu = None, verbose=False):
free = get_free_gpus()
if num_gpu != None:
check_num(num_gpu)
if len(free) < num_gpu:
raise ValueError("Not enough free GPUs available - only %d available - use count_free_gpus() or pass 'None' as num_gpu for maximum number"%le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_gpu(gpus):\n os.environ[\"CUDA_DEVICE_ORDER\"] = \"PCI_BUS_ID\"\n os.environ[\"CUDA_VISIBLE_DEVICES\"] = gpus",
"def set_max_gpu(self):\r\n gpu_getter = GPUGetter()\r\n gpu = str(gpu_getter.get_free_gpu())\r\n\r\n if gpu:\r\n print(\"Using GPU: %s\" % gpu)\r\n ... | [
"0.7862403",
"0.68836486",
"0.6860515",
"0.68402725",
"0.6832281",
"0.6744398",
"0.6649793",
"0.66362554",
"0.6549852",
"0.6549852",
"0.65274876",
"0.651574",
"0.64918053",
"0.64659256",
"0.64607114",
"0.6437625",
"0.6437625",
"0.64330006",
"0.64301944",
"0.64146864",
"0.6399... | 0.8249468 | 0 |
Simple decorator to show whether or not a user is a valid member of Online. | def need_membership(view_func):
def check_membership(request, *args, **kwargs):
if request.user.is_member:
return view_func(request, *args, **kwargs)
# Raise 403 error if user does not have access
raise Http403
return check_membership | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_online(method):\r\n @functools.wraps(method)\r\n def wrapper(self, *args, **kwargs):\r\n if self.current_user in self.users_holder.online_users.keys():\r\n return method(self, *args, **kwargs)\r\n else:\r\n return\r\n return wrapper",
"def is_member(user: Use... | [
"0.6885159",
"0.6460571",
"0.63075316",
"0.6294657",
"0.61948913",
"0.61565566",
"0.6040455",
"0.5991301",
"0.59569764",
"0.5946168",
"0.59417707",
"0.5897945",
"0.58932817",
"0.5876253",
"0.58727264",
"0.58554167",
"0.5839589",
"0.58386356",
"0.58243424",
"0.57942414",
"0.57... | 0.599193 | 7 |
must start with a letter or underscore cannot start with the letters xml (or XML, or Xml, etc) can contain letters, digits, hyphens, underscores, and periods cannot contain spaces | def isValidTagName(s):
if s.lower().startswith("xml"):
return False
return re.match("[^\W\d][\w\-_.]*", s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MakeValidName(name):\n if name:\n goodName = []\n if not xml.is_name_start_char(name[0]):\n goodName.append(u'_')\n for c in name:\n if xml.is_name_char(c):\n goodName.append(c)\n else:\n goodName.append(u'_')\n retur... | [
"0.6395713",
"0.60889995",
"0.60239637",
"0.59413743",
"0.5892314",
"0.5870977",
"0.5724576",
"0.5717724",
"0.571723",
"0.56726253",
"0.56584436",
"0.5652339",
"0.5648727",
"0.5639913",
"0.56202936",
"0.5617188",
"0.5616798",
"0.56099945",
"0.56099945",
"0.560648",
"0.5604504... | 0.66947746 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Greens,
nticks=6):
# print color visualization
color = np.zeros_like(cm)
color = 255 * cm.astype('float') / cm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.0 | -1 |
applies the sigmoid function to t. | def sigmoid(t):
t[t >= 20] = 20
t[t <= -20] = -20
return np.exp(t)/(np.exp(t)+1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(t):\n sig=np.exp(t)/(1+np.exp(t))\n return sig",
"def sigmoid(t):\n return np.exp(t)/(1+np.exp(t))",
"def sigmoid(t):\n\n return 1.0 / (1.0 + np.exp(-t))",
"def sigmoid(t):\n return 1 / (1 + np.exp(-t))",
"def sigmoid(t):\n\tprecLim = 10\n\t\n\tt[t<=-precLim] = 0\n\tt[t>-precLim]... | [
"0.8758981",
"0.8747487",
"0.86617976",
"0.86283195",
"0.84621775",
"0.80491817",
"0.79365957",
"0.7847392",
"0.7843968",
"0.780765",
"0.78065133",
"0.78065133",
"0.7759562",
"0.77491874",
"0.7730847",
"0.7729266",
"0.772639",
"0.7718709",
"0.7718709",
"0.7718709",
"0.7718709... | 0.8138239 | 5 |
Convert date values expressed in user's timezone to serverside UTC timestamp, assuming a default arbitrary | def date_to_datetime(self, cr, uid, userdate, context=None):
# TODO: move to fields.datetime in server after 7.0
user_date = datetime.strptime(userdate, DEFAULT_SERVER_DATETIME_FORMAT)
if context and context.get('tz'):
tz_name = context['tz']
else:
tz_name = self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tz():\n return 'UTC'",
"def toutc(dateobj, timezone):\n fmtdate = parser.parse(dateobj) # string to datetime object\n user_tz = pytz.timezone(timezone) # getting user's timezone\n localize_date_with_tz = user_tz.localize(fmtdate) #adding user's timezone to datetime object\n utcdate = pytz... | [
"0.69653374",
"0.68219405",
"0.67553234",
"0.67387253",
"0.6710781",
"0.6608097",
"0.6553364",
"0.6528713",
"0.6518145",
"0.6482144",
"0.6437916",
"0.64228386",
"0.6407395",
"0.63950354",
"0.63932335",
"0.6338435",
"0.63010246",
"0.6292841",
"0.6290485",
"0.6276294",
"0.62730... | 0.0 | -1 |
make a mock partition table from a a string describing partitions and their state. | def mock_pt(descriptions: str) -> PartitionTable:
code_to_ptype = {'v': 'vfat', 'r': 'ext4'}
code_to_mount_point = {'v': '/boot/efi', 'r': '/'}
pt = PartitionTable() # the real one
pt.mounts: OrderedDict[str, DiskPart] = {} # Overwrite
pt.partitions: Dict[str, DiskPart] = {}
for i, pt_descrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partition_tables_types(sdc_builder, sdc_executor, gcp, partition_type, file_format):\n\n if Version(sdc_builder.version) < Version('5.5.0') and file_format == 'JSON':\n pytest.skip('JSON staging introduced in 5.5.0')\n\n bucket_name = f'stf_{get_random_string(ascii_lowercase, 10)}'\n datas... | [
"0.57126886",
"0.5700282",
"0.5667392",
"0.5642908",
"0.5601593",
"0.56011355",
"0.5561808",
"0.553249",
"0.5487015",
"0.5463912",
"0.5392918",
"0.5367939",
"0.53591657",
"0.53457075",
"0.53453994",
"0.5338828",
"0.53204125",
"0.5255601",
"0.5254301",
"0.5249426",
"0.51740247... | 0.68567353 | 0 |
Moves form to center of the screen | def move_center(obj):
desktop = QApplication.desktop()
dw = desktop.width()
dh = desktop.height()
size = obj.size()
mw = size.width()
mh = size.height()
obj.move(dw/2-mw/2, dh/2-mh/2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_on_screen(self):\n window_frame = self.frameGeometry()\n screen_center = QtGui.QDesktopWidget().availableGeometry().center()\n window_frame.moveCenter(screen_center)\n self.move(window_frame.topLeft())",
"def center(self):\r\n frameGm = self.frameGeometry()\r\n ... | [
"0.77496177",
"0.7738209",
"0.7665357",
"0.76187015",
"0.7509011",
"0.74860835",
"0.7467239",
"0.7429219",
"0.7429219",
"0.7429123",
"0.74064434",
"0.7404397",
"0.7391885",
"0.7241539",
"0.7181897",
"0.7033778",
"0.69278115",
"0.6827389",
"0.6814517",
"0.6814517",
"0.6757819"... | 0.7021604 | 16 |
Return the alternate color for this node. | def alternateColor( self ):
return self._alternateColor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self, node: Node) -> str:\n\n idx = hash(node.get_kind_name()) % len(self.colors_)\n return self.colors_[idx]",
"def disabledAlternateColor( self ):\n return self._disabledAlternateColor",
"def get_color(self):\n return \"yellow\"",
"def getColor(self):\n retu... | [
"0.6845102",
"0.6813905",
"0.66902584",
"0.6453343",
"0.63527316",
"0.6320355",
"0.62836003",
"0.628068",
"0.6280183",
"0.62067866",
"0.62067866",
"0.62028104",
"0.6191796",
"0.6188435",
"0.61838126",
"0.6170651",
"0.6165269",
"0.6157339",
"0.61482644",
"0.61482644",
"0.61449... | 0.87913877 | 0 |
Returns the margins that will be used when drawing this node. | def contentsMargins( self ):
return self._margins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def margin(self):\r\n return self._generate_spacing_info(self.config['margin'])",
"def margins(self) -> tuple[int, int, int, int]:\n return self._widget._mgui_get_margins()",
"def get_margin(self):\n _pal.lib.geometry_get_margin.restype = c.c_float\n return _pal.lib.geometry_get_mar... | [
"0.79979354",
"0.7907742",
"0.7675369",
"0.736598",
"0.72361416",
"0.71463907",
"0.7140946",
"0.70488703",
"0.69698197",
"0.65697443",
"0.65485793",
"0.6471708",
"0.6424102",
"0.64126223",
"0.6368021",
"0.6337564",
"0.6240149",
"0.6104009",
"0.61010617",
"0.6034214",
"0.60318... | 0.77525055 | 2 |
Returns a list of connections from the scene that match the inputed class for this node. | def connections( self, cls = None ):
scene = self.scene()
if ( not scene ):
return []
if ( not cls ):
cls = XNodeConnection
output = []
for item in scene.items():
if ( not isinstance(item, cls) ):
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inputConnections(self, cls=None):\n scene = self.scene()\n if ( not scene ):\n return []\n \n if ( not cls ):\n cls = XNodeConnection\n \n output = []\n for item in scene.items():\n if ( not isinstance(item, cls) ):\n ... | [
"0.810395",
"0.77088773",
"0.6543437",
"0.6041234",
"0.6010072",
"0.60012907",
"0.5959032",
"0.5959032",
"0.5942328",
"0.5935329",
"0.59291655",
"0.58827883",
"0.5831004",
"0.58073163",
"0.57963204",
"0.5764525",
"0.5752135",
"0.5735928",
"0.5692198",
"0.56360984",
"0.5634382... | 0.84206927 | 0 |
Returns the brush to use when highlighting a node. | def highlightBrush( self ):
return QBrush(self.highlightColor()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def textBackgroundBrush(self):\n return self._text_bg_brush",
"def GetHilightFocusColour(self):\r\n\r\n return self._hilightBrush.GetColour()",
"def GetBrush(*args, **kwargs):\n return _gdi_.StockGDI_GetBrush(*args, **kwargs)",
"def GetBrush(*args, **kwargs):\n return _gdi_.DC_Get... | [
"0.67059815",
"0.63829345",
"0.62472063",
"0.6109084",
"0.6071157",
"0.6059504",
"0.60169375",
"0.59688914",
"0.5868647",
"0.57534575",
"0.5741853",
"0.56937855",
"0.56657493",
"0.56121874",
"0.5582861",
"0.55718523",
"0.5522905",
"0.5500237",
"0.5473126",
"0.54677075",
"0.54... | 0.73315465 | 0 |
Returns the color to use when highlighting this node. | def highlightColor( self ):
return self._highlightColor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlight_color(self):\n return curses.color_pair(4) if self.cycling else curses.color_pair(2)",
"def get_color(self):\n return self._color",
"def get_color(self):\n return self._color",
"def color(self):\n return self.__color",
"def get_color(self):\n return \"yellow... | [
"0.7246084",
"0.7118152",
"0.7118152",
"0.71160036",
"0.7109482",
"0.71083",
"0.71000814",
"0.70907676",
"0.7077414",
"0.7066678",
"0.7066678",
"0.70613056",
"0.7053799",
"0.69952404",
"0.69952404",
"0.69952404",
"0.6973013",
"0.6954762",
"0.6945003",
"0.69006896",
"0.6894448... | 0.82384324 | 0 |
Returns the color used for the hotspot when it is not an invisible \ render. | def hotspotColor( self ):
return self._hotspotColor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hotspotStyle( self ):\n return self._hotspotStyle",
"def color(self):\n return 0x2f3136",
"def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"",
"def v_explored(self):\n return self._explored",
"def light_col... | [
"0.6733581",
"0.6561859",
"0.63902366",
"0.6286289",
"0.6283056",
"0.6242249",
"0.6242249",
"0.6242249",
"0.6242249",
"0.61947143",
"0.6185162",
"0.61809415",
"0.6178271",
"0.61708415",
"0.61647993",
"0.61504716",
"0.6146146",
"0.61269516",
"0.6121133",
"0.6118904",
"0.611507... | 0.7898071 | 0 |
Returns a list of input connections from the scene that match the inputed class for this node. | def inputConnections(self, cls=None):
scene = self.scene()
if ( not scene ):
return []
if ( not cls ):
cls = XNodeConnection
output = []
for item in scene.items():
if ( not isinstance(item, cls) ):
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connections( self, cls = None ):\n scene = self.scene()\n if ( not scene ):\n return []\n \n if ( not cls ):\n cls = XNodeConnection\n \n output = []\n for item in scene.items():\n if ( not isinstance(item, cls) ):\n ... | [
"0.8078064",
"0.7404637",
"0.6326355",
"0.61908495",
"0.59790444",
"0.5788706",
"0.5782659",
"0.5753383",
"0.57245225",
"0.56990045",
"0.5634393",
"0.5630047",
"0.56236655",
"0.56030285",
"0.5566034",
"0.55643296",
"0.5528385",
"0.5528385",
"0.5528385",
"0.5524784",
"0.551604... | 0.86175656 | 0 |
Returns whether or not this node is enabled. | def isEnabled( self ):
if ( self._disableWithLayer and self._layer ):
lenabled = self._layer.isEnabled()
else:
lenabled = True
return self._enabled and lenabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled(self) -> ConfigNodePropertyBoolean:\n return self._enabled",
"def is_enabled(self) -> bool:\n return self._enabled",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled... | [
"0.8436217",
"0.82213795",
"0.81752706",
"0.81752706",
"0.81752706",
"0.81752706",
"0.81752706",
"0.81752706",
"0.81633216",
"0.81633216",
"0.8119787",
"0.8091862",
"0.80493826",
"0.80493826",
"0.80493826",
"0.80493826",
"0.80493826",
"0.80493826",
"0.80493826",
"0.80493826",
... | 0.0 | -1 |
Returns the layer that this node is assigned to. | def layer( self ):
return self._layer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer(self):\n return self.GetLayer()",
"def layer(self):\n return self._layer",
"def get_layer(self):\n return self._border",
"def get_penultimate_layer(self):\n return self.model.outputs[1]",
"def get_layer(self, l):\n\n if l == 0:\n return self.input_lay... | [
"0.8169379",
"0.8106108",
"0.7248626",
"0.7232834",
"0.7232675",
"0.7172794",
"0.70148075",
"0.68710583",
"0.67965",
"0.667374",
"0.6667077",
"0.6641383",
"0.66337776",
"0.65884495",
"0.65630853",
"0.6505596",
"0.650364",
"0.6457846",
"0.64260566",
"0.6391465",
"0.6368401",
... | 0.81043804 | 2 |
Returns the minimum height for this node. | def minimumHeight( self ):
return self._minimumHeight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self):\n return self.i_node.distance(self.n_node)",
"def height(self):\n # Check if root node has a value and if so calculate its height\n return self.root.height() if self.root is not None else -1",
"def height(self) -> int:\n return self.root.height if not self.empty() ... | [
"0.75008625",
"0.73123235",
"0.72361463",
"0.7082104",
"0.707089",
"0.6986047",
"0.69774544",
"0.6961346",
"0.6942111",
"0.6940561",
"0.69013745",
"0.6875858",
"0.6869304",
"0.68476623",
"0.6831631",
"0.68300486",
"0.6819393",
"0.6794914",
"0.67882127",
"0.6782902",
"0.677305... | 0.8336657 | 0 |
Returns the minimum width for this node. | def minimumWidth( self ):
return self._minimumWidth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_width(self) -> float:\n ws = self.get_widths()\n return ws[0] + ws[1] * self.factor",
"def width(self) -> int:\n if self.props.max_width:\n max_width = UIMetric.parse(self.props.max_width).to_pixels(self.parent.width)\n return min(self.isize[0].to_pixels(self.pa... | [
"0.7869717",
"0.7518619",
"0.7436807",
"0.7426504",
"0.740964",
"0.73878866",
"0.7373907",
"0.7346486",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.73420584",
"0.7... | 0.85264724 | 0 |
Returns the unique object name for this node. | def objectName( self ):
return self._objectName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_name(self):\n return util.join_names_underscore(self.name, str(self.as_pointer()))",
"def get_object_name(self):\n return self.obj_name",
"def _auto_name(self):\n return \"node_\"+str(self._id)",
"def node_name(self):\n return self._node_name",
"def name(self):\n ... | [
"0.81312424",
"0.78860253",
"0.770343",
"0.7681795",
"0.76559687",
"0.7643479",
"0.7616327",
"0.7458475",
"0.74100065",
"0.74100065",
"0.7396586",
"0.7363082",
"0.7339985",
"0.7320377",
"0.72984",
"0.7270432",
"0.726201",
"0.7252129",
"0.7219291",
"0.7208145",
"0.7151691",
... | 0.0 | -1 |
Returns the unique object identifier that was assinged on creation. | def objectId( self ):
return self._objectId | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_identifier(self):\n\n if '_identifier' not in self.__dict__:\n\n object_or_string, args, kwargs = self._init_args\n\n # Get the identifier for the wrapped object, e.g. 'auth.user.1234'\n # If there is a lookup in the kwargs, then the following call\n # wi... | [
"0.7629974",
"0.7395455",
"0.73138493",
"0.7282147",
"0.7279018",
"0.7236187",
"0.72342706",
"0.72342706",
"0.7223273",
"0.7207081",
"0.71965677",
"0.7190882",
"0.7182943",
"0.7181792",
"0.7180023",
"0.7180023",
"0.7180023",
"0.7180023",
"0.7180023",
"0.7180023",
"0.7180023",... | 0.0 | -1 |
Returns a list of output connections from the scene that match the inputed class for this node. | def outputConnections(self, cls=None):
scene = self.scene()
if ( not scene ):
return []
if ( not cls ):
cls = XNodeConnection
output = []
for item in scene.items():
if ( not isinstance(item, cls) ):
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connections( self, cls = None ):\n scene = self.scene()\n if ( not scene ):\n return []\n \n if ( not cls ):\n cls = XNodeConnection\n \n output = []\n for item in scene.items():\n if ( not isinstance(item, cls) ):\n ... | [
"0.8415208",
"0.80199903",
"0.6465113",
"0.64042443",
"0.63212657",
"0.6167451",
"0.61002463",
"0.6041828",
"0.6038249",
"0.6000693",
"0.59841263",
"0.59339666",
"0.59319425",
"0.59319425",
"0.5910733",
"0.58989316",
"0.5887064",
"0.5885338",
"0.5860164",
"0.5853799",
"0.5842... | 0.87322986 | 0 |
Sets the display name for this node. | def setDisplayName( self, name ):
self._displayName = name
self._titleFont = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_display_name(self, display_name):\n self._call('set_display_name', display_name=display_name)",
"def display_name(self, display_name):\n self._display_name = display_name",
"def display_name(self, display_name):\n self._display_name = display_name",
"def display_name(self, displa... | [
"0.83585346",
"0.8110245",
"0.8110245",
"0.8110245",
"0.8110245",
"0.8110245",
"0.8110245",
"0.8087439",
"0.80680996",
"0.80680996",
"0.80680996",
"0.80680996",
"0.80680996",
"0.80680996",
"0.7144848",
"0.6924131",
"0.6890495",
"0.6877855",
"0.66721064",
"0.66643775",
"0.6624... | 0.7689908 | 14 |
Sets the amount of padding that will be used when rendering the \ highlight border around the node. | def setHighlightPadding( self, padding ):
self._highlightPadding = float(padding) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetToolBorderPadding(self, padding):\r\n\r\n self._tool_border_padding = padding",
"def highlightPadding( self ):\n return self._highlightPadding",
"def padding_width(self):\n ...",
"def additional_vertical_padding(self):\n return 0",
"def padding(self):\r\n return se... | [
"0.74610865",
"0.69948614",
"0.6751445",
"0.6584775",
"0.64020216",
"0.63562196",
"0.6188301",
"0.6153377",
"0.61403984",
"0.61234355",
"0.596154",
"0.5921232",
"0.5851498",
"0.5788392",
"0.5781865",
"0.5774913",
"0.5633154",
"0.5620949",
"0.55321753",
"0.55206317",
"0.548394... | 0.8281502 | 0 |
Sets the size for this icon to the inputed size. | def setIconSize(self, iconSize):
self._iconSize = iconSize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_icon_size(self, size: datatypes.SizeType):\n self.setIconSize(datatypes.to_size(size))",
"def set_size(self, size):\n \n self.width = size[0]\n self.height = size[1]",
"def size(self, size):\n self.width = size\n self.height = size",
"def size(self, size):\n ... | [
"0.8566904",
"0.8098828",
"0.7789692",
"0.7789692",
"0.7493516",
"0.73365754",
"0.73365754",
"0.73365754",
"0.73365754",
"0.73196566",
"0.7313546",
"0.7257175",
"0.7241842",
"0.7219154",
"0.7187264",
"0.71640384",
"0.71270716",
"0.7022709",
"0.7015506",
"0.6984216",
"0.698421... | 0.83544326 | 1 |
Sets the layer that this node is associated with to the given layer. | def setLayer( self, layer ):
if ( layer == self._layer ):
return False
self._layer = layer
self.syncLayerData()
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer(self, layer):\n self._layer = layer",
"def SetLayer(self, *args):\n return _XCAFDoc.XCAFDoc_LayerTool_SetLayer(self, *args)",
"def Layer(self, layer):\r\n \r\n self.dock_layer = layer\r\n return self",
"def set_prev_layer(self, layer):\n self._prev_layer = ... | [
"0.8302577",
"0.7181522",
"0.7148477",
"0.7040238",
"0.69363886",
"0.68028075",
"0.6787735",
"0.6670378",
"0.65762866",
"0.6492718",
"0.6490444",
"0.64064187",
"0.6362415",
"0.63169426",
"0.63000846",
"0.6273308",
"0.61537844",
"0.61123204",
"0.61032206",
"0.6030066",
"0.5935... | 0.75389385 | 1 |
Sets the unique object name for this node by grabbing the next \ available unique name from the scene based on the inputed string. \ The resulting name will be returned. | def setObjectName( self, name ):
scene = self.scene()
if ( scene ):
name = scene.uniqueNodeName(name)
self._objectName = name
self._titleFont = None
self.update() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_object_name(remote, object_id, new_name):\n cmd = mmapi.StoredCommands()\n cmd.AppendSceneCommand_SetObjectName(object_id, new_name)\n remote.runCommand(cmd)",
"def _auto_name(self):\n return \"node_\"+str(self._id)",
"def set_object_name(self, object_name = \"DefaultObject\"):\n ... | [
"0.7078243",
"0.63318175",
"0.62258357",
"0.6208782",
"0.6110824",
"0.6036538",
"0.5972603",
"0.5937781",
"0.5936959",
"0.5935982",
"0.5935982",
"0.5885006",
"0.5871098",
"0.5845946",
"0.5819502",
"0.5816719",
"0.58166677",
"0.58151984",
"0.5793064",
"0.5752507",
"0.5745988",... | 0.6609411 | 1 |
Sets whether or not this node will wrap its text. | def setWordWrap(self, state = True):
self._titleFont = None
self._wordWrap = state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_wrap(self):\n textArea = self.get_current()\n if self.wrap.get() == 0:\n textArea.config(wrap='none')\n elif self.wrap.get() == 1:\n textArea.config(wrap='word')",
"def SetWrapMode(self, wrap):\n if wrap:\n val = wx.stc.STC_WRAP_WORD\n ... | [
"0.6767211",
"0.66444504",
"0.5964008",
"0.56075084",
"0.5536771",
"0.55288583",
"0.5494655",
"0.5340258",
"0.5318567",
"0.51770866",
"0.5136378",
"0.5113896",
"0.5019841",
"0.4970556",
"0.48652825",
"0.4846877",
"0.48280108",
"0.47594061",
"0.47561562",
"0.47017792",
"0.4673... | 0.6782867 | 0 |
Create a Flask app instance under a given environment. | def create_app(env="production"):
app = Flask(__name__, static_url_path="/")
config_app(app, env=env)
with app.app_context():
Moment(app)
init_db(app)
enable_parser(app)
register_route(app)
register_blue(app)
init_logger(app)
init_scheduler(app)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(config='dev'):\n if config == 'dev':\n from .conf.config import DevelopmentConfig as dev_config\n app = configure_app(Flask(__name__), dev_config)\n else:\n from .conf.config import ProdConfig\n app = configure_app(Flask(__name__), ProdConfig)\n\n # setup flask b... | [
"0.8119251",
"0.8070359",
"0.79725164",
"0.79482853",
"0.7922162",
"0.78402853",
"0.783801",
"0.78319263",
"0.78314185",
"0.7830267",
"0.7828874",
"0.7774874",
"0.7771263",
"0.77704066",
"0.77687365",
"0.7768023",
"0.7707631",
"0.7698262",
"0.7696986",
"0.7678057",
"0.7672568... | 0.84054095 | 0 |
Return iterable of 2tuples in a sliding window. >>> list(pairwise([1,2,3,4])) [(1,2),(2,3),(3,4)] | def pairwise(iterable):
a, b = tee(iterable)
next(b, None)
return zip(a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairwise(s: List[Any]) -> Iterator[Tuple[Any, Any]]:\n\n a, b = itertools.tee(s)\n next(b, None)\n return zip(a, b)",
"def pairwise(iterable):\n a, b = itertools.tee(iterable)\n next(b, None)\n return zip(a, b)",
"def pairwise(iterable):\n a, b = itertools.tee(iterable)\n next(b, No... | [
"0.69021386",
"0.6745067",
"0.6745067",
"0.6745067",
"0.6744928",
"0.6728406",
"0.6723725",
"0.6723725",
"0.66663635",
"0.66625524",
"0.66507536",
"0.66132796",
"0.65850466",
"0.65676963",
"0.65217906",
"0.6511683",
"0.64627945",
"0.6459105",
"0.6454867",
"0.64413005",
"0.644... | 0.6775879 | 2 |
'strings' str or list[str] | def output(strings):
cCommand_ScrollToEnd = 259 # cudatext_cmd.py
if not isinstance(strings, list):
strings = [strings]
for s in strings:
app_log(LOG_ADD, s, panel=LOG_PANEL_OUTPUT)
oed = Command._output_ed
if option_tail_log and oed:
oed.cmd(cCommand_ScrollToEnd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strings_to_list(one_or_more_strings):\n if isinstance(one_or_more_strings, str):\n return [one_or_more_strings]\n else:\n return list(one_or_more_strings)",
"def str_or_list(value):\n if isinstance(value, list):\n return value\n return [value]",
"def is_str_or_coll(value):... | [
"0.72052544",
"0.71974766",
"0.6819432",
"0.67252743",
"0.66679",
"0.66212285",
"0.6513443",
"0.6508038",
"0.6469922",
"0.64685524",
"0.6458292",
"0.63422805",
"0.6301152",
"0.62780535",
"0.6234739",
"0.6151075",
"0.613814",
"0.61164933",
"0.60950285",
"0.6064773",
"0.6054942... | 0.0 | -1 |
Add a vertex to this graph. | def add_vertex(self, key: str, data=None):
if key in self._vertex_map:
self._vertex_map[key].data = data
else:
v = Vertex(key, data)
self._vertex_map[key] = v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')",
"def add_vertex(self, vertex_id):\n pass # TODO",... | [
"0.857421",
"0.8381063",
"0.8218266",
"0.82094896",
"0.817831",
"0.81343365",
"0.8126437",
"0.8036957",
"0.80030394",
"0.7970701",
"0.7967142",
"0.778716",
"0.7667648",
"0.7608623",
"0.75789094",
"0.7546433",
"0.7542984",
"0.7512593",
"0.7512593",
"0.75092775",
"0.74408984",
... | 0.73010117 | 27 |
Add an edge to this graph. If the vertex is not in, it will create one. | def add_edge(self, key_from, key_to, weight: float=None, directed: bool=None):
if directed is None:
directed = self._default_directed
if weight is None:
weight = self._default_weight
if key_from not in self._vertex_map:
self.add_vertex(key_from, None)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, source_vertex, destination_vertex):\n self.vertex_edge[source_vertex].append(destination_vertex)\n new_edge = GraphEdge(source_vertex, destination_vertex)\n if destination_vertex not in self.vertex_edge:\n self.edges.append(new_edge)",
"def _add_edge(self, graph... | [
"0.79311275",
"0.78077734",
"0.7774987",
"0.77557415",
"0.7752967",
"0.7715503",
"0.7714842",
"0.770112",
"0.76976955",
"0.7686116",
"0.7655563",
"0.76517206",
"0.76204586",
"0.7601829",
"0.7492212",
"0.7479867",
"0.74508107",
"0.74275947",
"0.7426933",
"0.7399874",
"0.739779... | 0.0 | -1 |
Get a list of all vertices reachable by the given key. | def get_adjacent(self, key: str) -> Dict[str, float]:
return self._vertex_map[key].edges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_vertices(self):\n return list(self.graph_dict.keys())",
"def obtener_vertices(self):\n return list(self.vertices.keys())",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def get_vertices(self):\n if self.vert_list.keys() != None:\n return self.ve... | [
"0.6960612",
"0.6956209",
"0.68852985",
"0.6866054",
"0.68118364",
"0.6809329",
"0.680517",
"0.6804608",
"0.6782531",
"0.6782531",
"0.6782531",
"0.6726654",
"0.6722369",
"0.66754985",
"0.66630906",
"0.66516703",
"0.65449613",
"0.65402865",
"0.6519603",
"0.64706624",
"0.644173... | 0.61467993 | 27 |
Get the keys of all the reachable vertices from the given vertex. | def get_adjacent_keys(self, key: str) -> List[str]:
return [k for k in self.get_adjacent(key)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_vertices(self, vertex):\n return self[vertex].keys()",
"def get_vertex_keys(self):\n return self.vertList.keys()",
"def get_vertices(self):\n return self.graph.keys()",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\n return self... | [
"0.7874921",
"0.74326473",
"0.69859785",
"0.6860443",
"0.67869085",
"0.6751866",
"0.6750424",
"0.67484635",
"0.67484635",
"0.67484635",
"0.67403936",
"0.67057854",
"0.66119283",
"0.6596999",
"0.65115917",
"0.6511486",
"0.6510455",
"0.644314",
"0.6406113",
"0.6402527",
"0.6387... | 0.58964264 | 37 |
Number of vertices in the graph. | def vertex_count(self) -> int:
return len(self._vertex_map) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_vertices(self):\r\n return len(self.__graph_dict.keys())",
"def num_vertices(self):\n return self._top_exp.number_of_vertices()",
"def vertexCount(self):\n return self._nVertices",
"def get_num_vertices(self):\n\n return self._graph_state.get_num_vertices()",
"def num_ve... | [
"0.8986376",
"0.8914409",
"0.89133537",
"0.88707083",
"0.88079834",
"0.88079834",
"0.8756725",
"0.8683766",
"0.8604881",
"0.86003137",
"0.86002916",
"0.84918517",
"0.8387727",
"0.82340765",
"0.81260645",
"0.8042168",
"0.77830786",
"0.7766086",
"0.76938653",
"0.7502482",
"0.74... | 0.8650963 | 8 |
Calculate shipping price based on settings and taxes. | def get_taxed_shipping_price(price, taxes):
charge_taxes = charge_taxes_on_shipping()
if not charge_taxes:
taxes = None
return apply_tax_to_price(taxes, DEFAULT_TAX_RATE_NAME, price) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkout_shipping_price(\n *,\n manager: \"PluginsManager\",\n checkout_info: \"CheckoutInfo\",\n lines: Iterable[\"CheckoutLineInfo\"],\n address: Optional[\"Address\"],\n discounts: Optional[Iterable[DiscountInfo]] = None,\n) -> \"TaxedMoney\":\n calculated_checkout_shipping = manager.ca... | [
"0.7576781",
"0.70215034",
"0.68718714",
"0.6810957",
"0.65419614",
"0.6535996",
"0.6404565",
"0.6362633",
"0.6335536",
"0.61709255",
"0.6071982",
"0.6071982",
"0.60590076",
"0.59475243",
"0.59437746",
"0.5919209",
"0.5881049",
"0.5864832",
"0.57624364",
"0.57487446",
"0.5745... | 0.6907708 | 2 |
A fc transition prediction network that takes a compressed latent space and a onehot vector of an action to predict the latent space for the next state | def build_deep_predictor(state_size, action_size):
concated_input = Input(shape=(state_size + action_size,))
output = Dense(1024, activation='relu', name='p_d1')(concated_input)
output = Dense(1024, activation='relu', name='p_d2')(output)
output = Dense(state_size, activation='relu', name='p_dout')(outp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, state, action):\n s = self.state_encoder(state)\n x = torch.cat((s,action),dim=1)\n x = self.act(self.fc2(x))\n x = self.fc_out(x)*10\n return x",
"def predict_next_state_model(self, states, actions):\n # TODO: write your code here\n # states.sha... | [
"0.6738001",
"0.672495",
"0.67243326",
"0.6719233",
"0.6637163",
"0.65922123",
"0.6546726",
"0.6538526",
"0.6523729",
"0.65067625",
"0.6502851",
"0.64919066",
"0.6476632",
"0.6476632",
"0.6465294",
"0.6463675",
"0.6454626",
"0.6454104",
"0.6454104",
"0.6439651",
"0.6421872",
... | 0.5814624 | 72 |
Takes an encoder in and compresses X_train into latent representations and concatenates the representations with the selected action from actions. | def encode_to_samples(encoder, X_train, actions, z_shape, split_inputs=True):
arr = encoder.predict(X_train)
arr = arr.reshape(len(X_train), z_shape)
if not split_inputs:
x_samples = np.concatenate((arr, actions), axis=1)
x_samples = x_samples[:-1]
else:
x_samples = arr[:-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoencoder(X, inp_dims=2048):\n drop = tf.keras.layers.Dropout(rate=0.2)\n FC1 = tf.layers.Dense(units=inp_dims // 2, activation=\"tanh\", name='fc1')\n FC2 = tf.layers.Dense(units=inp_dims // 4, activation=\"tanh\", name='fc2')\n FC3 = tf.layers.Dense(units=inp_dims // 8, activation=None, name='f... | [
"0.60210884",
"0.6004789",
"0.598425",
"0.58861935",
"0.58126324",
"0.57228535",
"0.5717141",
"0.57102686",
"0.57094264",
"0.57051057",
"0.5662154",
"0.561293",
"0.5540799",
"0.5510727",
"0.54815537",
"0.54730964",
"0.5461567",
"0.54551136",
"0.5452826",
"0.5431874",
"0.53676... | 0.6337255 | 0 |
Plots nb_examples examples with original images and restored images from an autoencoder | def plot_examples_autoencoder(autoencoder, X_test, nb_examples=10):
if nb_examples == 0:
return
decoded_imgs = autoencoder.predict(X_test)
n = nb_examples
plt.figure(figsize=(nb_examples * 2, 4))
for i in range(n):
# display original
ax = plt.subplot(2, n, i + 1)
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize(**images):\n n_images = len(images)\n plt.figure(figsize=(20,8))\n for idx, (name, image) in enumerate(images.items()):\n plt.subplot(1, n_images, idx + 1)\n plt.xticks([]); \n plt.yticks([])\n # get title from the parameter names\n plt.title(name.replace('... | [
"0.71421576",
"0.702376",
"0.6868032",
"0.68552196",
"0.67953753",
"0.6716361",
"0.6629648",
"0.66070324",
"0.65922207",
"0.6540763",
"0.65361834",
"0.6528978",
"0.6500601",
"0.6419638",
"0.6417399",
"0.64063734",
"0.6389318",
"0.6380299",
"0.63449746",
"0.6327107",
"0.632561... | 0.8622018 | 0 |
Plots nb_examples images with original image and a predicted (restored) image | def plot_images(imgs_org, imgs_pred, nb_examples=10):
if nb_examples == 0:
return
n = nb_examples
plt.figure(figsize=(nb_examples * 2, 4))
for i in range(n):
# display original
ax = plt.subplot(2, n, i + 1)
plt.imshow(imgs_org[i].reshape(84, 84))
plt.gray()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_examples_autoencoder(autoencoder, X_test, nb_examples=10):\n\n if nb_examples == 0:\n return\n\n decoded_imgs = autoencoder.predict(X_test)\n\n n = nb_examples\n plt.figure(figsize=(nb_examples * 2, 4))\n for i in range(n):\n # display original\n ax = plt.subplot(2, n, ... | [
"0.71065915",
"0.7087435",
"0.7081004",
"0.70215356",
"0.70094246",
"0.6819703",
"0.6788796",
"0.6767681",
"0.67110443",
"0.6704279",
"0.67035943",
"0.6688267",
"0.6616947",
"0.66110945",
"0.65785134",
"0.6575784",
"0.6572968",
"0.65630656",
"0.6549626",
"0.6543663",
"0.65103... | 0.75928336 | 0 |
Generate a random 32byte hex integer which serves as a randomly generated Bitcoin private key. | def generate_private_key():
return binascii.hexlify(os.urandom(32)).decode('utf-8').upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_random_key():\n return '%030x' % (random.randrange(256**15),)",
"def generate_key():\n\tkey = [ randint(0,255) for i in range(16) ]\n\treturn bytes( key )",
"def generate_key(self)->bytes:\n return os.urandom(32)",
"def randkey():\n return binascii.b2a_hex(os.urandom(15))",
"def g... | [
"0.81205463",
"0.7953456",
"0.79166657",
"0.7904878",
"0.77918917",
"0.7785113",
"0.7766445",
"0.76705956",
"0.7502073",
"0.73962563",
"0.73770595",
"0.7202594",
"0.7190065",
"0.71579206",
"0.7144906",
"0.7118183",
"0.7082788",
"0.7070619",
"0.7047848",
"0.7039808",
"0.702472... | 0.80987847 | 1 |
function to compute area of triangle from the coordinate of its vertices. It is based on the identity | def compute_triangle_area(vertices):
v01 = vertices[0] - vertices[1]
v02 = vertices[0] - vertices[2]
cross_prod = np.cross(v01, v02)
area = 0.5 * np.linalg.norm(cross_prod)
return area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area_triangle(w, h):\n return w * h / 2",
"def area_triangle(triangle):\n return 0.5 * length_vector(normal_triangle(triangle, False))",
"def triangle_area(base, height):\n return (base * height) / 2",
"def triangle_area(triangle):\n # sides of the triangle\n a = great_circle_distance(tria... | [
"0.76730376",
"0.7580494",
"0.7520314",
"0.73829406",
"0.7376496",
"0.7303629",
"0.72407633",
"0.7231931",
"0.72223485",
"0.7220913",
"0.7171417",
"0.7168666",
"0.7167536",
"0.7032066",
"0.70216846",
"0.6998763",
"0.6964781",
"0.69467694",
"0.6916998",
"0.68779814",
"0.683453... | 0.8399615 | 0 |
Add a vertex to the graph, associated with the given key (vertex) | def addVertex(self, vertex):
if vertex not in self.adjList:
self.adjList[vertex] = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, key):\n vertex = Vertex(key)\n self.vertices[key] = vertex",
"def add_vertex(self, key):\n if key in self.vertices:\n raise ValueError('Key is already in use')\n \n # Create vertex\n self.vertices[key] = GraphVertex(key=key)",
"def add_v... | [
"0.8936895",
"0.87988317",
"0.8693015",
"0.86012435",
"0.8529603",
"0.8359792",
"0.82464224",
"0.8126288",
"0.8068252",
"0.80507946",
"0.7965733",
"0.7941699",
"0.7941699",
"0.794012",
"0.7839545",
"0.7819588",
"0.7790153",
"0.77836865",
"0.7712698",
"0.7694323",
"0.76920503"... | 0.6789256 | 56 |
Add an edge from vertex1 to vertex2. If vertex1 or vertex2 is not in the graph, adds it. | def addEdge(self, vertex1, vertex2):
self.addVertex(vertex1)
self.addVertex(vertex2)
if vertex2 not in self.adjList[vertex1]:
self.adjList[vertex1].append(vertex2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, vertex1, vertex2):\n\n vertex1.add_outgoing_node(vertex2)\n vertex2.add_incoming_node(vertex1)",
"def add_edge(self, v1, v2):\n if v1 in self.vertices and v2 in self.vertices:\n self.vertices[v1].add(v2)\n else:\n raise IndexError('nonexistent ... | [
"0.8944536",
"0.8927446",
"0.8873687",
"0.8868193",
"0.8857533",
"0.8817274",
"0.881627",
"0.8732079",
"0.8647032",
"0.86464995",
"0.86078024",
"0.85898364",
"0.8586614",
"0.85244405",
"0.8513045",
"0.8418522",
"0.8387593",
"0.82374",
"0.81838477",
"0.8153136",
"0.80992824",
... | 0.8700775 | 8 |
Returns a list of the vertices in the graph | def getVertices(self):
return list(self.adjList.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n return list(self.__graph.values())",
"def list_vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\n return list(s... | [
"0.8966185",
"0.8889699",
"0.8723974",
"0.8654468",
"0.86214346",
"0.86214346",
"0.86214346",
"0.86056864",
"0.8591276",
"0.8275895",
"0.82643354",
"0.8235997",
"0.819631",
"0.81693244",
"0.8166957",
"0.81126577",
"0.80120325",
"0.7950158",
"0.79173464",
"0.7916417",
"0.78988... | 0.8107757 | 16 |
Initialize empty products list | def __init__(self):
self.products_list = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize(self):\n for p in Product.all():\n s = Stock(product=p)\n self.stocks.append(s)",
"def get_all_products(self):\n\t\tpass",
"def products(self):\r\n return Products(self)",
"def fill_data_product(self):\n self.product.fill_data_product(self.list_produ... | [
"0.7168179",
"0.661325",
"0.653802",
"0.6536679",
"0.6509833",
"0.6500168",
"0.6494007",
"0.6432161",
"0.64316857",
"0.63805115",
"0.63805115",
"0.63503313",
"0.6347839",
"0.6347839",
"0.6339022",
"0.6331013",
"0.6329717",
"0.6303353",
"0.6294335",
"0.6263267",
"0.62507623",
... | 0.7951118 | 0 |
Initialize empty sales list | def __init__(self):
self.sales_list = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize(self):\n for p in Product.all():\n s = Stock(product=p)\n self.stocks.append(s)",
"def sales(self, sales):\n\n self._sales = sales",
"def _initialize(self):\n for s in Subsidiary.all():\n self.__create_stock(s)\n self.get_stock()",
... | [
"0.63982904",
"0.61059684",
"0.6099104",
"0.60775125",
"0.5981639",
"0.5926354",
"0.5833663",
"0.5826822",
"0.57878435",
"0.5742654",
"0.57095075",
"0.57095075",
"0.56960493",
"0.5686805",
"0.5628163",
"0.5616223",
"0.5613083",
"0.5608224",
"0.5603004",
"0.55779916",
"0.55508... | 0.7864601 | 0 |
This function takes raw text and tokenize it to its words | def tokenize(raw_text):
tokenized_text = nltk.tokenize.word_tokenize(raw_text)
return tokenized_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(self, raw_text):\n # TODO implement\n raw_tokens = word_tokenize(raw_text.decode('utf8'))\n return self.filter_tokens(raw_tokens)\n # return self.split_by(raw_tokens, '-')",
"def tokenize(text):\n return text.split(' ')",
"def tokenize(text):\n # YOUR CODE HERE\n ... | [
"0.82272923",
"0.79341096",
"0.7769527",
"0.77452534",
"0.76737857",
"0.75745934",
"0.757046",
"0.75285643",
"0.7519456",
"0.74526465",
"0.744597",
"0.7439333",
"0.73951745",
"0.7319529",
"0.73027015",
"0.72935724",
"0.728807",
"0.72760826",
"0.72453827",
"0.72308433",
"0.719... | 0.84086365 | 0 |
This function takes the list of tokenized words and returns list without stopwords. | def remove_stop_words(tokenized_word_list):
stop_words = set(nltk.corpus.stopwords.words("english"))
filtered_tokens = [word for word in tokenized_word_list if word not in stop_words]
return filtered_tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords(tokens):\n\n return [t for t in tokens if t not in stopwords.words('english')]",
"def remove_stopwords(tokens):\n stop_words = set(stopwords.words('english'))\n\n tokens = [w for w in tokens if w not in stop_words]\n\n return tokens",
"def remove_stop_words(stop_list, tokens):\... | [
"0.8672013",
"0.8584758",
"0.8500015",
"0.8451339",
"0.8395997",
"0.83444405",
"0.83253455",
"0.83132756",
"0.8255464",
"0.82456136",
"0.8214626",
"0.81866866",
"0.81843334",
"0.8160559",
"0.8160559",
"0.8160559",
"0.8160559",
"0.81329656",
"0.8074451",
"0.8063902",
"0.805831... | 0.88943434 | 0 |
Returns onehot representation of a global class. | def global_class_to_one_hot(global_class):
if global_class == 'Store':
return [1, 0, 0, 0, 0]
elif global_class == 'Home':
return [0, 1, 0, 0, 0]
elif global_class == 'Public spaces':
return [0, 0, 1, 0, 0]
elif global_class == 'Leisure':
return [0, 0, 0, 1, 0]
elif g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def To1hot(label,num_class):\n onehot = np.zeros(num_class)\n onehot[label] = 1\n return onehot",
"def class2onehot(class_labels, seq_len, batchsize, num_task):\n\n\n one_hot = torch.FloatTensor(batchsize,seq_len,num_task)\n one_hot.zero_()\n one_hot = one_hot.scatter_(1, seq_len,class_labels, ... | [
"0.75213486",
"0.7405543",
"0.73196197",
"0.72129333",
"0.719019",
"0.71895164",
"0.71585053",
"0.7155093",
"0.7150308",
"0.71444654",
"0.7121219",
"0.709595",
"0.7056187",
"0.7044944",
"0.7044944",
"0.7009122",
"0.7006752",
"0.69704676",
"0.6921655",
"0.6919447",
"0.6895392"... | 0.8675154 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.