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 |
|---|---|---|---|---|---|---|
Computes the cumulative sum of a tensor, optionally along an axis. | def cumsum(tensor, axis=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumsum(x, axis=None):\r\n return CumsumOp(axis=axis)(x)",
"def sum(tensor, axis=None):\n raise NotImplementedError",
"def cumsum(module, y, dimension):\n _import_modules()\n if module in [np, ma, torch, jnp]:\n return module.cumsum(y, axis=dimension)\n elif module == tf:\n ... | [
"0.7937697",
"0.78831965",
"0.72233796",
"0.6870484",
"0.68425846",
"0.6826707",
"0.66919386",
"0.6602964",
"0.65445274",
"0.651045",
"0.651045",
"0.651045",
"0.6496135",
"0.646525",
"0.6463025",
"0.6459107",
"0.6432675",
"0.6432675",
"0.6432675",
"0.6394284",
"0.63011426",
... | 0.8972412 | 0 |
Elementwise maximum of array elements. | def maximum(x1, x2, *args, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(self):\n max = 0\n a = self.array_form\n for i in xrange(len(a)):\n if a[i] != i and a[i] > max:\n max = a[i]\n return max",
"def arrmax(a):\n # could set arrmax = amax in scipy if scipy is installed\n try:\n return max(a.flat... | [
"0.76307356",
"0.7626229",
"0.7625544",
"0.7574346",
"0.7574346",
"0.7496727",
"0.7167887",
"0.716463",
"0.7150992",
"0.7148548",
"0.70899373",
"0.70677686",
"0.70045",
"0.6977212",
"0.6886144",
"0.68276274",
"0.68126154",
"0.6786964",
"0.6769891",
"0.6768062",
"0.67500263",
... | 0.0 | -1 |
The max value in a tensor. | def max(tensor, axis=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max(self):\n\t\tif self.right:\n\t\t\treturn self.right.get_max()\n\t\treturn self.value",
"def get_max_value(self):\n if self.is_ready():\n max_values = [dnd.get_max_value() for dnd in self.dnds]\n max_value = max(max_values)\n else:\n max_value = torch.ten... | [
"0.7910435",
"0.7779644",
"0.7729218",
"0.76105416",
"0.7596861",
"0.75736403",
"0.75605553",
"0.753701",
"0.7525373",
"0.74939203",
"0.7447353",
"0.7445484",
"0.7445484",
"0.73652744",
"0.72967285",
"0.72415084",
"0.7239188",
"0.7239188",
"0.722882",
"0.7226523",
"0.7187277"... | 0.78647614 | 1 |
The min value in a tensor. | def min(tensor, axis=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argmin(tensor):\n raise NotImplementedError",
"def dim_zero_min(x: Tensor) ->Tensor:\n return torch.min(x, dim=0).values",
"def get_min_value(self, dim):\n return self._min_values[dim]",
"def minimum_value(self):\n return self._fitness[self._minidx]",
"def getmin(self):\n\n ... | [
"0.7766424",
"0.76960033",
"0.76009655",
"0.75072306",
"0.7468903",
"0.7458856",
"0.7452972",
"0.7452972",
"0.7441845",
"0.7421512",
"0.73983556",
"0.7394464",
"0.7275324",
"0.72620344",
"0.7229921",
"0.72105974",
"0.7190664",
"0.715763",
"0.7156598",
"0.7156598",
"0.71488595... | 0.7967963 | 0 |
The argument of the max value in a tensor. | def argmax(tensor):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(tensor, axis=None):\n raise NotImplementedError",
"def max(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max\")",
"def max(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max\")",
"def quant_max(tensor):\n return torch.abs(tensor.detach()).max() + 1e-8",
"d... | [
"0.7532538",
"0.7486494",
"0.7486494",
"0.7393747",
"0.73670167",
"0.7301247",
"0.7206643",
"0.72026426",
"0.7109342",
"0.710928",
"0.7089074",
"0.7082996",
"0.7072433",
"0.7063385",
"0.70579827",
"0.7048805",
"0.7048805",
"0.7048805",
"0.7048805",
"0.7048805",
"0.7048805",
... | 0.7758389 | 0 |
Compute the sum of a tensor, optionally along an axis. | def sum(tensor, axis=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumsum(tensor, axis=None):\n raise NotImplementedError",
"def sum(self, axis=None, keepdims=False):\n return F.Sum.apply(self, axis, keepdims)",
"def sum(input, axis=None, dtype=None, keepdims=False, acc_dtype=None):\r\n\r\n out = elemwise.Sum(axis=axis, dtype=dtype, acc_dtype=acc_dtype)(i... | [
"0.76129884",
"0.760164",
"0.717512",
"0.71730393",
"0.7142518",
"0.70465153",
"0.7019281",
"0.70191276",
"0.6943526",
"0.6844853",
"0.6665277",
"0.66257095",
"0.66057914",
"0.6493514",
"0.64828867",
"0.6459901",
"0.64040184",
"0.63768697",
"0.6352411",
"0.6323563",
"0.627293... | 0.89411587 | 0 |
Compute the product of a tensor, optionally along an axis. | def prod(tensor, axis=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __mul__(self, tensor):\n return self.mul(tensor)",
"def prod(self, axis=None, keepdims=False, dtype=None, out=None):\n return np.multiply.reduce(\n self, out=out, axis=axis, keepdims=keepdims, dtype=dtype\n )",
"def matmul(x1, x2=None, axis=None, **kwargs):\n if x2 is Non... | [
"0.717743",
"0.6967511",
"0.6793641",
"0.6740474",
"0.6715468",
"0.6708627",
"0.66012275",
"0.6574067",
"0.6574067",
"0.6574067",
"0.6574067",
"0.65613925",
"0.65414166",
"0.64582485",
"0.6403318",
"0.63955",
"0.6356159",
"0.6327551",
"0.6326461",
"0.6317262",
"0.6242131",
... | 0.85739976 | 0 |
Dot product of two tensors. | def dot(a, b):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\r\n a, b = as_tensor_variable(a), as_tensor_variable(b)\r\n\r\n if a.ndim == 0 or b.ndim == 0:\r\n return a * b\r\n elif a.ndim > 2 or b.ndim > 2:\r\n return tensordot(a, b, [[a.ndim - 1], [numpy.maximum(0, b.ndim - 2)]])\r\n else:\r\n return _dot(a, b)",
"def dot_... | [
"0.8551767",
"0.84130573",
"0.7811402",
"0.7799333",
"0.7785713",
"0.77851534",
"0.7732423",
"0.77285725",
"0.7726368",
"0.7724795",
"0.760753",
"0.75903976",
"0.756879",
"0.7536983",
"0.7503956",
"0.74794996",
"0.7442627",
"0.7434981",
"0.7429006",
"0.7407977",
"0.7405396",
... | 0.6874502 | 63 |
Compute the qr factorization of a matrix. Factor the matrix `a` as qr, where `q` is orthonormal and `r` is uppertriangular. | def qr(a):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qr_decomposition(self):\n if self.m != self.n:\n raise NotImplementedError('QR decomposition not yet available ' +\n 'for non-square matrices')\n orig_basis = [vec.Vector.fromMatrixColumn(self, j)\n for j in range(self.m)]\n ... | [
"0.7067727",
"0.70269",
"0.67762756",
"0.6731593",
"0.6671205",
"0.6656542",
"0.66193026",
"0.6488131",
"0.644804",
"0.6403251",
"0.6386199",
"0.6381143",
"0.6345571",
"0.63338315",
"0.6314782",
"0.6284887",
"0.6214967",
"0.62065643",
"0.61569804",
"0.61322236",
"0.61255443",... | 0.682062 | 2 |
Get arguments from CLI | def get_args():
parser = argparse.ArgumentParser(
description="""Assemble raw reads using ABySS"""
)
parser.add_argument(
"--output",
required=True,
action=FullPaths,
default=None,
help="""The directory in which to store the assembly data""",
)
parser.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_arguments(self):\n pass",
"def get_args():\n\n parser = get_argument_parser()\n args = parser.parse_args()\n\n return args",
"def parse_cli_args():\r\n parser = argparse.ArgumentParser(\r\n description=\"list all installed packages\")\r\n\r\n parser.add_argument(\"-v\",... | [
"0.83995515",
"0.7696954",
"0.7674078",
"0.7656369",
"0.75491726",
"0.7546294",
"0.7523218",
"0.7521475",
"0.7514517",
"0.75119865",
"0.74877495",
"0.74807847",
"0.74693704",
"0.7466727",
"0.74665916",
"0.74520636",
"0.74513096",
"0.7427955",
"0.7422721",
"0.74211824",
"0.740... | 0.0 | -1 |
applies a buff/debuff to the player | def take_buff(self, key, magnitude, duration):
#EFFECTS: DoT, buffs: (attack, defense, move speed), knockback, stun
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyBuff(state, buf) :\n newState = copy.deepcopy(state)\n bufList = newState['player']['buff']\n bufNames = [ b[0]['name'] for b in bufList ]\n # If buff already applied\n if buf['name'] in bufNames :\n # If buff has stacks\n if 'maxStacks' in buf :\n # Updates the buf... | [
"0.6795611",
"0.672119",
"0.66043043",
"0.6433635",
"0.5971736",
"0.59266824",
"0.58500385",
"0.58344626",
"0.5822975",
"0.57869786",
"0.57704735",
"0.573941",
"0.57214826",
"0.5667467",
"0.56551385",
"0.5595512",
"0.5557706",
"0.55083984",
"0.5503376",
"0.5500851",
"0.549239... | 0.64223576 | 4 |
Access the payload for the given secret version if one exists. The version can be a version number as a string (e.g. "5") or an alias (e.g. "latest"). | def get_secret_helper(project_id, secret_id, version_id):
# Import the Secret Manager client library.
from google.cloud import secretmanager
# Create the Secret Manager client.
client = secretmanager.SecretManagerServiceClient()
# Build the resource name of the secret version.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_secret(self, secret_name):\n secret = self._sm.access_secret_version(name=secret_name).payload.data.decode()\n try:\n return json.loads(secret)\n except json.decoder.JSONDecodeError:\n return secret",
"def get_secret(project_name, secret_name):\n secrets = se... | [
"0.63094276",
"0.6274578",
"0.6270718",
"0.6193602",
"0.56105834",
"0.5583762",
"0.55630684",
"0.5561021",
"0.5520679",
"0.5483769",
"0.5396443",
"0.534971",
"0.5316362",
"0.5282288",
"0.5263947",
"0.5258178",
"0.52554196",
"0.5250224",
"0.5231873",
"0.5227829",
"0.5219023",
... | 0.6357859 | 0 |
Test storing a valid JSON string. | def test_json(self):
row = MyTable(json='{"a": 1}')
row.save().run_sync()
self.assertEqual(row.json, '{"a": 1}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __valid_json(string):\n try:\n obj = json.loads(string)\n except ValueError:\n return False\n else:\n return json.dumps(obj)",
"def is_valid_json(json_str):\n assert json_str is not None\n try:\n json.loads(json_str)\n return True\n ... | [
"0.7943649",
"0.77111244",
"0.7695778",
"0.72987425",
"0.7277626",
"0.72176313",
"0.7030708",
"0.70094115",
"0.69357926",
"0.6913545",
"0.6905427",
"0.6884406",
"0.6819952",
"0.6791781",
"0.6778224",
"0.67595744",
"0.67379457",
"0.67365855",
"0.67244923",
"0.6677644",
"0.6605... | 0.6748456 | 16 |
Returns the current time as an UTC timezone string in iso format (with trailing 'Z') | def format_iso_now():
return datetime.datetime.utcnow().isoformat()+'Z' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currentUTC():\n return str(datetime.utcnow())",
"def isoformat_now():\n return datetime_isoformat(datetime.datetime.utcnow())",
"def getFormattedUtcTime():\n # Formatting must conform to RFC 822 (Section 5.1). Notably, UTC is\n # abbreviated UT, because the world has not suffered enough.\n tim... | [
"0.78458035",
"0.74335283",
"0.72816396",
"0.70603913",
"0.6990912",
"0.69757944",
"0.69757944",
"0.696769",
"0.6935007",
"0.69247305",
"0.69173247",
"0.691655",
"0.68905354",
"0.6852796",
"0.68326014",
"0.6829544",
"0.6827495",
"0.68087584",
"0.68012005",
"0.6800934",
"0.678... | 0.7894089 | 0 |
Creates an UTC timezone string in iso format from the given datetime (with trailing 'Z'). If no tzinfo is set on the passed datetime, the default_tzinfo is applied. | def format_iso(dt, default_tzinfo=local_timezone):
dt = dt if dt.tzinfo else dt.replace(tzinfo=default_tzinfo)
return dt.astimezone(utc_timezone).replace(tzinfo=None).isoformat()+'Z' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_to_isoformat(obj: datetime.datetime) -> str:\n return obj.replace(tzinfo=datetime.timezone.utc).isoformat().replace(\"+00:00\", \"Z\")",
"def to_iso_datetime(value: Union[datetime.datetime, datetime.time]) -> str:\n retval = value.isoformat()\n if value.tzinfo is None:\n retval += 'Z... | [
"0.72830695",
"0.7118903",
"0.708428",
"0.6896359",
"0.688354",
"0.66974074",
"0.6521178",
"0.64779645",
"0.64537346",
"0.644223",
"0.63944566",
"0.63390785",
"0.6286646",
"0.6246395",
"0.6179641",
"0.61746985",
"0.61450917",
"0.6143905",
"0.61295635",
"0.61095655",
"0.610956... | 0.7920684 | 0 |
The set of arguments for constructing a IotHubDps resource. | def __init__(__self__, *,
resource_group_name: pulumi.Input[str],
sku: pulumi.Input['IotHubDpsSkuArgs'],
allocation_policy: Optional[pulumi.Input[str]] = None,
data_residency_enabled: Optional[pulumi.Input[bool]] = None,
ip_filter_rule... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: IotHubDpsArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n ... | [
"0.7770508",
"0.66532487",
"0.66088575",
"0.5999855",
"0.59811705",
"0.5978807",
"0.594224",
"0.5894183",
"0.5845932",
"0.5828724",
"0.5817049",
"0.5813124",
"0.5811419",
"0.5806049",
"0.580264",
"0.5784328",
"0.57799804",
"0.577179",
"0.5752405",
"0.57505554",
"0.5744445",
... | 0.685542 | 1 |
The name of the resource group under which the Iot Device Provisioning Service resource has to be created. Changing this forces a new resource to be created. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")",
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group\")",
"def resource_grou... | [
"0.7285079",
"0.7229759",
"0.693448",
"0.693448",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.6861676",
"0.68414575",
"0.6797049",
"0... | 0.6888279 | 10 |
Whether requests from Public Network are allowed. Defaults to `true`. | def public_network_access_enabled(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "public_network_access_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_network_access_enabled(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"public_network_access_enabled\")",
"def public_network_access_enabled(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"public_network_access_enabled\")",
"def public_network_access_enabl... | [
"0.7550095",
"0.7476074",
"0.7476074",
"0.7209365",
"0.7209365",
"0.71541643",
"0.7112414",
"0.7030812",
"0.6955111",
"0.6910664",
"0.6836367",
"0.66963995",
"0.66610897",
"0.66610897",
"0.6660992",
"0.6657969",
"0.6657969",
"0.6644918",
"0.65698844",
"0.6568881",
"0.6568881"... | 0.77242553 | 0 |
Whether requests from Public Network are allowed. Defaults to `true`. | def public_network_access_enabled(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "public_network_access_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_network_access_enabled(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"public_network_access_enabled\")",
"def public_network_access_enabled(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"public_network_access_enabled\")",
"def public_network_access_enabl... | [
"0.75507784",
"0.7476585",
"0.7476585",
"0.7209471",
"0.7209471",
"0.7154478",
"0.7111491",
"0.70298076",
"0.69540256",
"0.6910171",
"0.6837828",
"0.669702",
"0.66608286",
"0.6660621",
"0.6660621",
"0.6657771",
"0.6657771",
"0.6645724",
"0.65701956",
"0.6568596",
"0.6568596",... | 0.7724457 | 1 |
The name of the resource group under which the Iot Device Provisioning Service resource has to be created. Changing this forces a new resource to be created. | def resource_group_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")",
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group\")",
"def resource_grou... | [
"0.7285079",
"0.7229759",
"0.693448",
"0.693448",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.... | 0.6861676 | 52 |
Get an existing IotHubDps resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
allocation_policy: Optional[pulumi.Input[str]] = None,
data_residency_enabled: Optional[pulumi.Input[bool]] = None,
device_provisioning_host_name: Optional[pulumi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_by_id(state_id):\n for key, value in storage.all(\"State\").items():\n if state_id == value.id:\n return jsonify(value.to_dict())\n abort(404)",
"def get_state_by_id(state_id):\n my_state = storage.get('State', state_id)\n if my_state is None:\n abort(404)\n ... | [
"0.6165079",
"0.6119023",
"0.605706",
"0.60102445",
"0.6009447",
"0.595279",
"0.58617085",
"0.57601506",
"0.5713622",
"0.569948",
"0.56957686",
"0.5687478",
"0.5666192",
"0.5653056",
"0.5648674",
"0.56353307",
"0.5512492",
"0.54826444",
"0.54493546",
"0.53476965",
"0.53397685... | 0.6778678 | 0 |
Whether requests from Public Network are allowed. Defaults to `true`. | def public_network_access_enabled(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "public_network_access_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_network_access_enabled(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"public_network_access_enabled\")",
"def public_network_access_enabled(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"public_network_access_enabled\")",
"def public_network_acce... | [
"0.7724457",
"0.7724457",
"0.7724457",
"0.7724457",
"0.7724457",
"0.7724457",
"0.75507784",
"0.7209471",
"0.7209471",
"0.7154478",
"0.7111491",
"0.70298076",
"0.69540256",
"0.6910171",
"0.6837828",
"0.669702",
"0.66608286",
"0.6660621",
"0.6660621",
"0.6657771",
"0.6657771",
... | 0.7476585 | 7 |
The name of the resource group under which the Iot Device Provisioning Service resource has to be created. Changing this forces a new resource to be created. | def resource_group_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")",
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group\")",
"def resource_grou... | [
"0.7285079",
"0.7229759",
"0.693448",
"0.693448",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.6888279",
"0.... | 0.6797049 | 63 |
Whether or not this network contains a certain container | def contains(self, container: Container) -> bool:
self.network.reload()
return container in self.network.containers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_container(soln_stk, container_config):\n\n return (is_preconfigured(soln_stk, container_config) or\n is_generic(soln_stk, container_config))",
"def in_host():\n return not in_docker()",
"def is_container_type_correct(self, container):\r\n return container in self.containers",
"... | [
"0.7087417",
"0.6973532",
"0.68933135",
"0.6888325",
"0.6859427",
"0.6685091",
"0.6678438",
"0.66130465",
"0.6549839",
"0.6535034",
"0.6497628",
"0.64688534",
"0.64451474",
"0.64195615",
"0.6364653",
"0.6308015",
"0.6274275",
"0.62504834",
"0.624734",
"0.62259156",
"0.6056343... | 0.79573774 | 0 |
Sum of the squares of the residuals | def Cost(self, parameterValues=None):
if parameterValues is None:
parameterValues = self.theory.initialParameterValues
residuals = self.Residual(parameterValues)
return sum(residuals*residuals) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residuals(self) -> npt.NDArray[np.float64]:\n return self.data - self.theory",
"def ssr(self):\n return (self.resid * self.resid).sum(0)",
"def _residuals(params: List[float], xs: np.ndarray, ys: np.ndarray) -> float:\n return _model(params=params, xs=xs) - ys",
"def sumsquares(self):\n ... | [
"0.7296851",
"0.7142954",
"0.7109757",
"0.7095617",
"0.7091772",
"0.6917617",
"0.686539",
"0.68224746",
"0.6723187",
"0.6718949",
"0.6696491",
"0.6657945",
"0.66558444",
"0.6639677",
"0.6577877",
"0.65231377",
"0.6517451",
"0.64623976",
"0.641849",
"0.63852507",
"0.6377742",
... | 0.0 | -1 |
return the proper axis limits for the plots | def getAxis(self,X,Y):
out = []
mM = [(min(X),max(X)),(min(Y),max(Y))]
for i,j in mM:
#YJC: checking if values are negative, if yes, return 0 and break
if j <0 or i <0:
return 0
log_i = numpy.log10(i)
d, I = numpy.modf(log_i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xlim(self):\r\n lim = [ax.get_xlim() for ax in self._subaxes]\r\n if lim == []:\r\n lim = None\r\n return lim",
"def _set_axes_limits(ax, parameter, axis=\"x\"):\n\n lims = list(ax.get_xlim()) if axis == \"x\" else list(ax.get_ylim())\n\n if \"low\" in DEFAULT_BOUNDS[par... | [
"0.72861344",
"0.7190782",
"0.70524853",
"0.70471454",
"0.70232326",
"0.7014826",
"0.6952369",
"0.6951863",
"0.69159484",
"0.6883299",
"0.68778056",
"0.6871347",
"0.68587196",
"0.6846591",
"0.68326175",
"0.6794377",
"0.6792432",
"0.6756337",
"0.6658954",
"0.66493905",
"0.6643... | 0.0 | -1 |
Add Frames to the gui. | def build_frames(dialbox):
#Buttons Frame
dialbox.button_frame = tk.Frame(dialbox.master_frame)
dialbox.button_frame.grid(row=3, column=1)
#Output Frame
dialbox.output_frame = tk.Frame(dialbox.master_frame)
dialbox.output_frame.grid(row=4, column=0, columnspan=2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createFrame(self):\n \n tkinterListBoxDialog.createFrame(self)\n self.addFrameButtons()",
"def showFrame(self, position):\n display = self.data.frames[position]\n self.activeFrames.append(display)\n display.tkraise()\n display.showMe()",
"def addFrameButtons... | [
"0.69437134",
"0.6672349",
"0.6539839",
"0.6534285",
"0.64954734",
"0.6413674",
"0.640446",
"0.6395129",
"0.63718796",
"0.6365107",
"0.63595796",
"0.632344",
"0.6319646",
"0.6313643",
"0.62930137",
"0.6280731",
"0.6272597",
"0.6252438",
"0.6192494",
"0.6192333",
"0.6180953",
... | 0.5994375 | 33 |
open URL in browser | def browser_open(url):
FNULL = open(os.devnull, 'w')
subprocess.Popen([udata.browser, url], stdout=FNULL, stderr=subprocess.STDOUT ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(url):\r\n webbrowser.open(url)",
"def openurl(url):\n\n # Open the URL\n webbrowser.open(url)",
"def open_browser(url):\n import webbrowser\n webbrowser.open_new(url)",
"def open_in_browser(self):\n webbrowser.open(self.url)",
"def run(self, url=''):\n if url:\n ... | [
"0.8825894",
"0.86238056",
"0.8364594",
"0.8359006",
"0.8157767",
"0.8069642",
"0.80631995",
"0.80197996",
"0.7988344",
"0.79575837",
"0.79136777",
"0.7862893",
"0.7670471",
"0.76193434",
"0.7603658",
"0.75009316",
"0.7484363",
"0.74710053",
"0.7459281",
"0.7375782",
"0.73570... | 0.75229174 | 15 |
return datacenter ID or None if missing | def get_data_center_id(xval):
try:
xout = xval.find('option', {'selected': "selected"})['value']
except:
xout = None
return xout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_center_id(self) -> str:\n return pulumi.get(self, \"data_center_id\")",
"def data_center_id(self) -> str:\n return pulumi.get(self, \"data_center_id\")",
"def get_datacenter_id():\n datacenter_id = config.get_cloud_config_value(\n \"datacenter_id\", get_configured_provider(), _... | [
"0.77596855",
"0.77596855",
"0.76803714",
"0.7425855",
"0.7162967",
"0.7140772",
"0.69317913",
"0.6901721",
"0.6901721",
"0.68508667",
"0.68508667",
"0.68508667",
"0.6808368",
"0.67262566",
"0.65895724",
"0.64517957",
"0.62815994",
"0.6255964",
"0.6208996",
"0.6193071",
"0.61... | 0.669231 | 14 |
Extract the groundtruth images into a 4D tensor [image index, y, x, channels]. Indices are from 0. | def load_groundtruths(folder_path, num_images):
imgs = []
for i in range(1, num_images + 1):
image_name = "satImage_%.3d" % i
image_path = folder_path + image_name + ".png"
if os.path.isfile(image_path):
print('Loading ' + image_path)
img = mpimg.imread(image_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract(self, images):\n if (images.ndim != 4 or images.shape[0] <= 0 or\n images.shape[0] > self.batch_size or images.shape[1] not in [1, 3]):\n raise ValueError(f'Input images should be with shape [batch_size, '\n f'channel, height, width], where '\n ... | [
"0.6137873",
"0.58402616",
"0.58069813",
"0.5750207",
"0.5662866",
"0.5645604",
"0.5627992",
"0.56128585",
"0.5557248",
"0.5501648",
"0.54195696",
"0.5410649",
"0.5410485",
"0.5403684",
"0.540158",
"0.53859305",
"0.53854",
"0.53846025",
"0.5382646",
"0.5375407",
"0.53716165",... | 0.6177738 | 0 |
Calculates the great circle distance between two points on the earth (specified in decimal degrees) | def calc_distance(first_coordinates, second_coordinates):
lon1, lat1 = first_coordinates
lon2, lat2 = second_coordinates
# Convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# Haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.8162456",
"0.7894535",
"0.764995",
"0.7596316",
"0.7552551",
"0.75442225",
"0.75416684",
"0.7535846",
"0.7520827",
"0.75202227",
"0.7505795",
"0.7502994",
"0.74658895",
"0.74413633",
"0.7397058",
"0.7381034",
"0.7378412",
"0.73382896",
"0.7326121",
"0.7304055",
"0.72902143... | 0.0 | -1 |
Color map to use. Either a name or `matplotlib.colors.ColorMap` instance, e.g. from `matplotlib.pyplot.cm` | def cmap(self):
return self.pixels.get_cmap() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)",
"def setColourMap(self):\n cmap = self.config['cmap']\n\n pos, colour, mode = colourMaps.colourMaps(cmap)\n\n cmap = pg.ColorMap(pos, colour,mode)\n self.lut = cmap.getLookupTable(0.0, 1.0, 256)\n ... | [
"0.68531597",
"0.67137104",
"0.66902226",
"0.6676044",
"0.6634296",
"0.65859383",
"0.65859383",
"0.6578055",
"0.65590984",
"0.65329206",
"0.65329206",
"0.65329206",
"0.65286666",
"0.6419178",
"0.63901293",
"0.6324143",
"0.6324143",
"0.6305097",
"0.6299348",
"0.62876976",
"0.6... | 0.60231847 | 33 |
plot an ellipse on top of the camera | def add_ellipse(self, centroid, length, width, angle, asymmetry=0.0,
**kwargs):
ellipse = Ellipse(xy=centroid, width=length, height=width,
angle=np.degrees(angle), fill=False, **kwargs)
self.axes.add_patch(ellipse)
self.update()
return ellips... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ellipse(self):\n f = self.img\n x = self.x\n y = self.y\n x2 = self.x2\n y2 = self.y2\n xy = self.xy\n self.a2 = (x2+y2) + sqrt(((x2-y2)/2.)**2 + xy**2)\n self.b2 = (x2+y2) - sqrt(((x2-y2)/2.)**2 + xy**2)\n self.a = sqrt(self.a2)\n self.b = sqrt(self.... | [
"0.71465373",
"0.691427",
"0.6874823",
"0.6636775",
"0.6527834",
"0.645086",
"0.639627",
"0.6373799",
"0.63484204",
"0.6334047",
"0.63184047",
"0.6290501",
"0.62802905",
"0.62116295",
"0.6197461",
"0.6181474",
"0.61737555",
"0.6151816",
"0.6148536",
"0.61112154",
"0.61059135"... | 0.0 | -1 |
Return pyplot color for health percentage. | def happy_color(health):
if health > 0.8:
return 'g'
if health > 0.6:
return 'y'
return 'r' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percentageColor(self):\n tup = None\n if self.percent >= 0.7:\n tup = Livebar.colors['green']\n elif self.percent >= 0.3 and self.percent < 0.7:\n tup = Livebar.colors['orange']\n elif self.percent >= 0.0 and self.percent < 0.3:\n tup = Livebar.color... | [
"0.69089454",
"0.6136979",
"0.60860336",
"0.60249513",
"0.5911529",
"0.5779411",
"0.57008535",
"0.5653263",
"0.56022775",
"0.5582564",
"0.55758715",
"0.5572091",
"0.5560455",
"0.5530867",
"0.547663",
"0.54741037",
"0.5457799",
"0.5433294",
"0.5406914",
"0.53549343",
"0.533464... | 0.6907079 | 1 |
Return XdYhZm string representing timedelta. | def format_timedelta(delta):
return '%dd%dh%dm' % (
delta.days, delta.seconds / 3600, (delta.seconds % 3600) / 60) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_timedelta(timedeltaobj):\n # stolen from https://stackoverflow.com/a/46928226/8207\n if not timedeltaobj:\n return '---'\n secs = timedeltaobj.total_seconds()\n timetot = \"\"\n if secs > 86400: # 60sec * 60min * 24hrs\n days = secs // 86400\n timetot += \"{} days\... | [
"0.71851104",
"0.7016609",
"0.6898836",
"0.6843371",
"0.66149753",
"0.65766495",
"0.6427701",
"0.6427309",
"0.64256513",
"0.6294578",
"0.6270939",
"0.6246627",
"0.61540174",
"0.6139394",
"0.6139213",
"0.61354744",
"0.6102212",
"0.6033346",
"0.59888315",
"0.59756345",
"0.59644... | 0.663824 | 4 |
No matter where the code is ran, return UTC3 day (Brasilia local day, no daylight savings) | def brasilia_day():
return (dt.datetime.utcnow() + dt.timedelta(hours=-3)).replace(hour=0, minute=0, second=0, microsecond=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tz():\n return 'UTC'",
"def static_now():\n return datetime.datetime(2000, 9, 4).replace(tzinfo=timezone.utc)",
"def nowUTC():\n return datetime.datetime.now(pytz.utc)",
"def timezone():\n \n pass",
"def _local_time_offset():\n if time.localtime().tm_isdst and time.daylight:\n ... | [
"0.6973885",
"0.66084325",
"0.6403961",
"0.6391524",
"0.6269962",
"0.6254525",
"0.6172193",
"0.6065501",
"0.6063077",
"0.6034506",
"0.60136145",
"0.5955827",
"0.59487927",
"0.59421045",
"0.59272534",
"0.58564836",
"0.5842592",
"0.5821821",
"0.58141065",
"0.58141065",
"0.58005... | 0.74113536 | 0 |
Load lines in the file `filename` as entries in a list and return list. Return empty list if file is not found. | def load_captured_urls_local(filename):
if os.path.isfile(filename) == False:
return []
with open(filename, 'r') as f:
return f.read().splitlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadListFromFile (filename):\n retval = []\n filename = os.path.expanduser (filename)\n if not os.path.exists (filename):\n print(\"Error: file '%s' does not exist.\"%(filename))\n raise RuntimeError(\"Bad filename\")\n source = open (filename, 'r') \n for line in source.rea... | [
"0.8135879",
"0.8098084",
"0.79723775",
"0.79647434",
"0.7842038",
"0.76687443",
"0.76380503",
"0.7575669",
"0.75242686",
"0.7466268",
"0.7426713",
"0.74169564",
"0.7383055",
"0.73578894",
"0.7342963",
"0.7284128",
"0.72714794",
"0.7252686",
"0.72329175",
"0.71779776",
"0.717... | 0.65877014 | 61 |
Evaluate the initial fitness Returns None | def __calculated_initial_fitness(self) -> None:
logger.info('Start calculating initial fitness')
__calculated_values = (self._commands_holder_train.execute_commands(
self.__initial_parameters))
self.__initial_fitness = (self._evaluate_fitness(
__calculated_values, self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fitness(self):\n pass",
"def fitness(self):\n # TO BE DECIDED\n return 1",
"def _calculate_fitness(self):\n pass",
"def evaluate_fitness(self):\r\n fitness = 0.0\r\n # TO-DO: Write your fitness evaluation code here:\r\n \r\n if self.graph is not Non... | [
"0.7828585",
"0.7696335",
"0.755906",
"0.7473544",
"0.7442673",
"0.734072",
"0.73263747",
"0.72394234",
"0.72042984",
"0.6996483",
"0.6922581",
"0.69106424",
"0.68968165",
"0.6783266",
"0.6738791",
"0.6735356",
"0.67337304",
"0.6678853",
"0.6667005",
"0.66447455",
"0.66389966... | 0.7515529 | 3 |
Returns a sequence of (value, prob) pairs. | def items(self):
return self.d.items() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probs(self) -> List:\n return self._probs",
"def _get_tuple_of_probabilities(self):\n\t\tk_array = np.arange(-self.n,self.n+1,2)\n\t\tprobability_array = []\n\t\t\n\t\tfor k in k_array:\n\t\t\tprobability_array.append(self._calculate_probability(k))\n\t\t\t\n\t\treturn (k_array,probability_array)",
... | [
"0.6924901",
"0.6726432",
"0.6646182",
"0.66067505",
"0.6604082",
"0.6501287",
"0.6201403",
"0.61919004",
"0.6150804",
"0.6147174",
"0.6124989",
"0.61150867",
"0.60988814",
"0.6086047",
"0.6083723",
"0.60737157",
"0.5969314",
"0.5952965",
"0.5908674",
"0.5899685",
"0.5892481"... | 0.0 | -1 |
Returns a string representation of the object. | def __repr__(self):
cls = self.__class__.__name__
return '%s(%s)' % (cls, repr(self.d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.obj)",
"def to_string(self):\r\n return self.__str__()",
"def __str__(self):\n return str(self.serialize())",
"def as_string(self):\n return self.__repr__()",
"def __s... | [
"0.8254471",
"0.82044023",
"0.81860805",
"0.80676097",
"0.8065568",
"0.79726636",
"0.7972232",
"0.7972232",
"0.7971929",
"0.7963888",
"0.7963888",
"0.7963888",
"0.7963888",
"0.7963888",
"0.79516304",
"0.789338",
"0.7883678",
"0.7883678",
"0.7883678",
"0.7883678",
"0.7883678",... | 0.0 | -1 |
Computes the CDF of the maximum of k samples from the distribution. | def maximum(self, k):
return Cdf(self.xs, self.ps**k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_kde_max(kde, df, w):\n kde.fit(df, w)\n kde_vals = [kde.pdf(p) for _, p in df.iterrows()]\n ix = kde_vals.index(max(kde_vals))\n kde_max_pnt = df.iloc[ix]\n return kde_max_pnt",
"def cdf(self, k):\n\n if k < 0 or k > self.n:\n return 0\n\n k = int(k)\n a... | [
"0.6886865",
"0.6787481",
"0.6523415",
"0.623066",
"0.603453",
"0.60037917",
"0.59823704",
"0.58218867",
"0.5772032",
"0.5728307",
"0.57278633",
"0.57235473",
"0.56683123",
"0.56644183",
"0.55940765",
"0.55897975",
"0.55681825",
"0.5561161",
"0.5545184",
"0.55428267",
"0.5517... | 0.76589584 | 0 |
Plots the real and imaginary parts of the CF. | def plot_cf(self, **options):
n = len(self.hs)
xs = np.arange(-n//2, n//2)
hs = np.roll(self.hs, len(self.hs) // 2)
plt.plot(xs, hs.real, label='real', **options)
plt.plot(xs, hs.imag, label='imag', **options)
plt.legend() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __display(self, x, Z, title):\n\n minVal = np.min([x,Z])\n maxVal = np.max([x,Z])\n \n scale = x.shape[0]\n fov_muas = self.fov * 1e6 * 3600 * 180 / np.pi\n ticks = np.linspace(0, scale-1, 7)\n ticklabels = np.linspace(fov_muas/2, -fov_muas/2, 7, dtype=int)\n ... | [
"0.67464983",
"0.6664312",
"0.6628779",
"0.6608349",
"0.653134",
"0.6478477",
"0.6456006",
"0.64080554",
"0.63903296",
"0.63706744",
"0.6367956",
"0.63266176",
"0.6317219",
"0.630155",
"0.62951183",
"0.62889874",
"0.62801856",
"0.6278292",
"0.62729335",
"0.62700176",
"0.62650... | 0.7943478 | 0 |
Get the status of the clinical trial. | def _get_status(trial: dict) -> int:
if trial['overall_status'] in {'Not yet recruiting', 'Active, not recruiting'}:
return 0
elif trial['overall_status'] in {'Enrolling by invitation', 'Recruiting', 'Available'}:
return 1
elif trial['overall_status'] in {'Approved for ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> str:\n trial_status = {0: \"SURVIVED\", 1: \"DETECTED\", 2: \"ERROR\", 3: \"TIMEOUT\"}\n return trial_status.get(self.return_code, \"UNKNOWN\")",
"def GetStatus(self):\r\n return self.status",
"def status(self) -> str:\n return pulumi.get(self, \"status\")",
"def s... | [
"0.6998657",
"0.6796575",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"0.6679569",
"... | 0.67456484 | 2 |
Sequentially pass `x` trough model`s encoder, decoder and heads | def forward(self, x):
features = self.encoder(x)
decoder_output = self.drop(self.decoder(*features))
masks = self.segmentation_head(decoder_output)
return masks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.Encoder(x)\n x = self.Decoder(x)\n return x",
"def forward(self, x):\n x = self.encoder(x)\n x = self.decoder(x)\n return x",
"def forward(self, x):\n if self.training:\n x = self.input_pert(x)\n x = self.encode... | [
"0.729405",
"0.7133267",
"0.7124076",
"0.71235037",
"0.71009254",
"0.70629364",
"0.67873377",
"0.67865795",
"0.6724284",
"0.67054564",
"0.6634503",
"0.6622676",
"0.6578995",
"0.6578333",
"0.6578333",
"0.6514306",
"0.6476574",
"0.6278726",
"0.6268307",
"0.6234131",
"0.6192726"... | 0.0 | -1 |
Creates two generic applications in the database. Later tests specify that one is an inhouse application while the other is an external one. | def test_db_can_add_applications():
creation_date_inhouse = datetime.now()
time.sleep(1)
creation_date_external = datetime.now()
inhouse_application = Application(date=creation_date_inhouse, user_id=user_id, is_inhouse_posting=True,
status=status, resume=resume)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_06_applications_2(self):\r\n with self.flask_app.app_context():\r\n self.create()\r\n\r\n res = self.app.get('/app', follow_redirects=True)\r\n assert self.html_title(\"Applications\") in res.data, res.data\r\n assert \"Applications\" in res.data, res.dat... | [
"0.67921156",
"0.65897864",
"0.656437",
"0.65025413",
"0.64722425",
"0.63526195",
"0.6338863",
"0.6311145",
"0.628777",
"0.6268123",
"0.622694",
"0.62146854",
"0.6209861",
"0.617739",
"0.616238",
"0.6099809",
"0.609628",
"0.60911614",
"0.60761017",
"0.6074249",
"0.606339",
... | 0.6911395 | 0 |
Ensures that it is possible to add an inhouse application. This relies on a previous test creating the generic `Application` associated to the inhouse application | def test_db_can_add_inhouse_application():
job_application = Application.query.filter_by(user_id=user_id, status=status, is_inhouse_posting=True,
resume=resume).first()
job_id = 0
inhouse_application = Inhouse(application_id=job_application.id, job_id=job_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_db_can_add_applications():\n creation_date_inhouse = datetime.now()\n time.sleep(1)\n creation_date_external = datetime.now()\n\n inhouse_application = Application(date=creation_date_inhouse, user_id=user_id, is_inhouse_posting=True,\n status=status, resume... | [
"0.72500795",
"0.70144737",
"0.68759906",
"0.6810188",
"0.6686781",
"0.65941554",
"0.6589904",
"0.6584751",
"0.65809244",
"0.65160275",
"0.6515545",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654",
"0.6490654... | 0.7676453 | 0 |
transform a date string to datetime.date object | def convert_date(date):
if isinstance(date, datetime.date):
return date
elif isinstance(date, str):
match = DATE_PATTERN.match(date)
if match:
groups = match.groups()
if len(groups) == 3:
return datetime.date(
year=int(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _str_to_date(self, date):\n return datetools.date_parser(date)",
"def string_to_date(string):\n params = string.strip().split('-')\n year = int(params[0])\n month = int(params[1])\n day = int(params[2])\n d = date(year, month, day)\n return d",
"def convert_... | [
"0.83406043",
"0.8158031",
"0.8105199",
"0.8046798",
"0.79481274",
"0.7945066",
"0.78537035",
"0.785193",
"0.7845595",
"0.78159887",
"0.77934813",
"0.77927506",
"0.77919906",
"0.7782821",
"0.7761485",
"0.77426094",
"0.7708801",
"0.7679941",
"0.7671195",
"0.76671195",
"0.76409... | 0.74849874 | 29 |
Get the panel status code. | def getPanelStatusCode(self) -> int:
if self.visprotocol is not None:
return self.visprotocol.getPanelStatusCode()
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPanelStatus(self) -> dict:\r\n if self.visprotocol is not None:\r\n return self.visprotocol.getPanelStatus()\r\n return {}",
"def status_code(self) -> int:\n return pulumi.get(self, \"status_code\")",
"def status_code(self):\n return int(self.status.split()[1])",
... | [
"0.73140895",
"0.6651922",
"0.6583329",
"0.65383226",
"0.652281",
"0.6510691",
"0.6498771",
"0.6478881",
"0.64772695",
"0.6417248",
"0.63671106",
"0.6327849",
"0.6296247",
"0.62948",
"0.6288293",
"0.6288293",
"0.6288293",
"0.6275781",
"0.6273042",
"0.6248622",
"0.624391",
"... | 0.8551673 | 0 |
Get the panel status. | def getPanelStatus(self) -> dict:
if self.visprotocol is not None:
return self.visprotocol.getPanelStatus()
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPanelStatusCode(self) -> int:\r\n if self.visprotocol is not None:\r\n return self.visprotocol.getPanelStatusCode()\r\n return -1",
"def getPanelMode(self) -> str:\r\n if self.visprotocol is not None:\r\n return self.visprotocol.getPanelMode()\r\n return \... | [
"0.7212485",
"0.7078568",
"0.6802434",
"0.6644544",
"0.66294634",
"0.658665",
"0.6584909",
"0.6584909",
"0.6584909",
"0.65660733",
"0.6477225",
"0.6468453",
"0.6457266",
"0.64273185",
"0.6424856",
"0.6419988",
"0.6408643",
"0.6398533",
"0.63661283",
"0.63577497",
"0.6342551",... | 0.8419339 | 0 |
Adds a velocity column to performance data by calculating the distance from previous point divided by time. | def create_velocity_column(self, perf):
perf["velocity"] = perf.index
perf["velocity"] = perf.moving * np.sqrt(np.power(perf.x.diff(), 2) + np.power(perf.y.diff(), 2)) / perf.velocity.diff()
perf["velocity"] = perf["velocity"].fillna(0)
return perf["velocity"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_velocity(self, last_pos, current_pos, dt):\n # type: (np.ndarray, np.ndarray, float) -> (float, float)\n diff = current_pos - last_pos\n raw_vel = np.sqrt(np.dot(diff, diff)) / dt\n if raw_vel > self._max_velocity:\n raw_vel = self._max_velocity - np.random.norma... | [
"0.61985725",
"0.61917526",
"0.60381746",
"0.5984917",
"0.59303194",
"0.5781554",
"0.574018",
"0.5719109",
"0.56818914",
"0.56731313",
"0.56731313",
"0.56123066",
"0.5579158",
"0.55229616",
"0.55069584",
"0.5475872",
"0.5472086",
"0.5472086",
"0.54716194",
"0.5456639",
"0.544... | 0.7642869 | 0 |
Build the API server URL for outgoing requests | def __http_build_url(self, url_path):
return '{}://{}{}'.format(_GOVEE_API_PROTOCOL, _GOVEE_API_HOST, url_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_url(self):\n url = BASE_URL.format(self._host, self._port)\n _LOGGER.debug(\"TOON fetch URL: %s\", url)\n return url",
"def build_api_url(project, method, base_url):\n return API_URL_TEMPLATE.format(\n api_base=base_url, api_version=API_VERSION, project=project, method=m... | [
"0.74572474",
"0.73565066",
"0.7324685",
"0.722164",
"0.71338344",
"0.7112944",
"0.71014935",
"0.709253",
"0.70649195",
"0.7062957",
"0.7054127",
"0.7054127",
"0.703904",
"0.7037313",
"0.693737",
"0.6937181",
"0.692866",
"0.6918728",
"0.6893845",
"0.68699414",
"0.6858663",
... | 0.72003466 | 4 |
Returns the standard node types supported by this nodenet | def get_standard_nodetype_definitions(self):
return copy.deepcopy(STANDARD_NODETYPES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_node_types(self):\n return list(nodelist.all_nodes.keys())",
"def ntypes(self) -> Sequence[str]:\n ntypes = list(self.num_nodes_dict.keys())\n return ntypes",
"def node_types(self) -> List[NodeType]:\n return list(self._node_store_dict.keys())",
"def get_node_type(self):\... | [
"0.7758494",
"0.75191504",
"0.71096796",
"0.6781017",
"0.6679072",
"0.66504973",
"0.66124004",
"0.6480269",
"0.64194703",
"0.63997465",
"0.6398334",
"0.63478005",
"0.628313",
"0.61457205",
"0.60647684",
"0.6046251",
"0.5994799",
"0.5958885",
"0.59414786",
"0.58999103",
"0.587... | 0.7398274 | 2 |
Insert a platform by it's ID number | def bb_platform(hit):
try:
plat_id = hit.group(1)
platform = SongPlatform.objects.get(id=plat_id)
T = loader.get_template('webview/t/platformname.html')
C = Context({ 'P' : platform })
return T.render(C)
except:
# Usually thrown if the ID is invalid or doesn't exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_platform(self, id):\n p = Platform(self, id, [])\n self.platforms[id] = p\n return p",
"def add_platform(self, platform: KetraPlatformBase):\n self.platforms.append(platform)",
"def add_to_platforms(\n self, data_store, platform_name, platform_type, nationality, priva... | [
"0.6888117",
"0.6508329",
"0.6424545",
"0.6064422",
"0.58550984",
"0.57021224",
"0.55254596",
"0.5443832",
"0.5443134",
"0.5441346",
"0.5400308",
"0.5351658",
"0.5345117",
"0.53224987",
"0.5307245",
"0.5288089",
"0.5286387",
"0.52734375",
"0.52609515",
"0.5257985",
"0.5254193... | 0.51819754 | 25 |
Create a clickable FAQ link. | def bb_faq(hit):
faqq = hit.group(1)
try:
F = Faq.objects.get(id=faqq)
T = loader.get_template('webview/t/faq_question.html')
Q = Context({'F' : F})
return T.render(Q)
except:
return '[faq]%s[/faq]' % (faqq) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faq():\n return render_template('faq.html',\n title='FAQ and stuff about Data and maps')",
"async def faq(self, ctx):\n embed = discord.Embed(title='FAQ',\n color=self.bot.color)\n entries = {'How do I add this bot to my server?':\n ... | [
"0.70957375",
"0.6550231",
"0.648699",
"0.648699",
"0.62515646",
"0.62371075",
"0.6176765",
"0.61591387",
"0.6082179",
"0.5943934",
"0.5908176",
"0.590433",
"0.5900777",
"0.5898457",
"0.5829432",
"0.5811807",
"0.5779972",
"0.5721135",
"0.5717848",
"0.57004845",
"0.5696701",
... | 0.59408885 | 10 |
move through the text and generates a list of tokens | def create_token_generator(self):
while self.current_char is not None:
# handle whitespaces
if self.current_char.isspace():
self.skip_whitespace()
continue
# handle integer and float numbers
if self.current_char.isdigit():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tokenize(self, text: str) -> List[str]:\n tokens = []\n for token in re.findall(self._pat, text):\n tokens.extend(bpe_token for bpe_token in self._bpe(token).split(\" \"))\n return tokens",
"def get_token_list(text):\n return text.split()",
"def _tokenize(self, text: str) ... | [
"0.78032565",
"0.77493936",
"0.76712894",
"0.76702106",
"0.76490206",
"0.764644",
"0.7616013",
"0.7598404",
"0.75949043",
"0.7554845",
"0.74326015",
"0.7429247",
"0.73936063",
"0.73736656",
"0.7358853",
"0.7345061",
"0.7304525",
"0.7302139",
"0.730068",
"0.727956",
"0.7270279... | 0.0 | -1 |
Find the parameter type for a scaling phil option. | def get_parameter_type(self, name):
phil_scope = phil.parse(
"""include scope dials.command_line.scale.phil_scope""",
process_includes=True,
)
obj = phil.find_scope(phil_scope, name)
if not obj:
raise ValueError(
"""Unable to resolve %s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parameter_type(self, name):\n raise NotImplementedError()",
"def get_parameter_type(self, topic):\n \n for attr in self.parm_list:\n if attr.topic == topic:\n return type(attr.value)\n\n self.logging.error(\"Can't find topic: \"+topic)\n return... | [
"0.5961406",
"0.5899907",
"0.5804044",
"0.5766119",
"0.57594454",
"0.57382417",
"0.57364875",
"0.56731325",
"0.5616817",
"0.5559121",
"0.55531114",
"0.5513451",
"0.55024374",
"0.5497287",
"0.54769194",
"0.5435729",
"0.54235375",
"0.5410222",
"0.5399347",
"0.53902406",
"0.5386... | 0.738002 | 0 |
Sets the name of this JobTaskSpec. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_name(self, task_name):\n\n self._task_name = task_name",
"def _setTaskName(self, taskName):\n self._taskName = taskName\n self._progressChangedNotifier.notify(self)",
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, name):\n self._name = na... | [
"0.72196764",
"0.69824946",
"0.68746483",
"0.68408704",
"0.68023306",
"0.68023306",
"0.68023306",
"0.68023306",
"0.68023306",
"0.6792163",
"0.6792163",
"0.6763448",
"0.67549056",
"0.6749797",
"0.67393243",
"0.67344475",
"0.6725848",
"0.6725848",
"0.6718127",
"0.67124504",
"0.... | 0.0 | -1 |
Sets the cmd of this JobTaskSpec. | def cmd(self, cmd):
self._cmd = cmd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setCmd_cmd(self, cmd):\n cmd_configs = self.__configs[self.__host]['commands']\n c = cmd_configs[cmd.getName()]\n cmd.setPath(c['path'])\n cmd.setEnvs(c['envs'])\n self.__cmd = cmd\n\n self.__task.set_input_data(data, socket)",
"def cmd(self, cmd):\n return ... | [
"0.72269565",
"0.6049095",
"0.58315235",
"0.5760332",
"0.54498214",
"0.5432573",
"0.54169106",
"0.54169106",
"0.53981984",
"0.5342966",
"0.52985597",
"0.52465886",
"0.52312297",
"0.5183205",
"0.5174096",
"0.51331156",
"0.5117802",
"0.5003176",
"0.4985685",
"0.49634808",
"0.49... | 0.67421544 | 1 |
Sets the cpu of this JobTaskSpec. | def cpu(self, cpu):
self._cpu = cpu | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_cpu_num(self, cpu_num=None):\n if cpu_num is not None:\n assert isinstance(cpu_num, int), \"cpu_num should be INT type, please check the input type.\"\n self.cpu_num = cpu_num\n else:\n self.cpu_num = mp.cpu_count()",
"def cpu(self):\n for key, value... | [
"0.72601855",
"0.6513164",
"0.6254777",
"0.6227754",
"0.62236637",
"0.61536276",
"0.6111379",
"0.6107653",
"0.6107653",
"0.6107653",
"0.6097903",
"0.59982336",
"0.59982336",
"0.5975729",
"0.5969647",
"0.593238",
"0.5894185",
"0.58575535",
"0.5839823",
"0.5839823",
"0.5811622"... | 0.759156 | 0 |
Sets the gpu of this JobTaskSpec. | def gpu(self, gpu):
self._gpu = gpu | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_gpu(gpu):\r\n os.environ['CUDA_VISIBLE_DEVICES'] = gpu\r\n tf_config = tf.ConfigProto()\r\n tf_config.gpu_options.allow_growth = True\r\n return tf_config",
"def set_gpu(gpus):\n os.environ[\"CUDA_DEVICE_ORDER\"] = \"PCI_BUS_ID\"\n os.environ[\"CUDA_VISIBLE_DEVICES\"] = gpus",
"def Se... | [
"0.7158826",
"0.706917",
"0.68598706",
"0.65956587",
"0.6466077",
"0.63325775",
"0.63170284",
"0.6294803",
"0.6289551",
"0.6282891",
"0.6261467",
"0.6246258",
"0.62292624",
"0.60470176",
"0.60196215",
"0.600933",
"0.594731",
"0.5850597",
"0.57953244",
"0.57953244",
"0.5791707... | 0.7901611 | 0 |
Sets the memory of this JobTaskSpec. | def memory(self, memory):
self._memory = memory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_mem_per_proc(self, mem_mb):\n QueueAdapter.set_mem_per_proc(self, mem_mb)\n #self.qparams[\"mem\"] = self.mem_per_proc",
"def set_mem_per_proc(self, mem_mb):\n super(SGEAdapter, self).set_mem_per_proc(mem_mb)\n self.qparams[\"mem_per_slot\"] = str(int(self.mem_per_proc)) + \"M... | [
"0.64869696",
"0.63794994",
"0.6366115",
"0.6284919",
"0.62328476",
"0.62110347",
"0.60514355",
"0.6013673",
"0.58694434",
"0.58066565",
"0.57926446",
"0.57184875",
"0.5697876",
"0.5687665",
"0.56591576",
"0.56314886",
"0.5588255",
"0.5579791",
"0.55231935",
"0.55113333",
"0.... | 0.67257684 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, JobTaskSpec):
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 |
Validates if is string is a wellformed fullyqualified collection reference (does not look up the collection itself) | def is_valid_fqcr(ref, ref_type=None):
ref = to_text(ref)
if not ref_type:
return bool(re.match(AnsibleCollectionRef.VALID_FQCR_RE, ref))
return bool(AnsibleCollectionRef.try_parse_fqcr(ref, ref_type)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_collection(var):\n return isinstance(var, Iterable) and not isinstance(var, str)",
"def validate_collection_name(name): # type: (str) -> str\n collection, dummy, dummy = name.partition(':')\n if AnsibleCollectionRef.is_valid_collection_name(collection):\n return name\n\n raise AnsibleE... | [
"0.6393001",
"0.63342494",
"0.5867176",
"0.5829022",
"0.5749291",
"0.5692264",
"0.5523747",
"0.54895395",
"0.54232603",
"0.5389003",
"0.5344267",
"0.5273456",
"0.52504927",
"0.5152838",
"0.51023304",
"0.5093318",
"0.5082478",
"0.5067801",
"0.50538903",
"0.5050145",
"0.501299"... | 0.48244634 | 40 |
Return the containing collection name for a given path, or None if the path is not below a configured collection, or the collection cannot be loaded (eg, the collection is masked by another of the same name higher in the configured collection roots). | def _get_collection_name_from_path(path):
# FIXME: mess with realpath canonicalization or not?
path = to_native(path)
path_parts = path.split('/')
if path_parts.count('ansible_collections') != 1:
return None
ac_pos = path_parts.index('ansible_collections')
# make sure it's followed b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_collection_path(collection_path): # type: (str) -> str\n\n if os.path.split(collection_path)[1] != 'ansible_collections':\n return os.path.join(collection_path, 'ansible_collections')\n\n return collection_path",
"def collection(self, collection):\r\n\t\tself.fetch_collections()\r\n\t\... | [
"0.66476554",
"0.6422875",
"0.6144496",
"0.6101164",
"0.60784584",
"0.60313034",
"0.59379494",
"0.5915301",
"0.5882834",
"0.5875172",
"0.5847677",
"0.57619137",
"0.5753628",
"0.5648237",
"0.56448627",
"0.5626813",
"0.5532405",
"0.55150425",
"0.54999846",
"0.5487898",
"0.54545... | 0.83691174 | 0 |
load_from_json_file creates an Object from a "JSON file Args filename(str) filename to read from Return None | def load_from_json_file(filename):
if type(filename) is not str:
return
with open(filename, mode="r") as file:
return json.loads(file.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_json_file(filename):\n with open(filename, 'r') as f:\n obj = json.loads(f.read())\n return obj",
"def load_from_json_file(filename):\n with open(filename, 'r') as jFile:\n fString = jFile.read()\n fObj = json.loads(fString)\n return fObj",
"def from_JSON(cls,... | [
"0.8627839",
"0.8499868",
"0.8381428",
"0.8381308",
"0.82945096",
"0.8264224",
"0.8228979",
"0.8175282",
"0.8141267",
"0.8139032",
"0.81075746",
"0.81019723",
"0.8101533",
"0.8099575",
"0.80838925",
"0.8081554",
"0.80626",
"0.8051239",
"0.8019137",
"0.8011715",
"0.80056196",
... | 0.8287875 | 5 |
Feed inputs forward through the network. | def call(self, inputs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed_forward(self, inputs):\n raise NotImplementedError()",
"def forward(self, inputs):\n raise NotImplementedError",
"def forward(self, *inputs):\n raise NotImplementedError",
"def feedForward(self, inputs):\n\n\t\tinputs = np.atleast_1d(inputs)\n\n\t\tif not len(inputs) == self.nIn... | [
"0.8474318",
"0.8151607",
"0.7989538",
"0.79784733",
"0.7662172",
"0.76577586",
"0.76577586",
"0.75379753",
"0.75313306",
"0.7430849",
"0.7430849",
"0.7430849",
"0.73445404",
"0.7280794",
"0.72408575",
"0.7240696",
"0.72260976",
"0.715814",
"0.7056179",
"0.70169514",
"0.69767... | 0.0 | -1 |
Apply a 1D ramp filter needed for tomography reconstruction. | def tomography_filter(arr, axis=2, filter_type='hamming', backend='autograd'):
func = getattr(scipy.signal.windows, filter_type)
filter = func(arr.shape[axis])
if axis != len(arr.shape) - 1:
arr = swap_axes(arr, [axis, len(arr.shape) - 1])
if backend == 'pytorch':
args = {'device': arr.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ramp_filter_and_weight(projections, settings):\n projections_weighted = add_weights(projections, settings)\n\n n_pixels_u, _, _ = np.shape(projections_weighted)\n ramp_kernel = ramp_kernel_real(0.5, n_pixels_u)\n\n projections_filtered = np.zeros_like(projections_weighted)\n\n _, n_lines, n_proj... | [
"0.6122623",
"0.5717609",
"0.5644415",
"0.55776477",
"0.539958",
"0.5295776",
"0.5253659",
"0.52412933",
"0.52193886",
"0.5218625",
"0.51347667",
"0.5107549",
"0.5099333",
"0.49938744",
"0.49905062",
"0.4982127",
"0.4928363",
"0.49277702",
"0.49255234",
"0.49240866",
"0.48928... | 0.0 | -1 |
Return boolean with whether this object has been modified | def modified(self):
return self.__modified | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_modified(self) -> bool:\n return bool(self._modified)",
"def has_been_modified(self):\n return self._has_been_modified",
"def is_modified(self):\n return len(self.modified_fields) > 0",
"def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False... | [
"0.8424616",
"0.8373227",
"0.81602323",
"0.8152941",
"0.78965485",
"0.7884088",
"0.7846176",
"0.7796202",
"0.7771443",
"0.7751303",
"0.7751303",
"0.77037126",
"0.77037126",
"0.76996446",
"0.76989406",
"0.7678599",
"0.7618047",
"0.75926965",
"0.75648904",
"0.7554884",
"0.75212... | 0.7467766 | 25 |
check the Employee age, eligible for doing a job or not. If Gender is male, He is age greater than 18. If Gender is female, She is age greater than 21. | def _check_birthday(self):
for employee in self:
if employee.birthday and employee.gender:
diff = relativedelta(datetime.today(), datetime.strptime(employee.birthday, DEFAULT_SERVER_DATE_FORMAT))
if employee.gender == "male" and abs(diff.years) < 18:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_age_medicals(self, medicament):\n age = self.get_age()\n if age:\n if age > medicament.maximum_age and medicament.maximum_age:\n return {\"valid\": False, \"message\": _(f\"The patient is {age} years old, and {medicament.name} could not be taken for ages above {me... | [
"0.70209575",
"0.6649233",
"0.65323037",
"0.64927214",
"0.6484772",
"0.6445237",
"0.6405397",
"0.63694763",
"0.6228957",
"0.61216193",
"0.60818106",
"0.6041981",
"0.5970084",
"0.59604144",
"0.59456813",
"0.5944853",
"0.59328043",
"0.5929595",
"0.5873893",
"0.58676225",
"0.586... | 0.69092065 | 1 |
Calculating Duration depends on `Date of Join`, `Date of Leave` | def _get_months(self):
for employee in self:
if employee.date_of_join:
try:
join_date = datetime.strptime(employee.date_of_join, DEFAULT_SERVER_DATE_FORMAT)
to_date = datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_duration(date1, date2):\n duration = 0\n if date1 and date2:\n delta = abs(date1 - date2)\n duration = delta.days * 86400 + delta.seconds\n return duration",
"def find_duration(discharge, enroll_date, discharge_date):\n #pass\n today = datetime.datetime.today()\n if di... | [
"0.67507195",
"0.6245173",
"0.588216",
"0.5823858",
"0.57538223",
"0.56029975",
"0.5530835",
"0.5513021",
"0.55104864",
"0.5507825",
"0.5471896",
"0.5460113",
"0.5451224",
"0.5426447",
"0.5423701",
"0.5375056",
"0.5352816",
"0.533929",
"0.5335237",
"0.53270453",
"0.531649",
... | 0.571122 | 5 |
Calculate the total no of years, total no of months. | def _get_service_year(self):
if self.date_of_join and datetime.strptime(str(self.date_of_join), DEFAULT_SERVER_DATE_FORMAT) < datetime.strptime(str(datetime.today().date().strftime(DEFAULT_SERVER_DATE_FORMAT)), DEFAULT_SERVER_DATE_FORMAT):
if self.date_of_leave:
diff = relativedelta(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_years():\n years = movies['Year']\n return ('num_years', years.nunique())",
"def calculate_total_fees_collected(year=None, month=None):\n total = 0\n fees = load_fees()\n for fee in fees:\n if year and month:\n date = datetime.datetime.fromtimestamp(fee[\"created\... | [
"0.6621199",
"0.6305402",
"0.6288302",
"0.6182146",
"0.6153634",
"0.6076572",
"0.6027549",
"0.60143244",
"0.5978284",
"0.58456755",
"0.58037186",
"0.58005387",
"0.5770386",
"0.57425296",
"0.5736804",
"0.5720479",
"0.5701573",
"0.5664999",
"0.55856735",
"0.55360633",
"0.552741... | 0.5179431 | 68 |
Setup some environment for per test. | def setUp(self):
self.c = Client(host="localhost") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def SetupEnvironment(self):\n pass",
"def _setup_env(self):\n\n os.environ['GIT_NAME'] = statiki.GIT_NAME\n os.environ['GIT_EMAIL'] = statiki.GIT_EMAIL\n os.environ['GH_TOKEN'] = 'this-is-a-bogus-token:password'\n os.environ['TRAVIS_R... | [
"0.8268758",
"0.7830445",
"0.7717031",
"0.76626366",
"0.7602915",
"0.7441734",
"0.73590606",
"0.73572963",
"0.7310849",
"0.72229475",
"0.7208509",
"0.7202143",
"0.7202143",
"0.72019255",
"0.7193652",
"0.718583",
"0.7166952",
"0.7162936",
"0.71320075",
"0.7101146",
"0.69562453... | 0.0 | -1 |
Hashes `obj` by dumping to JSON. | def json_hash(obj: Any, encoder: type[json.JSONEncoder] | None = CoercingEncoder) -> str:
json_str = json.dumps(obj, ensure_ascii=True, allow_nan=False, sort_keys=True, cls=encoder)
return hash_all([json_str]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(obj):\n \n import hashlib\n import pickle\n \n sha = hashlib.sha256()\n sha.update(pickle.dumps(obj))\n \n return sha.hexdigest()",
"def object_sha1(obj):\n\n return hashlib.sha1(json.dumps(obj).encode()).hexdigest()",
"def object_sha256(obj):\n\n return hashlib.sha256(js... | [
"0.74847716",
"0.70948535",
"0.70776904",
"0.7058765",
"0.68453145",
"0.67701495",
"0.672561",
"0.67099243",
"0.6662584",
"0.6638839",
"0.66256124",
"0.66056734",
"0.6521907",
"0.6456108",
"0.6408986",
"0.6405308",
"0.63037145",
"0.6294605",
"0.62943625",
"0.628626",
"0.62790... | 0.7267629 | 1 |
As in the paper, we use a VGG16 pretrained on the ImageNet task as the base network. | def load_pretrained_layers(self):
# Current state of base
state_dict = self.state_dict()
param_names = list(state_dict.keys())
# Pretrained VGG base
pth = VGG_WEIGHT_PATH
pretrained_state_dict = torch.load(pth)
pretrained_param_names = list(pretrained_state_dict.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_cnn_vgg16(num_classes):\n\n inputs = tf.keras.layers.Input(\n shape=(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS)\n )\n\n x = inputs\n x = tf.keras.applications.vgg16.preprocess_input(x)\n vgg16 = tf.keras.applications.VGG16(\n input_shape=(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHAN... | [
"0.7664201",
"0.7634891",
"0.7413541",
"0.7355659",
"0.73531187",
"0.7325171",
"0.7317638",
"0.72671473",
"0.7266007",
"0.7203979",
"0.71876144",
"0.7154852",
"0.71487534",
"0.7099073",
"0.7025598",
"0.69917864",
"0.69753486",
"0.6927938",
"0.69201016",
"0.6882763",
"0.687909... | 0.0 | -1 |
fill dictionary with available data for given index . | def __getitem__(self, t):
collection = {}
# read raw data and unpack (if necessary)
for typ in self.files.keys():
scan_data = None
if typ == "label":
scan_data = np.fromfile(self.files[typ][t], dtype=np.uint16)
else:
scan_data = unpack(np.fromfile(self.files[typ][t], dtype... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, idx):\n \n sample = {'num_atoms': self.num_atoms[idx],\\\n 'symbols': self.symbols[idx],\\\n 'charges': self.charges[idx],\\\n 'positions': self.positions[idx],\\\n 'data': self.data[int(np.floor(idx/2))]}\n\n ... | [
"0.6669519",
"0.63337505",
"0.62594163",
"0.61622727",
"0.61130995",
"0.60738397",
"0.6070574",
"0.605033",
"0.6025124",
"0.5953984",
"0.59479266",
"0.5946525",
"0.59316146",
"0.5908958",
"0.5883978",
"0.5849945",
"0.58150864",
"0.5811558",
"0.58020306",
"0.57904154",
"0.5756... | 0.0 | -1 |
Creates a constructur for the Block class index = unique id of the block transaction = list of transactions timestamp = time of generation of the block previous_hash = hash of the previous block in the chain | def __init__(self, index, transactions, timestamp):
self.index = index
self.transactions = transactions
self.timestamp = timestamp
self.previous_hash = previous_hash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, index, previous_block_hash, transactions):\n self.index = index\n self.nonce = 0\n self.previous_block_hash = previous_block_hash\n self.transactions = transactions\n self.time = time.time()",
"def create_genesis_block(self):\n index = 0\n trans... | [
"0.82995665",
"0.7731969",
"0.7582638",
"0.7328283",
"0.71827793",
"0.7182623",
"0.71746516",
"0.7131273",
"0.69788694",
"0.6949527",
"0.6911108",
"0.6864883",
"0.6768151",
"0.67636746",
"0.6649219",
"0.6639719",
"0.66294765",
"0.66286033",
"0.65861803",
"0.6577195",
"0.65610... | 0.77220076 | 2 |
Check if block hash is a valid hash of block and satisfies the difficulty criteria | def is_valid_proof(self, block, block_hash):
return (block_hash.startswith('0' * Blockchain.difficulty) and block_hash == compute_hash()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_block(last_block, block):\n if block.last_hash != last_block.hash:\n raise Exception('Incorrect last_hash')\n if hex_to_binary(block.hash)[0:block.difficulty] != '0' * block.difficulty:\n raise Exception('Proof of Work not fulfilled')\n if abs(block.difficulty... | [
"0.7792443",
"0.77140975",
"0.7688585",
"0.7688585",
"0.73049587",
"0.72481626",
"0.7209706",
"0.70899296",
"0.6846081",
"0.6776656",
"0.6774524",
"0.6742169",
"0.6711077",
"0.66286105",
"0.6562098",
"0.65541834",
"0.6542234",
"0.65386933",
"0.6538536",
"0.65259653",
"0.65061... | 0.8349925 | 0 |
Establish a connection to the database, creating an Engine instance. | def __init__(self, conn_string, max_records=20):
self.engine = create_engine(conn_string, convert_unicode=True)
self.connection_string = conn_string
self.max_records = max_records
self.sessionfactory = sessionmaker(bind=self.engine) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self):\n self.engine = create_engine(self.connection_string)\n self.conn = self.engine.connect()\n self.connected = True",
"def Engine_Connection(self):\n try:\n # Engine Connection\n engine = create_engine('mysql+mysqlconnector://{}:{}@{}/{}'.format(self.user,self.p... | [
"0.7773278",
"0.772009",
"0.7650674",
"0.75385386",
"0.74492353",
"0.74340075",
"0.74340075",
"0.74340075",
"0.74340075",
"0.738923",
"0.7371055",
"0.73288083",
"0.73165727",
"0.7188922",
"0.71519834",
"0.71519834",
"0.71519834",
"0.71519834",
"0.71519834",
"0.7149909",
"0.71... | 0.0 | -1 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
bestScore , bestMove = self.alphaBeta(gameState,self.depth,0,-999999,999999)
return bestMove | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7483949",
"0.7384023",
"0.71817994",
"0.71111315",
"0.7089011",
"0.70693064",
"0.7068398",
"0.7048451",
"0.70046556",
"0.6965484",
"0.69646126",
"0.6962137",
"0.6945194",
"0.6899847",
"0.68964547",
"0.6885432",
"0.68272644",
"0.6766459",
"0.6757756",
"0.6752681",
"0.670732... | 0.0 | -1 |
Constructor Construct a grama domain. Generally not called directly; preferred usage is through gr.comp_bounds(). | def __init__(self, bounds=None, feasible=None):
if bounds is None:
bounds = {}
self.bounds = bounds
self.feasible = feasible
self.update() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, domain, range):\n self.domain = domain.cloneSpace()\n self.range = range.cloneSpace()",
"def __init__(self, lower_bound, upper_bound):\n\n if lower_bound > upper_bound:\n lower_bound, upper_bound = upper_bound, lower_bound\n\n self.lb = lower_bound\n ... | [
"0.6243167",
"0.6215395",
"0.6069123",
"0.6067437",
"0.6067437",
"0.6059603",
"0.6021542",
"0.6021542",
"0.6021542",
"0.6021542",
"0.6021542",
"0.60064024",
"0.5871769",
"0.5842781",
"0.5838575",
"0.5796185",
"0.5701624",
"0.56809783",
"0.56717867",
"0.56532013",
"0.5614824",... | 0.5623833 | 20 |
Constructor Construct a grama density. Generally not called directly; preferred usage is through gr.comp_marginals() and gr.comp_copula(). | def __init__(self, marginals=None, copula=None):
self.marginals = marginals
self.copula = copula | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n pdf,\n colour,\n inst_name=\"\"):\n \n self.colour = colour\n self.inst_name = inst_name\n \n # Stores whether the univariate marginals are proper distributions \n self.prior = {\n \"q\":... | [
"0.6398997",
"0.5972553",
"0.5760588",
"0.5685034",
"0.5666182",
"0.5644982",
"0.5620732",
"0.56090367",
"0.5563153",
"0.55546856",
"0.5539418",
"0.5536677",
"0.55133283",
"0.5497428",
"0.54762274",
"0.54534286",
"0.54338396",
"0.540716",
"0.5402743",
"0.53949183",
"0.5380176... | 0.5891499 | 2 |
r"""Evaluate PDF Evaluate the PDF of the density. | def d(self, df):
# Get variable names
var = [key for key, _ in self.marginals.items()]
df_u = self.sample2pr(df)[var]
# Evaluate copula density
l_copula = self.copula.d(df_u.values)
# Evaluate marginal densities
L_marginals = zeros((df.shape[0], len(var)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pdf(self, x, **kwargs):\n from scipy.stats import rv_continuous\n return self.rvdist.pdf(x, **kwargs) if rv_continuous in self.rvdist.__class__.__mro__ \\\n else self.rvdist.evaluate(x, **kwargs)",
"def pdf(self,x):\n pdfValue = self.pdfFunc(x)\n return pdfValue",
"def pdf(self... | [
"0.75124764",
"0.7088764",
"0.7036566",
"0.7004486",
"0.6933874",
"0.6920516",
"0.68956625",
"0.683293",
"0.683293",
"0.679446",
"0.66864187",
"0.6665755",
"0.6637228",
"0.6626227",
"0.65756893",
"0.6550657",
"0.6549342",
"0.6544753",
"0.65434766",
"0.65058434",
"0.6500832",
... | 0.0 | -1 |
r"""Transform random samples to standard normal space Transform a DataFrame of random variable samples to standard normal space | def rand2norm(self, df):
## Check invariants
if not set(self.var_rand).issubset(set(df.columns)):
raise ValueError("model.var_rand must be subset of df.columns")
data = zeros((df.shape[0], self.n_var_rand))
for i in range(df.shape[0]):
data[i] = self.x2z(df[self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm2rand(self, df):\n ## Check invariants\n if not set(self.var_rand).issubset(set(df.columns)):\n raise ValueError(\"model.var_rand must be subset of df.columns\")\n\n data = zeros((df.shape[0], self.n_var_rand))\n for i in range(df.shape[0]):\n data[i] = sel... | [
"0.7259145",
"0.6907529",
"0.6741315",
"0.66997236",
"0.65885013",
"0.6429431",
"0.6399394",
"0.6399394",
"0.63415664",
"0.6321122",
"0.6311145",
"0.6270532",
"0.6264013",
"0.6228682",
"0.62149656",
"0.6163986",
"0.6158648",
"0.61498076",
"0.61359423",
"0.6133752",
"0.6005385... | 0.72478974 | 1 |
return the NERDm metadata describing the data entity with the given ID. | def describe(self, id):
url = None
if id.startswith("ark:"):
url = self._url_for_pdr_id(id)
else:
url = self._url_for_ediid(id)
out = self._retrieve(url, id)
if "ResultData" in out:
out = out["ResultData"]
if len(out) == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meta(_id):\n dataset = ESDataset.get(id=_id, ignore=404, _source=\"_meta\")\n\n if dataset:\n return RegistryDocument.wraps(dataset).meta\n\n raise NoEntityError(f\"dataset {_id} does not exist.\")",
"def getmetadata(self, obj_id):\n return self.metadata[obj_id]",
"def get_metada... | [
"0.71224",
"0.7107797",
"0.6569183",
"0.6516969",
"0.644424",
"0.62588346",
"0.6096047",
"0.6068389",
"0.6062571",
"0.60573536",
"0.58819216",
"0.5853127",
"0.5852435",
"0.5838781",
"0.58373123",
"0.57485825",
"0.57425195",
"0.573047",
"0.5727542",
"0.5725073",
"0.5720987",
... | 0.6170267 | 6 |
String representation for the Location Drawer Payment model | def __str__(self) -> str:
return f'{self.type}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n\n return f'{self.location}'",
"def __str__(self):\n return f'{self.location}'",
"def __str__(self):\n return '{0} : {1} : {2}'.format(self.location_det_info.location_id, self.location_det_info.location_name, self.photo_link)",
"def str(self):\n out = \"{0}:\".... | [
"0.70099103",
"0.6998433",
"0.6778709",
"0.6763903",
"0.67402375",
"0.67058694",
"0.6571984",
"0.6505647",
"0.6470466",
"0.63967186",
"0.63722545",
"0.6360435",
"0.63343143",
"0.6298049",
"0.62603635",
"0.6254687",
"0.6254618",
"0.624836",
"0.62433094",
"0.6243134",
"0.623581... | 0.0 | -1 |
Emit SET_LINENO if necessary. The instruction is considered necessary if the node has a lineno attribute and it is different than the last lineno emitted. Returns true if SET_LINENO was emitted. There are no rules for when an AST node should have a lineno attribute. The transformer and AST code need to be reviewed and ... | def set_lineno(self, node, force=False):
lineno = getattr(node, 'lineno', None)
if lineno is not None and (lineno != self.last_lineno or force):
self.emit('SET_LINENO', lineno)
self.last_lineno = lineno
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_start_lineno_if_needed():\n if origin and record.origin.line_start is None:\n record.origin.line_start = lineno",
"def lineno(self):\n return self._lineno",
"def get_line(root_node: ast.AST, node: ast.AST):\n try:\n return node.lineno\n except AttributeError:\n ... | [
"0.6090753",
"0.54435706",
"0.53955555",
"0.52572405",
"0.523775",
"0.5221846",
"0.5098071",
"0.50561935",
"0.50064635",
"0.49837703",
"0.4916891",
"0.49163967",
"0.49006867",
"0.48995608",
"0.48987743",
"0.48576197",
"0.48494282",
"0.48438025",
"0.48414102",
"0.48245996",
"0... | 0.76886386 | 0 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.62452537 | 55 |
Return a random tuple (i, j). | def get_random_pos(self):
i = np.random.randint(self.n)
j = np.random.randint(self.m)
return [i, j] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_tuple(population, k, required_inds=None):\n if isinstance(population, int):\n population = xrange(population)\n\n if required_inds is None:\n required_inds = []\n if not isinstance(required_inds, collections.Iterable):\n required_inds = [required_inds]\n\n t = set(random.s... | [
"0.6667828",
"0.6624174",
"0.6512363",
"0.63910574",
"0.62705207",
"0.6187195",
"0.6091368",
"0.6077508",
"0.60188717",
"0.6013809",
"0.6012315",
"0.5984338",
"0.5957003",
"0.5936673",
"0.5936673",
"0.59293884",
"0.59269667",
"0.59144294",
"0.590757",
"0.5885684",
"0.5878637"... | 0.6739952 | 0 |
Draw colored tile from a list L. | def draw_rects(self, L, col):
for (i, j) in L:
self.draw_rect(i, j, col) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_tiles(self, tiles):\n for row in tiles:\n for tile in row:\n if tile is not None:\n if tile.height < 0:\n color = (0, 100, 0)\n else:\n z = max(0, tile.height)\n co... | [
"0.6016556",
"0.5891438",
"0.58472604",
"0.5810777",
"0.5739628",
"0.5729555",
"0.57203376",
"0.56978184",
"0.56844044",
"0.5681095",
"0.5680744",
"0.56334877",
"0.562761",
"0.562355",
"0.5616588",
"0.5581281",
"0.5559415",
"0.55496836",
"0.5520321",
"0.5490927",
"0.54771984"... | 0.68708766 | 0 |
Function aimed in testing the helpers.read_json function. | def test_read_json(self, magic_0, magic_1):
expected = {
'key_1': [1, 2, 3, 4, 5],
'key_2': ['a', 'b', 'c', 'd', 'e']
}
result = helpers.read_json(r"path")
self.assertEqual(expected, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_json_reader_data_contents(process_data):\n json_data = process_data(file_name_or_type='scooter_data.json')\n for val in json_data:\n assert(isinstance(val['id'], int))\n assert(isinstance(val['name'], str))\n assert(isinstance(val['vin_number'], str))\n assert(isinstance(... | [
"0.7320012",
"0.72312754",
"0.7138794",
"0.7136585",
"0.70071435",
"0.70071435",
"0.6958049",
"0.69369966",
"0.6906503",
"0.6906503",
"0.6867454",
"0.6860315",
"0.6838553",
"0.6795767",
"0.6778921",
"0.67576665",
"0.67514074",
"0.67500865",
"0.6739042",
"0.6732836",
"0.671874... | 0.7681831 | 0 |
Initialize the hidden state and cell state. | def init_hidden(self, batch_size):
return (
autograd.Variable(
torch.rand(2, batch_size, self.hidden_dim) * 2 * 0.08
), # https://github.com/xthan/polyvore/blob/master/polyvore/polyvore_model_bi.py#L55
autograd.Variable(
torch.rand(2, batch_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden_state(self, batch_size):\n hidden_state = tf.tile(self.initial_hidden_state[None, ...], [batch_size, 1])\n cell_state = tf.tile(self.initial_cell_state[None, ...], [batch_size, 1])\n return hidden_state, cell_state",
"def init_hidden(self, batch_size):\r\n \r\n ... | [
"0.73617977",
"0.7226318",
"0.7079848",
"0.7079848",
"0.70144343",
"0.67628485",
"0.67002016",
"0.6632528",
"0.6632528",
"0.6632528",
"0.6527183",
"0.6527183",
"0.6527183",
"0.65238804",
"0.65238804",
"0.65086514",
"0.6434806",
"0.64345723",
"0.64314824",
"0.64314824",
"0.641... | 0.5681501 | 66 |
Create a packed input of sequences for a RNN. | def create_packed_seq(self, feats, seq_lens, im_lookup_table):
# Manually create the padded sequence.
if feats.is_cuda:
seqs = autograd.Variable(
torch.zeros(
(len(seq_lens), max(seq_lens), feats.size()[1]))).cuda()
else:
seqs = autogra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_sequences(notes, n_vocab):\n sequence_length = GLOBAL_SEQUENCE_LENGTH\n\n # Get all pitch names\n pitchnames = sorted(set(item for item in notes))\n\n # Create a dictionary to map pitches to integers\n note_to_int = dict((note, number) for number, note in enumerate(pitchnames))\n\n ne... | [
"0.6624424",
"0.65432435",
"0.6430026",
"0.63755125",
"0.63290334",
"0.630918",
"0.62947017",
"0.6275339",
"0.6243178",
"0.61486185",
"0.6136597",
"0.61088896",
"0.60775197",
"0.60610133",
"0.60557157",
"0.6052515",
"0.60524744",
"0.6050131",
"0.6028388",
"0.59746444",
"0.591... | 0.61615455 | 9 |
Test active today not between start and end dates. | def test_is_active_active_not_between(self) -> None:
today = date.today()
start_date = today - timedelta(days=today.weekday() - 2)
end_date = today - timedelta(days=today.weekday() - 1)
mode = HolidayMode(True, start_date, end_date, 15)
self.assertFalse(mode.is_applied) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_active(self):\n return self.start_date <= timezone.now() <= self.end_date",
"def is_inactive(self):\n now = datetime.datetime.now()\n return not (self.start_date < now < self.end_date)",
"def test_is_active_active_between(self) -> None:\n today = date.today()\n start_d... | [
"0.74885595",
"0.7274014",
"0.70272726",
"0.67864335",
"0.67675394",
"0.66699046",
"0.6493918",
"0.64817417",
"0.64309967",
"0.64175755",
"0.6395898",
"0.6321181",
"0.6320058",
"0.6315172",
"0.6315092",
"0.6302736",
"0.62728834",
"0.625843",
"0.62482834",
"0.6243694",
"0.6237... | 0.73386633 | 1 |
Initialize a Gaussian random variable. | def __init__(self, mu, sigma, *args, **kwargs):
self.mu = mu
self.sigma = sigma
super(GaussianRV, self).__init__(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_init(self, shape):\n return np.random.randn(shape[0],shape[1])*0.01",
"def _get_gaussian_random(self):\n u1 = generateRandom()\n u2 = generateRandom()\n if u1 < 1e-6:\n u1 = 1e-6\n return sqrt(-2 * log(u1)) * cos(2 * pi * u2)",
"def normal_init(self, sha... | [
"0.6744747",
"0.6717002",
"0.6607362",
"0.6573724",
"0.6563046",
"0.64900076",
"0.6465558",
"0.6464118",
"0.64568263",
"0.64512306",
"0.6442146",
"0.64314324",
"0.64196366",
"0.6395236",
"0.6383498",
"0.63777655",
"0.6372457",
"0.63624024",
"0.63588077",
"0.63393",
"0.6339254... | 0.6186043 | 33 |
Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $(\frac{h_i}{\sum_{j \in R_i} h_j})^d$, where h = exp(log_h) are the hazards and R is the risk set, and d is event. We just compute a cumulative sum, and not the true Risk sets. This is a limitation,... | def cox_ph_loss_sorted(log_h: Tensor, events: Tensor, eps: float = 1e-7) -> Tensor:
if events.dtype is torch.bool:
events = events.float()
events = events.view(-1)
log_h = log_h.view(-1)
gamma = log_h.max()
log_cumsum_h = log_h.sub(gamma).exp().cumsum(0).add(eps).log().add(gamma)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_audit(self):\r\n \r\n time = datetime.now()\r\n H0_dist = []\r\n Ha_dist = []\r\n\r\n for i in range(0, self.m):\r\n #print(\"CURRENT H0 dist: \", H0_dist)\r\n #try:\r\n H0_dist = self.next_round_dist(True, H0_dist, i)\r\n H... | [
"0.55887425",
"0.55281687",
"0.55039567",
"0.53570557",
"0.5266556",
"0.5241863",
"0.51615405",
"0.5160888",
"0.51575714",
"0.51163137",
"0.5112806",
"0.5096397",
"0.50099766",
"0.5007185",
"0.49977466",
"0.4997082",
"0.49662736",
"0.4963862",
"0.49418226",
"0.49141416",
"0.4... | 0.5429703 | 3 |
Set the frequency range of the output. Use ranges within SignalGenerator.FREQ_MAX and SignalGenerator.FREQ_MIN. Specify input as a tuple containg the LOW followed by the HIGH frequency limits. Preferably use the predefined constant dictionary SignalGenerator.FREQ_RANGE FREQ_RANGE { | def set_frequency_range(self, range_tuple):
if (type(range_tuple) not in [list, tuple]):
raise TypeError(
"ERROR: Invalid input. Input can be specified only as a list or a tuple")
if (len(range_tuple)) != 2:
raise TypeError(
"ERROR: The length of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_frequency(value):\n # user input, minimum, maximum\n checklist = [int(value), 300000000, 928000000]\n\n if SendSignal.__verify_range(*checklist):\n SendSignal.__SIGNAL_SETTINGS['frequency'] = int(value)\n SendSignal.__SIGNAL_OBJ.setFreq(int(value))\n else:\... | [
"0.7274618",
"0.68081474",
"0.67206943",
"0.6476613",
"0.64119196",
"0.6271486",
"0.6214224",
"0.6176667",
"0.61189604",
"0.61189604",
"0.60379213",
"0.5987519",
"0.5935705",
"0.5915379",
"0.58926046",
"0.5874725",
"0.58571476",
"0.5823919",
"0.5818184",
"0.5805669",
"0.58032... | 0.75710684 | 0 |
Get the supported set of observables. | def observables(self):
return set(self._observable_map.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def observables(self):\r\n return self.__obs",
"def get_supported_sets(self):\n return _SUPPORTED_SETS",
"def get_supported_models(self):\n # type: () -> list\n return [model for model in self.__MODELS]",
"def get_supported_components(self):\n props = [cdav.SupportedCalenda... | [
"0.6722699",
"0.6110938",
"0.60458404",
"0.5835492",
"0.5665685",
"0.55459493",
"0.5419365",
"0.5406008",
"0.5404827",
"0.5396789",
"0.5391973",
"0.5374185",
"0.5338113",
"0.53234094",
"0.5294283",
"0.5273609",
"0.52700305",
"0.5258915",
"0.52492476",
"0.524019",
"0.52053636"... | 0.7203263 | 0 |
convert list of tuples to list of lists | def convert_list(l):
l = [list(elem) for elem in l]
return l | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tuple_to_list(tup):\n return [element for element in tup]",
"def to_list(ls):\r\n if isinstance(ls, (list, tuple)):\r\n return list(ls)\r\n else:\r\n return [ls]",
"def flat_list_of_lists(l):\n return [item for sublist in l for item in sublist]",
"def _maybe_tuple_to_lis... | [
"0.8212648",
"0.7133514",
"0.67383367",
"0.6616539",
"0.6569436",
"0.65513074",
"0.6508825",
"0.6496192",
"0.6419155",
"0.63719624",
"0.63564456",
"0.6303291",
"0.62985927",
"0.6281755",
"0.62375486",
"0.61934125",
"0.6158539",
"0.6154009",
"0.61528033",
"0.6146441",
"0.61410... | 0.66898906 | 3 |
convert numbers to letters when updating database | def convert_numtoletter(n):
L = seats[0][n-1] #letter
return L | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change(st):\n return ''.join('1' if a in st.lower() else '0' for a in map(chr, range(97, 123)))",
"def int_to_alpha(num):\n remainder = num\n text = []\n if num >= 26:\n major = remainder // 26\n text.append(ascii_lowercase[remainder // 26 - 1])\n remainder -= major * 26\n ... | [
"0.59044945",
"0.5670396",
"0.5596653",
"0.55859095",
"0.558131",
"0.5580846",
"0.55670166",
"0.5559438",
"0.5546385",
"0.55315113",
"0.55245894",
"0.55229616",
"0.54850745",
"0.54723483",
"0.5450055",
"0.5450055",
"0.5434073",
"0.54326814",
"0.5406376",
"0.5406376",
"0.53780... | 0.5356378 | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.