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 |
|---|---|---|---|---|---|---|
An upper bound on the number of invites sent in the last `days` days | def estimate_recent_invites(realms: Collection[Realm], *, days: int) -> int:
recent_invites = RealmCount.objects.filter(
realm__in=realms,
property="invites_sent::day",
end_time__gte=timezone_now() - datetime.timedelta(days=days),
).aggregate(Sum("value"))["value__sum"]
if recent_inv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remaining_days_in_current_period(self):\n try:\n return self.count_days_from_now(self.current_period_ends_at)\n except AttributeError:\n return 0",
"def last_days_results(self, days):\n return self.security['Date', 'Close', 'FinalDecision'][-days:]",
"def remainin... | [
"0.60058075",
"0.59577036",
"0.58903176",
"0.58417714",
"0.5803342",
"0.5769002",
"0.57686865",
"0.57513726",
"0.5716907",
"0.567923",
"0.5666582",
"0.5571618",
"0.55624706",
"0.55615324",
"0.5542534",
"0.5520669",
"0.5501939",
"0.54907006",
"0.54841435",
"0.54222095",
"0.541... | 0.69755816 | 0 |
Test if changing a state to a zero value is possible. | async def test_api_state_change_to_zero_value(
hass: HomeAssistant, mock_api_client: TestClient
) -> None:
resp = await mock_api_client.post(
"/api/states/test_entity.with_zero_state", json={"state": 0}
)
assert resp.status == HTTPStatus.CREATED
resp = await mock_api_client.post(
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self) -> bool:\n return self.field.zero == self",
"def isZero(self):\n\t\treturn (self.p.isZero() & (self.q.isZero() == False))",
"def is_zero(self, a):\n return not a",
"def is_zero(self):\n return (self._num == 0)",
"def is_zero(self):\n return self._express.is_zer... | [
"0.73544365",
"0.7302472",
"0.725837",
"0.72285306",
"0.71520877",
"0.71436054",
"0.7125217",
"0.70954514",
"0.708613",
"0.7013169",
"0.69824266",
"0.69645005",
"0.68737406",
"0.68569106",
"0.6801159",
"0.67818016",
"0.67705464",
"0.67519456",
"0.67096674",
"0.6701111",
"0.66... | 0.0 | -1 |
Test sending event requires admin. | async def test_post_event_admin(
hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser
) -> None:
hass_admin_user.groups = []
resp = await mock_api_client.post("/api/events/state_changed")
assert resp.status == HTTPStatus.UNAUTHORIZED | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_event_stream_requires_admin(\n hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser\n) -> None:\n hass_admin_user.groups = []\n resp = await mock_api_client.get(\"/api/stream\")\n assert resp.status == HTTPStatus.UNAUTHORIZED",
"def test_admin(self):\n ass... | [
"0.7089269",
"0.7011658",
"0.7003394",
"0.6900787",
"0.6857657",
"0.67954934",
"0.6772854",
"0.6598995",
"0.6379327",
"0.63549584",
"0.6346208",
"0.63351744",
"0.6331693",
"0.6264606",
"0.6248772",
"0.6238217",
"0.6237759",
"0.62180626",
"0.62119085",
"0.61435604",
"0.6128294... | 0.6823375 | 5 |
Test if the API fails 400 if unknown service. | async def test_api_call_service_not_found(
hass: HomeAssistant, mock_api_client: TestClient
) -> None:
resp = await mock_api_client.post("/api/services/test_domain/test_service")
assert resp.status == HTTPStatus.BAD_REQUEST | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bad_request():\n return HttpError(400)",
"def test_unknown_service(self):\n raise NotImplementedError # FIXME",
"def test_bad_request(self):\n self._error_test(fitbit_exceptions.HTTPBadRequest)",
"def test_unknown_resource_under_service(self):\n raise NotImplementedError # FIXME... | [
"0.68837065",
"0.6854463",
"0.6836647",
"0.6711121",
"0.6697271",
"0.6591661",
"0.6569441",
"0.65096295",
"0.64941186",
"0.647006",
"0.6430915",
"0.64174676",
"0.63917804",
"0.63644826",
"0.6330154",
"0.6326488",
"0.6315322",
"0.63026416",
"0.6300717",
"0.6293535",
"0.6292228... | 0.6843427 | 2 |
Test if the API fails 400 if unknown service. | async def test_api_call_service_bad_data(
hass: HomeAssistant, mock_api_client: TestClient
) -> None:
test_value = []
@ha.callback
def listener(service_call):
"""Record that our service got called."""
test_value.append(1)
hass.services.async_register(
"test_domain", "test_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bad_request():\n return HttpError(400)",
"def test_unknown_service(self):\n raise NotImplementedError # FIXME",
"async def test_api_call_service_not_found(\n hass: HomeAssistant, mock_api_client: TestClient\n) -> None:\n resp = await mock_api_client.post(\"/api/services/test_domain/test_se... | [
"0.68834925",
"0.68532723",
"0.68430823",
"0.68363065",
"0.6709689",
"0.6697629",
"0.65906274",
"0.65689635",
"0.6509782",
"0.6493042",
"0.646856",
"0.6431261",
"0.6414697",
"0.6390746",
"0.6363637",
"0.6331421",
"0.63235366",
"0.63149935",
"0.6302825",
"0.6298744",
"0.629187... | 0.0 | -1 |
test get method 400 | async def test_get_400():
work_queue = asyncio.Queue()
await work_queue.put(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE)
worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue)
with aioresponses() as mocked:
mocked.get(TestData.DEFAULT_JOB_TEMPLATES_LIST_URL, status=400, body="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_fail(self):\n response = self.second_client.get(self.url)\n self.assertEquals(response.status_code, 400)",
"def test_GET3(self):\n r = requests.get(self.address)\n self.assertEqual(r.status_code, 400)",
"def test_two_legged_get(self):\n resp, content = self._two_... | [
"0.8090046",
"0.80869406",
"0.7970418",
"0.79357815",
"0.79357815",
"0.7921583",
"0.78648674",
"0.786213",
"0.7799408",
"0.77980393",
"0.77980393",
"0.7777813",
"0.7613449",
"0.7579809",
"0.7579809",
"0.7561017",
"0.7495695",
"0.7489103",
"0.74041486",
"0.73891914",
"0.738870... | 0.0 | -1 |
Test Post Method 400 | async def test_post_400():
work_queue = asyncio.Queue()
await work_queue.put(TestData.JOB_TEMPLATE_POST_PAYLOAD)
worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue)
with aioresponses() as mocked:
mocked.post(
TestData.JOB_TEMPLATE_POST_URL, status=400, body="B... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_POST2(self):\n payload = {\n \"id\": \"222\",\n \"make\": \"Wolkswagen\",\n \"model\": \"Golf\",\n \"year\": 2011,\n \"price\": 8600\n }\n r = requests.post(self.address, json=payload)\n self.assertEqual(r.status_code, 400)... | [
"0.78783363",
"0.7701792",
"0.7605584",
"0.75895816",
"0.7517692",
"0.7479943",
"0.74356794",
"0.74356794",
"0.74164563",
"0.73962384",
"0.73636824",
"0.7326245",
"0.7314988",
"0.7270846",
"0.7253879",
"0.7253861",
"0.723646",
"0.72305346",
"0.7222394",
"0.7218809",
"0.721119... | 0.0 | -1 |
r"""Calculates centers, (x, y), of box (N, 4) | def center(box):
x_center = box[:, 0] + (box[:, 2] - box[:, 0]) // 2
y_center = box[:, 1] + (box[:, 3] - box[:, 1]) // 2
return torch.stack((x_center, y_center)).t().to(box.device) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_size(boxes):\n concat = P.Concat(1)\n return concat(((boxes[:, 2:] + boxes[:, :2])/2, # cx, cy\n boxes[:, 2:] - boxes[:, :2])) # w, h",
"def to_center_form(boxes):\n x_min, y_min = boxes[:, 0], boxes[:, 1]\n x_max, y_max = boxes[:, 2], boxes[:, 3]\n center_x = (x_... | [
"0.7844434",
"0.7580505",
"0.75150996",
"0.7374247",
"0.71713126",
"0.71421254",
"0.7123263",
"0.7022318",
"0.69268924",
"0.6919755",
"0.6817232",
"0.675503",
"0.66800183",
"0.6634561",
"0.6622195",
"0.6617297",
"0.6592415",
"0.6585464",
"0.65702504",
"0.65461254",
"0.6537031... | 0.7520257 | 2 |
r"""Returns boxes in onehot format that covers given keypoints | def neighbours(box, kps):
box_duplicate = box.unsqueeze(2).repeat(1, 1, len(kps.t())).transpose(0, 1)
kps_duplicate = kps.unsqueeze(1).repeat(1, len(box), 1)
xmin = kps_duplicate[0].ge(box_duplicate[0])
ymin = kps_duplicate[1].ge(box_duplicate[1])
xmax = kps_duplicate[0].le(box_duplicate[2])
ym... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)",
"def isolate_key_ponits(mask, keypoints):\n new_mask = np.zeros(mask.shape) * 255\n for y, x in keypoints[0].conver... | [
"0.6023954",
"0.59734654",
"0.5906592",
"0.5894241",
"0.5691551",
"0.56882316",
"0.56732035",
"0.5670251",
"0.5649142",
"0.56303936",
"0.5620511",
"0.55627286",
"0.5522864",
"0.55192226",
"0.551634",
"0.5511373",
"0.5501042",
"0.54976946",
"0.54897213",
"0.5486914",
"0.548356... | 0.5936421 | 2 |
Sets handler to notify media information. | def set_info_event_handler(self, handler):
self.info_handler = handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_handler(self, handler):\n self._handler = handler",
"def setAlertNotificationHandler(self, handler):\n self.alertNotificationHandler = handler",
"def register_handler(self, handler):\r\n self.handler = handler",
"def __init__(self, handler: mediaHandler):\n\n self.handler ... | [
"0.69296384",
"0.6656942",
"0.6458559",
"0.64305735",
"0.6423851",
"0.63559604",
"0.62055033",
"0.61443347",
"0.6069962",
"0.6003106",
"0.5912256",
"0.5867151",
"0.57176775",
"0.5670392",
"0.56581545",
"0.5640697",
"0.5590167",
"0.5568174",
"0.55603975",
"0.5541731",
"0.54989... | 0.6233584 | 6 |
Set streaming source URL. | def set_url(self, source_url):
if utils.validate_url(source_url, "rtsp"):
self.url = source_url
self.set_state_null()
self.setup_pipeline()
self.play()
else:
print("Invalid URL") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_source(self, source):\n self.data['source'] = source",
"def set_stream_url(self, url, info=None):\n listitem = xbmcgui.ListItem(label='clip', path=url)\n xbmcplugin.setResolvedUrl(self.handle, True, listitem)",
"def src(self, src):\n\n self._src = src",
"def set_url(self, ... | [
"0.6712162",
"0.6592298",
"0.647681",
"0.6407756",
"0.6372209",
"0.635762",
"0.6356142",
"0.6350102",
"0.63494205",
"0.62204987",
"0.6213311",
"0.6206013",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.61903834",
"0.6171611",
"0.6141... | 0.78246737 | 0 |
Insert a single component at index. | def Insert(self, index, rdfpathspec=None, **kwarg):
if rdfpathspec is None:
rdfpathspec = self.__class__(**kwarg)
if index == 0:
# Copy ourselves to a temp copy.
nested_proto = self.__class__()
nested_proto.SetRawData(self.GetRawData())
# Replace ourselves with the new object.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, index, p_object): # real signature unknown; restored from __doc__\n pass",
"def insert(self, item: T, index: int) -> None:\n pass",
"def insert(self, index: int, item: Any) -> None:\n self.contents.insert(index, item)\n return",
"def insert(self, index, item):\n ... | [
"0.75078076",
"0.7310345",
"0.7299112",
"0.7242185",
"0.724123",
"0.71909964",
"0.7151328",
"0.7115667",
"0.70852554",
"0.7084879",
"0.7059566",
"0.7035718",
"0.6994174",
"0.695882",
"0.6912395",
"0.6813797",
"0.6786568",
"0.67380273",
"0.6733274",
"0.67274284",
"0.6719816",
... | 0.6344632 | 37 |
Returns a list of unique values in preserved order. | def _unique(iterable):
return list(dict.fromkeys(iterable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique(x):\n\n return list(set(x))",
"def create_unique_value_list(value):\n my_set = set(value)\n new_list = list(my_set)\n new_list.sort()\n return new_list",
"def _unique(li):\n return list(set(li))",
"def unique(seq):\n return list(set(seq))",
"def distinct(x):\n return list... | [
"0.81129277",
"0.7803977",
"0.77864575",
"0.76509386",
"0.759385",
"0.7525359",
"0.738596",
"0.7371861",
"0.72834635",
"0.7258286",
"0.72512347",
"0.71951",
"0.7178567",
"0.71587765",
"0.7147433",
"0.7127199",
"0.7072416",
"0.7035133",
"0.7030887",
"0.7026637",
"0.70066077",
... | 0.7027201 | 19 |
Returns a list of GlobComponentExplanations with examples. | def ExplainComponents(self, example_count: int,
knowledge_base) -> Sequence[GlobComponentExplanation]:
parts = _COMPONENT_SPLIT_PATTERN.split(self._value)
components = []
for glob_part in parts:
if not glob_part:
continue
component = GlobComponentExplanation(glo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_examples():\n # Get the tjson test cases from a url.\n examples = urlopen(TJSON_EXAMPLES_URL).read()\n\n # Strip comments from the lines.\n examples = re.sub(r\"^#.*\\n?\", \"\", examples.decode(), flags=re.MULTILINE)\n\n # Split a group of examples.\n delimiter = re.escape(EXAMPLES_DELIM... | [
"0.67662424",
"0.66115737",
"0.6609532",
"0.6507707",
"0.64227337",
"0.63136464",
"0.62638426",
"0.6231608",
"0.6231608",
"0.61889976",
"0.61759686",
"0.61759686",
"0.6167018",
"0.6167018",
"0.6167018",
"0.6167018",
"0.6167018",
"0.61635184",
"0.6145044",
"0.61187345",
"0.610... | 0.59416443 | 44 |
Return train and validation data loaders. | def get_dataloaders(args):
if args.dataset == 'heat':
dataset_class = heat.HeatDiffusionDataset
else:
raise ValueError(f'Unknown dataset {args.dataset}')
train_dataset = dataset_class(
dataset_class.get_train_path(args.data_path), args, train=True)
if args.dist:
train_sam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loaders(train_dataset, val_dataset, test_dataset, batch_size=128):\n train_loader = DataLoader(train_dataset, batch_size=batch_size, num_workers=8,\n shuffle=True)\n\n val_loader = DataLoader(val_dataset, batch_size=batch_size, num_workers=8,\n ... | [
"0.8474643",
"0.82500017",
"0.8021656",
"0.782781",
"0.78098774",
"0.7785202",
"0.7696616",
"0.7657214",
"0.7638478",
"0.75306267",
"0.74784565",
"0.7437562",
"0.7394582",
"0.73904926",
"0.73904926",
"0.73904926",
"0.73904926",
"0.73904926",
"0.73904926",
"0.73904926",
"0.739... | 0.6936148 | 41 |
Convert a value, as found in cherrypy parameters, into a list. | def listify(val):
if isinstance(val, basestring):
return [val]
if hasattr(val, '__iter__'):
return list(val)
return [val] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_python(self, value):\n # Return an empty list if no input was given.\n if not value:\n return []\n return value.split(',')",
"def _as_list(value):\n if not isinstance(value, list):\n value = [value]\n return value",
"def to_list(value):\n if hasattr(value,... | [
"0.73468643",
"0.72042423",
"0.7164559",
"0.67624813",
"0.67364633",
"0.67269695",
"0.669944",
"0.66236186",
"0.6555451",
"0.6509249",
"0.65055346",
"0.6492622",
"0.638558",
"0.6368018",
"0.6355396",
"0.6350103",
"0.6344648",
"0.63303983",
"0.6301572",
"0.6272887",
"0.6233129... | 0.6515767 | 9 |
Recursively merges dict2 into dict1 | def merge_dicts(dict1, dict2, custom_merge_func=None):
# type: (Any, Any, Optional[Callable[[str, Any, Any, Any], Any]]) -> Any
if not isinstance(dict1, dict) or not isinstance(dict2, dict):
return dict2
for k in dict2:
if k in dict1:
res = None
if custom_merge_func:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge_dicts(d1, d2):\n for key, value in d2.items():\n if key in d1:\n if isinstance(d1[key], dict) and isinstance(value, dict):\n _merge_dicts(d1[key], value)\n continue\n d1[key] = value",
"def _merge_dicts(dict1, dict2, path=None):\n if path is... | [
"0.7955589",
"0.79223824",
"0.7905807",
"0.7891808",
"0.78137326",
"0.7750845",
"0.7599099",
"0.75727713",
"0.75088084",
"0.75088084",
"0.74713856",
"0.7467959",
"0.7399142",
"0.73555255",
"0.7351608",
"0.7299126",
"0.7270481",
"0.72687936",
"0.7255596",
"0.724556",
"0.720741... | 0.76131135 | 6 |
Fixture which allows to have an isolated inmemory configuration file instance which is not persisted after exiting the fixture. This override works only in tests which use config calls directly, not in the ones working via the API, as the server config is not changed. | def file_config_mock(request):
from unittest import mock
from rucio.common.config import Config, config_set, config_has_section, config_add_section
# Get the fixture parameters
overrides = []
params = __get_fixture_param(request)
if params:
overrides = params.get("overrides", overrides)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config():\n from .. import config\n\n _old_fs = os.getenv('FREESURFER_HOME')\n if not _old_fs:\n os.environ['FREESURFER_HOME'] = mkdtemp()\n\n filename = Path(pkgrf('fmriprep', 'data/tests/config.toml'))\n settings = loads(filename.read_text())\n for sectionname, configs in settin... | [
"0.68572384",
"0.68024707",
"0.67448837",
"0.6708275",
"0.6573832",
"0.6493411",
"0.63244575",
"0.629747",
"0.6227993",
"0.6181613",
"0.6161833",
"0.61605275",
"0.6159928",
"0.6133413",
"0.6103953",
"0.6089158",
"0.6066062",
"0.60482967",
"0.60181063",
"0.60088384",
"0.600827... | 0.63549834 | 6 |
Create a symbolic representation of a neural network with `intput_dim` input nodes, `output_dim` output nodes and `num_hidden_units` per hidden layer. The training function of this model must have a minibatch size of `batch_size`. A theano expression which represents such a network is returned. | def model(input_shape, output_dim, num_hidden_units,num_hidden_units_2, num_code_units, filter_size, batch_size=BATCH_SIZE):
shape = tuple([None]+list(input_shape[1:]))
print(shape)
l_in = lasagne.layers.InputLayer(shape=shape)
print("Input shape: ",lasagne.layers.get_output_shape(l_in)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neural_network(z, dim_out):\n hidden_dim = 15\n net1 = slim.fully_connected(z, hidden_dim, activation_fn=None)\n net2 = slim.fully_connected(net1, dim_out, activation_fn=tf.tanh)\n return net2",
"def build_mlp(input_placeholder, output_size, scope, n_layers, size, activation=tf.tanh, output_activ... | [
"0.6677349",
"0.63641995",
"0.63397634",
"0.63344485",
"0.6310874",
"0.62955785",
"0.6284026",
"0.6240737",
"0.6230628",
"0.62106496",
"0.61926675",
"0.61831915",
"0.6096909",
"0.6028522",
"0.6002715",
"0.5981004",
"0.59762573",
"0.5971294",
"0.59666836",
"0.59464973",
"0.593... | 0.5844898 | 29 |
Gets the current height of the block chain. | def height(self):
return self.client.call('GET', self.name + 'height') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_height(self) -> int:\n return self.current_height",
"def get_height(self):\n return self.__height",
"def get_height(self):\n return self._height",
"def get_height(self):\n return self._height",
"def get_height(self):\n return self._height",
"def get_heig... | [
"0.7698598",
"0.73720944",
"0.7370557",
"0.7370557",
"0.7370557",
"0.7370557",
"0.73291564",
"0.7296799",
"0.7296799",
"0.7296799",
"0.7274973",
"0.72705775",
"0.72258914",
"0.7222025",
"0.71950066",
"0.71939987",
"0.71939987",
"0.71939987",
"0.71939987",
"0.71939987",
"0.719... | 0.7160527 | 39 |
Gets a block from the chain that has the given height. If the block with the specified height cannot be found in the database, NIS will return a JSON error object. | def at_public(self, block_height):
return self.client.call('POST', 'block/at/public', payload={
'height': block_height
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_at_height(height, headers):\n if height == 0:\n print('retrieving genesis block...')\n return GENESIS_DICTIONARY\n\n else:\n height_bottom = headers[0]['height'] # TODO can pass in height_bottom as an argument to save recompute\n result = hea... | [
"0.76337117",
"0.73324215",
"0.7283678",
"0.7279889",
"0.71485955",
"0.69237685",
"0.6770384",
"0.67582065",
"0.6742776",
"0.67281336",
"0.66896886",
"0.668445",
"0.656166",
"0.6470748",
"0.6397368",
"0.6264807",
"0.62340134",
"0.6229064",
"0.6226051",
"0.62204444",
"0.617060... | 0.52596045 | 70 |
Requests the chain height from every node in the active node list and returns the maximum height seen. In case the node has not been booted yet, NIS will return a JSON error object. | def max_chain_height(self):
return self.client.call('GET',
self.name + 'active-peers/max-chain-height') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _height(self, node):\n if node.value is not None and not node.nodes:\n return node.height\n elif node.value is not None and node.nodes:\n return max(flatten([node.height, ] +\n map(self._height, node.nodes.values())))\n elif node.value is... | [
"0.68319684",
"0.6465309",
"0.6297922",
"0.6203093",
"0.614153",
"0.61317945",
"0.61278087",
"0.6122855",
"0.6043672",
"0.60223407",
"0.60080594",
"0.59487",
"0.59428215",
"0.5899491",
"0.58711404",
"0.57808805",
"0.57459044",
"0.57323635",
"0.57300353",
"0.57110506",
"0.5690... | 0.72689503 | 0 |
Gets the namespace with given id. | def namespace(self, namespace):
return self.client.call('GET',
self.name, params={'namespace': namespace}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNamespacePath(self, id: long) -> unicode:\n ...",
"def namespace_id_to_name(self, ns_id, all=False):\n try:\n if all:\n return self._namespaces[ns_id]\n else:\n return self._namespaces[ns_id][0]\n except KeyError:\n e = \"... | [
"0.71565926",
"0.6610915",
"0.6161961",
"0.6130003",
"0.5918505",
"0.5895534",
"0.5827185",
"0.5736784",
"0.5669741",
"0.56681895",
"0.56561065",
"0.56506526",
"0.5591167",
"0.5573754",
"0.5567165",
"0.555966",
"0.5469768",
"0.5463284",
"0.54599905",
"0.5434206",
"0.53773785"... | 0.59006774 | 5 |
Gets an audit collection of outgoing calls. You can monitor the outstanding and recent outgoing requests with this information. | def connections_outgoing(self):
return self.client.call('GET', self.name + 'connections/outgoing') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_auditlogs(self):\n res = self.get_object(\"/integrationServices/v3/auditlogs\")\n return res.get(\"notifications\", [])",
"def calls(self):\r\n return calls.Calls(self)",
"def getOutageHistory(self):\n return self._OutageHistory",
"def outgoing_caller_ids(self):\r\n ... | [
"0.5880125",
"0.5739649",
"0.5694943",
"0.56410474",
"0.55779296",
"0.552998",
"0.5406403",
"0.5326707",
"0.52545446",
"0.52218795",
"0.5213842",
"0.51800615",
"0.51409405",
"0.51348984",
"0.5015265",
"0.50151485",
"0.5012773",
"0.5002334",
"0.49872288",
"0.49606916",
"0.4957... | 0.58743024 | 1 |
Sets the address_txs of this AddressTxs. | def address_txs(self, address_txs):
if address_txs is None:
raise ValueError("Invalid value for `address_txs`, must not be `None`")
self._address_txs = address_txs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_txs(self):\n return self._address_txs",
"def addresses(self, addresses: \"List[str]\"):\n self._attrs[\"addresses\"] = addresses",
"def addresses(self, addresses: \"List[str]\"):\n self._attrs[\"addresses\"] = addresses",
"def addresses(self, addresses: \"List[str]\"):\n ... | [
"0.67103106",
"0.627279",
"0.627279",
"0.627279",
"0.58619",
"0.563561",
"0.56108737",
"0.55193025",
"0.53204703",
"0.52825093",
"0.5198595",
"0.5196371",
"0.5188511",
"0.5182996",
"0.5091491",
"0.50475854",
"0.50410074",
"0.5034687",
"0.4995494",
"0.4987398",
"0.4955234",
... | 0.8438663 | 0 |
Removes assigned IP block (as it only supports one for now) If force is False, blocks that have any addresses currently allocated will not be removed. Otherwise, if force is True, the indicated blocks will be removed regardless of whether any addresses have been allocated and any allocated addresses will no longer be s... | def remove_ip_blocks(
self, ipblocks: List[IPNetwork],
force: bool = False,
) -> List[IPNetwork]:
if self._assigned_ip_block not in ipblocks:
return []
if not force:
allocated_ip_block_set = self._store.ipv6_state_map.get_allocated_ip_block_set()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_item(self, usage_locator, user_id, force=False): # lint-amnesty, pylint: disable=arguments-differ\n if not isinstance(usage_locator, BlockUsageLocator) or usage_locator.deprecated:\n # The supplied UsageKey is of the wrong type, so it can't possibly be stored in this modulestore.\n ... | [
"0.5939767",
"0.5938632",
"0.56954473",
"0.56054527",
"0.55543953",
"0.55501753",
"0.5495851",
"0.544292",
"0.5290664",
"0.52457166",
"0.52143854",
"0.5211263",
"0.5097896",
"0.5064577",
"0.50482243",
"0.50213253",
"0.49973372",
"0.49596322",
"0.49533314",
"0.49437845",
"0.49... | 0.7909288 | 0 |
Test simple authentication error. | def test_simple_auth_error(self):
client = LDAPClient(self.url)
client.set_credentials("SIMPLE", ("cn=wrong", "wronger"))
self.assertRaises(bonsai.AuthenticationError, client.connect) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_failure(self):\n \n result = self.authenticator.authenticate(\n username=u'thruflo', \n password=u'wrong'\n )\n self.assertTrue(result is None)",
"def test_valid_login_form_but_failed_authentication(self):\n\n\n\t\tpass",
"def test_auth_neg(self):\n ... | [
"0.8160639",
"0.7902072",
"0.78756416",
"0.7854512",
"0.7853043",
"0.78114414",
"0.7806747",
"0.77066267",
"0.77066267",
"0.769299",
"0.76880956",
"0.7650529",
"0.7629429",
"0.76141727",
"0.75927913",
"0.7539589",
"0.75344485",
"0.75258625",
"0.74972916",
"0.7496218",
"0.7488... | 0.7740019 | 7 |
Convert magnitude to AB magnitude | def convert_to_abmag(value, name):
mag_constants = {
'tmassJmag': 0.90,
'tmassHmag': 1.37,
'tmassKsMag': 1.85,
'SDSSuMag': 0.0,
'SDSSgMag': 0.0,
'SDSSrMag': 0.0,
'SDSSiMag': 0.0,
'SDSSzMag': 0.0,
'JpgMag': -0.055,
'FpgMag': 0.24,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(a):\n return dot_product(a, a)**0.5",
"def magtoflux(_mag, _id):\n return math.pow(10, -0.4*(_mag + VegaToAB[_id] - 8.9))",
"def AB_zero_mag(self):\n if self.wavelength_unit is None:\n raise AttributeError('Needs wavelength units')\n\n C1 = (Unit(self.wavelength_uni... | [
"0.67562544",
"0.6364612",
"0.62620175",
"0.622684",
"0.5995404",
"0.59550416",
"0.5898912",
"0.58955497",
"0.588089",
"0.58797747",
"0.5833462",
"0.58331496",
"0.58265626",
"0.5806616",
"0.57999116",
"0.57599926",
"0.5759203",
"0.57434416",
"0.5739705",
"0.57364446",
"0.5704... | 0.6649778 | 1 |
Returns the given HTML with all tags stripped. | def strip_tags(value):
return re.sub(r'<[^>]*?>', '', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stripHTMLTags (html):\r\n import re\r\n text = html\r\n \r\n # apply rules in given order!\r\n rules = [\r\n { r'>\\s+' : u'>'}, # remove spaces after a tag opens or closes\r\n { r'\\s+' : u' '}, # replace consecutive spaces\r\n { r'\\s*<br\\s*/?>\\s*' : u'\\n'},... | [
"0.8138946",
"0.8109891",
"0.810231",
"0.8100899",
"0.80280966",
"0.7989464",
"0.79603654",
"0.78888774",
"0.788333",
"0.78830826",
"0.78644603",
"0.7843869",
"0.7843869",
"0.7841764",
"0.78237224",
"0.7817937",
"0.77888054",
"0.7782822",
"0.7782822",
"0.77559096",
"0.7739701... | 0.67446905 | 69 |
Creates a matrix filled with zeros. | def zeros_matrix(rows, cols):
M = []
while len(M) < rows:
M.append([])
while len(M[-1]) < cols:
M[-1].append(0.0)
return M | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",
"def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in range(width):\n newrow = [0] * height\n returnvalue.addRow(*newrow)\n return returnvalue",
"def ze... | [
"0.83105844",
"0.82251585",
"0.8177624",
"0.814171",
"0.80738527",
"0.8053129",
"0.7960837",
"0.7792159",
"0.7705187",
"0.7678834",
"0.76101226",
"0.7580145",
"0.74690133",
"0.7464018",
"0.7462307",
"0.74617356",
"0.7240482",
"0.7231481",
"0.718796",
"0.71302176",
"0.70924646... | 0.7950135 | 8 |
Checks the equality of two matrices. | def check_matrix_equality(A,B, tol=None):
if len(A) != len(B) or len(A[0]) != len(B[0]):
return False
for i in range(len(A)):
for j in range(len(A[0])):
if tol == None:
if abs(A[i][j] - B[i][j]) > 1e-10:
return False
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsEqual(*args, **kwargs):\n return _gdi_.GraphicsMatrix_IsEqual(*args, **kwargs)",
"def _are_matrix_elements_equal(element, another_element):\n difference = sympy.N(sympy.expand(element) - sympy.expand(another_element))\n\n try:\n return np.allclose(\n float(sympy.re(difference... | [
"0.7714554",
"0.740203",
"0.7387387",
"0.73428464",
"0.73169017",
"0.7311009",
"0.7276583",
"0.7269618",
"0.7231773",
"0.71865493",
"0.7137955",
"0.71372896",
"0.7098439",
"0.7072754",
"0.7070013",
"0.7067749",
"0.70479655",
"0.69766957",
"0.69462913",
"0.6940412",
"0.693163"... | 0.7398573 | 2 |
L1norm of a vector. | def l1_norm(v):
res = 0
for e in v:
res += abs(e)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l1(vec):\n return np.linalg.norm(vec, ord=1)",
"def l1_norm(f):\n return dmp_l1_norm(f.rep, f.lev, f.dom)",
"def l1_norm(vec):\n res = sum(abs(float(x)) for x in vec.values())\n return res",
"def func_val_l1_norm(w):\n\treturn np.linalg.norm(w,ord = 1)",
"def normalise1D(*vector):\n\n ... | [
"0.9103843",
"0.8192758",
"0.810895",
"0.8001383",
"0.78128934",
"0.7798467",
"0.77959925",
"0.7714896",
"0.76301044",
"0.7540783",
"0.75042504",
"0.7388181",
"0.72909045",
"0.7280093",
"0.72323036",
"0.72279674",
"0.7182461",
"0.715058",
"0.71115243",
"0.70706004",
"0.706851... | 0.856022 | 1 |
L2norm of a vector. | def l2_norm(v):
res = 0
for e in v:
res += e * e
return math.sqrt(res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2(vec):\n return np.linalg.norm(vec)",
"def norm_l2(v):\n return np.sqrt((v**2).sum())",
"def norm_l2(u):\n return linalg.norm(u.ravel())",
"def l2norm(X):\n norm = np.linalg.norm(X, axis=1, keepdims=True)\n return 1.0 * X / norm",
"def l2_norm(vec_or_matrix):\n if len(vec_or_mat... | [
"0.8957043",
"0.8518496",
"0.8318099",
"0.82683444",
"0.8182556",
"0.8119852",
"0.8069992",
"0.8067408",
"0.800764",
"0.79987574",
"0.78410333",
"0.7818018",
"0.77782995",
"0.775152",
"0.77224255",
"0.77148014",
"0.7711236",
"0.7711236",
"0.7711236",
"0.76835793",
"0.7682921"... | 0.88052756 | 1 |
Tokenizes code into a list of CuBERT sentences. | def code_to_cubert_sentences(
code,
initial_tokenizer,
subword_tokenizer,
):
tokens = initial_tokenizer.tokenize(code)[:-1] # type: List[Text]
logging.vlog(5, 'Code >>>%s<<< is tokenized into >>>%s<<<.', code, tokens)
# This will split the list into sublists of non-NEWLINE tokens (key is
# False) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize_for_bleu_eval(self, code):\n code = re.sub(r'([^A-Za-z0-9_])', r' \\1 ', code)\n code = re.sub(r'([a-z])([A-Z])', r'\\1 \\2', code)\n code = re.sub(r'\\s+', ' ', code)\n code = code.replace('\"', '`')\n code = code.replace('\\'', '`')\n tokens = [t for t in co... | [
"0.6863243",
"0.67525357",
"0.67525357",
"0.669251",
"0.6580094",
"0.65743464",
"0.6467367",
"0.64577",
"0.63880205",
"0.6343771",
"0.62983996",
"0.62966585",
"0.6272456",
"0.6251971",
"0.62455213",
"0.6221313",
"0.61965567",
"0.6195651",
"0.61892426",
"0.61888105",
"0.616274... | 0.7083132 | 0 |
Convenience method to retrieve set of records as Spark DataFrame | def get_job_as_df(spark, job_id, remove_id=False):
pipeline = json.dumps({'$match': {'job_id': job_id}})
mdf = spark.read.format("com.mongodb.spark.sql.DefaultSource")\
.option("uri", "mongodb://%s" % settings.MONGO_HOST)\
.option("database", "combine")\
.option("collection", "record")\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qset_to_df(qset, datatype='object'):\n df = pd.DataFrame(list(qset.values()), dtype=datatype)\n return df",
"def spark_df_to_records(df):\n return [tuple(r) for r in df.collect()]",
"def pd(self, *args, **kwargs):\n return pd.DataFrame.from_records(self.aslist(), *args, **kwargs)",
"def dat... | [
"0.6874762",
"0.67645144",
"0.6537734",
"0.6515892",
"0.6470557",
"0.6428499",
"0.6179536",
"0.61614597",
"0.61406046",
"0.6136869",
"0.61283815",
"0.6064281",
"0.60510206",
"0.6005521",
"0.5992337",
"0.5990479",
"0.5971488",
"0.5949681",
"0.59414095",
"0.5937641",
"0.5907337... | 0.0 | -1 |
Shortcut to test "total population" field from the P1 (race) table since this table exists for both 2000 and 2010. | def _test_totalpop(self, obj, known_2000, known_2010):
known_delta = known_2010 - known_2000
known_pct = float(known_delta) / float(known_2000)
self.assertEqual(float(obj['data']['2000']["P1"]['P001001']), known_2000)
self.assertEqual(float(obj['data']['2010']["P1"]['P001001']), known_2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_county(self):\n counties = self.geographies.find({ 'geoid': '15009' })\n\n self.assertEqual(counties.count(), 1)\n\n county = counties[0]\n\n self.assertEqual(county['sumlev'], config.SUMLEV_COUNTY)\n self.assertEqual(county['metadata']['NAME'], 'Maui County')\n s... | [
"0.5652595",
"0.5537479",
"0.55229443",
"0.55086374",
"0.54755175",
"0.53278923",
"0.5322063",
"0.53090984",
"0.5220111",
"0.5202973",
"0.51130104",
"0.51096696",
"0.5104361",
"0.5068363",
"0.5034627",
"0.5024377",
"0.50120425",
"0.50120425",
"0.49283358",
"0.49250224",
"0.49... | 0.6115375 | 0 |
creates an instance according to dictionary | def create(cls, **dictionary):
if cls.__name__ == 'Rectangle':
dummy = cls(1, 1)
elif cls.__name__ == 'Square':
dummy = cls(1)
dummy.update(**dictionary)
return dummy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)",
"def from_dict(cls, dct):\n return cls(**dct)",
"def _from_dict(cls, _dict):\n ... | [
"0.8319628",
"0.8319628",
"0.7552757",
"0.7533553",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"0.7414422",
"... | 0.0 | -1 |
Get the layer identifiers of the network layers. | def get_layer_ids(self, include_input = True):
layers = self.net.blobs.keys()
if not include_input:
layers = layers[1:]
return layers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_names(self):\n return self._layer_names",
"def getLayerNames(self):\n\t\treturn self._fileSystem.getLayerNames()",
"def get_layer_ids(\n self,\n ):\n name_to_id = {}\n for n, _ in self.named_parameters():\n name_to_id[n] = 0\n return name_to_id",
"de... | [
"0.7665354",
"0.7556004",
"0.73628604",
"0.7221689",
"0.70648915",
"0.69622135",
"0.6921894",
"0.68877995",
"0.6855709",
"0.68437696",
"0.68299043",
"0.6828836",
"0.6798301",
"0.6783592",
"0.6777249",
"0.67631555",
"0.67354053",
"0.67091215",
"0.6681927",
"0.6678638",
"0.6614... | 0.73892903 | 2 |
Get all marks for a student | def get_marks() -> Union[str, Response]:
studentid_ = request.args.get("id")
marks = Marks.query.get(studentid_)
return render_template("marks.html", marks=marks, id=studentid_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def students(self):\n\t\treturn self.grade_set.all().distinct()",
"def get_students(self) -> List['Student']:\n return self.students.values()",
"def list(self, request):\n\n marks = Marks.objects.all()\n\n mark_id_not_appointed = marks.filter(name='Неявка')\n\n records = filter_agai... | [
"0.6977941",
"0.6782979",
"0.6760504",
"0.6710309",
"0.67101634",
"0.66821915",
"0.66705525",
"0.66550684",
"0.6632196",
"0.6598747",
"0.6597735",
"0.65887266",
"0.6547072",
"0.6538285",
"0.6516437",
"0.6514306",
"0.64951736",
"0.6415864",
"0.64110035",
"0.6409197",
"0.639799... | 0.6747031 | 3 |
apply sigmoid function on t. | def sigmoid(t):
empty = np.empty(t.shape)
empty[t > 0] = 1/(1+ np.exp(-t[t>0]))
empty[t <= 0 ] = np.exp(t[t<=0])/(1+np.exp(t[t<=0]))
return empty | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(t):\n return np.exp(t)/(1+np.exp(t))",
"def sigmoid(t):\n sig=np.exp(t)/(1+np.exp(t))\n return sig",
"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.9084493",
"0.9020642",
"0.9009438",
"0.89938635",
"0.87019694",
"0.84522074",
"0.82452095",
"0.8217517",
"0.8187859",
"0.8187859",
"0.8177547",
"0.816389",
"0.8141619",
"0.8141619",
"0.8141619",
"0.8141619",
"0.8141619",
"0.8141619",
"0.8134758",
"0.8129746",
"0.81269675",... | 0.83401215 | 6 |
Returns an integer codifying the actual day and time Because we only model a week, the effective maximum value is 90060 | def raw(self):
return self.day*60*24 + self.hour*60 + self.minute | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unit_day(self):\n return (self.time_base * 60.0) * 24.0",
"def scaledTime():\n #return (time.gmtime().tm_wday, time.gmtime().tm_hour)\n epoch = time.strptime(\"2013-02-21 11:30:00\", \"%Y-%m-%d %H:%M:%S\")\n timeInSec = time.mktime(time.gmtime()) - time.mktime(epoch)\n hourSince = timeInS... | [
"0.6822729",
"0.6800442",
"0.671761",
"0.6645342",
"0.6588621",
"0.65614766",
"0.6522636",
"0.64839315",
"0.6381843",
"0.6367486",
"0.6346273",
"0.63235843",
"0.6287894",
"0.62772983",
"0.62772983",
"0.62371236",
"0.62271863",
"0.62144136",
"0.6200029",
"0.6178101",
"0.614856... | 0.5741346 | 37 |
Returns the equivalent timestamp of just the day | def day_ts(self):
return self.raw() // (60 * 24) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())",
"def get_timestamp(self, days=1):\n offset = datetime.datetime.utcnow().date() - datetime.timedelta(days=days-1)\n # est = tz.gettz('Europe/Amsterdam')\n # temporary ... | [
"0.67507184",
"0.6686723",
"0.66458243",
"0.66195476",
"0.6554564",
"0.651344",
"0.6512791",
"0.6455556",
"0.6454444",
"0.6416096",
"0.64133775",
"0.6387338",
"0.6334385",
"0.63157105",
"0.63127744",
"0.6266428",
"0.6238006",
"0.6220144",
"0.6213184",
"0.61673725",
"0.6166025... | 0.76245064 | 0 |
Returns the full name of element being monitored by the active Monitor. | def monitors_read_element(self) -> str:
result = ctypes.c_char_p(self.dss_obj.MonitorsS(ctypes.c_int32(3), ctypes.c_int32(0)))
return result.value.decode('ascii') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getElementName(self):\n return _libsbml.Event_getElementName(self)",
"def getElementName(self):\n return _libsbml.Port_getElementName(self)",
"def getElementName(self):\n return _libsbml.Compartment_getElementName(self)",
"def getElementName(self):\n return _libsbml.SBase_getE... | [
"0.7450548",
"0.7423249",
"0.7340012",
"0.73263264",
"0.7272811",
"0.72024053",
"0.7173537",
"0.71433705",
"0.7129742",
"0.7111007",
"0.70952076",
"0.70849293",
"0.70838827",
"0.70769614",
"0.701259",
"0.700048",
"0.6998356",
"0.6996207",
"0.69908535",
"0.6989184",
"0.6982886... | 0.66672796 | 53 |
Sets the full name of element being monitored by the active Monitor. | def monitors_write_element(self, argument) -> str:
result = ctypes.c_char_p(self.dss_obj.MonitorsS(ctypes.c_int32(4), argument.encode('ascii')))
return result.value.decode('ascii') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setName(self, name):\n self.name = str(name)",
"def set_name(self, name):\n\t\tself.name_ = name",
"def setName(self, name):\n self._name = name",
"def setName(self, name):\n self._name = name",
"def set_name(self, newname=\"\"):\n self.name = newname",
"def setName(self, ... | [
"0.698972",
"0.69490653",
"0.6934929",
"0.6934929",
"0.69271183",
"0.69211125",
"0.6878148",
"0.6878148",
"0.6878148",
"0.6878148",
"0.6835848",
"0.68147045",
"0.68110657",
"0.6795679",
"0.678603",
"0.67782116",
"0.67782116",
"0.67782116",
"0.67782116",
"0.67782116",
"0.67709... | 0.0 | -1 |
Converts the rank to a ctrl_string for thresholding. | def _rank_to_ctrl_string(rank, length):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __rank_from_int_to_str(rank: int) -> str:\n return str(rank + 1)",
"def __str__(self):\n return str(self.rank)",
"def _threshold_to_control_string(self, threshold):\n # Make sure the threshold is ok\n if threshold < 0 or threshold > 1:\n raise ThresholdError(\"Argumen... | [
"0.6593619",
"0.6022002",
"0.56026626",
"0.5538748",
"0.53891945",
"0.5351683",
"0.5284331",
"0.52622",
"0.52310747",
"0.5225471",
"0.5217082",
"0.5201264",
"0.51567566",
"0.5155428",
"0.5123787",
"0.51021874",
"0.5084797",
"0.5050555",
"0.50300705",
"0.50247926",
"0.5008611"... | 0.8312594 | 0 |
Parsing a datetime into a pandas.Timestamp | def test_parse_date_from_datetime(self):
bxl = pytz.timezone('Europe/Brussels')
dt_ = bxl.localize(dt.datetime(2014, 11, 23, 1, 2, 3))
epoch = pytz.UTC.localize(dt.datetime(1970, 1, 1, 0, 0, 0))
epoch_expected = (dt_ - epoch).total_seconds()
pts = parse_date(dt_)
self.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_timestamp(ts):\n return DateTimeField()._to_python(ts)",
"def parse_timestamp(row):\n ts0 = pd.Timestamp(row['raw_timestamp_part_1'], unit='s')\n ts1 = pd.Timedelta(row['raw_timestamp_part_2'], unit='microseconds')\n return ts0 + ts1",
"def _pd_datetime_to_timestamp_proto(dtype, value) ->... | [
"0.66713554",
"0.66511303",
"0.64544904",
"0.64049304",
"0.6398411",
"0.63614136",
"0.6346307",
"0.6269649",
"0.6210043",
"0.6187754",
"0.61801153",
"0.61687887",
"0.6164123",
"0.6163249",
"0.6162522",
"0.6138763",
"0.6111186",
"0.60905814",
"0.60867035",
"0.607121",
"0.60709... | 0.0 | -1 |
Check the user is allowed to access the news index list | def test_news_index_has_perm(self):
self.assertStatusCode(self.url, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_staff_access(self):\r\n self.check_index_and_outline(self.client)",
"def can_view(self, user):\r\n return True",
"def test_news_index_no_perm(self):\n self.assertStatusCode(self.url, 403)",
"def has_super_access():\n current_user = frappe.get_doc('User', frappe.session.use... | [
"0.71869683",
"0.701034",
"0.6941104",
"0.6793444",
"0.67805856",
"0.67128044",
"0.66727525",
"0.66707075",
"0.66169983",
"0.6611218",
"0.65815014",
"0.65591043",
"0.6556533",
"0.6549251",
"0.6537417",
"0.6531668",
"0.65135354",
"0.65135354",
"0.65135354",
"0.64980245",
"0.64... | 0.72420925 | 0 |
Test user can not edit without permission | def test_no_permission(self):
self.assertStatusCode(self.url, 403) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_edit_perm(self):\n self.assertStatusCode(self.url, 403)",
"def test_handle_edit_not_admin(self):\n test_user = User(\"userid\")\n team = Team(\"BRS\", \"brs\", \"brS\")\n self.db.retrieve.return_value = test_user\n self.db.query.return_value = [team]\n with... | [
"0.8186143",
"0.78191847",
"0.7762394",
"0.7759971",
"0.77389044",
"0.7626638",
"0.7610116",
"0.75772184",
"0.75056833",
"0.7469706",
"0.74189234",
"0.7386552",
"0.73486775",
"0.7288264",
"0.72760946",
"0.7274553",
"0.7251353",
"0.72066283",
"0.7193407",
"0.7173011",
"0.71517... | 0.0 | -1 |
Test users can unpublish NewsItems | def test_has_permission(self):
self.assertStatusCode(self.url, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertContains(response, self.url)",
"def test_no_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', k... | [
"0.7390404",
"0.7325027",
"0.72067845",
"0.6946993",
"0.67321724",
"0.65183187",
"0.63950413",
"0.6372304",
"0.62763035",
"0.6249247",
"0.6227952",
"0.6131288",
"0.61038554",
"0.6050085",
"0.6009835",
"0.5970444",
"0.59577054",
"0.594893",
"0.594354",
"0.5930259",
"0.59085625... | 0.0 | -1 |
Test that the delete button appears on the index page | def test_delete_button_appears_index(self):
response = self.client.get(reverse('wagtailnews:index', kwargs={
'pk': self.index.pk}))
self.assertContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_custom_button(self):\n pass",
"def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertContains(response, self.url)",
"def test_no_delete_b... | [
"0.7964029",
"0.7892996",
"0.7400673",
"0.73430234",
"0.71478194",
"0.7119191",
"0.7053078",
"0.6989711",
"0.6853455",
"0.6781707",
"0.6727742",
"0.6702557",
"0.66956884",
"0.6683815",
"0.6649543",
"0.66001225",
"0.65985805",
"0.65659857",
"0.6558182",
"0.6522168",
"0.6506768... | 0.81418383 | 0 |
Test that the delete button appears on the edit page | def test_delete_button_appears_edit(self):
response = self.client.get(reverse('wagtailnews:edit', kwargs={
'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))
self.assertContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_custom_button(self):\n pass",
"def test_no_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertNotContains(response, self.url)",
"def test_comme... | [
"0.8166414",
"0.7414952",
"0.723374",
"0.7127024",
"0.6995213",
"0.68870395",
"0.6840543",
"0.67911434",
"0.6724883",
"0.6652456",
"0.66225034",
"0.65894556",
"0.655768",
"0.6549066",
"0.6507977",
"0.6503928",
"0.6462864",
"0.6460414",
"0.64468193",
"0.64352983",
"0.637209",
... | 0.82615966 | 0 |
Quantify the rhythmicity of an oscillation using lagged coherence. | def lagged_coherence(sig, f_range, fs, n_cycles=3, f_step=1, return_spectrum=False):
# Identify Fourier components of interest
freqs = np.arange(f_range[0], f_range[1] + f_step, f_step)
# Calculate lagged coherence for each frequency
lc = np.zeros(len(freqs))
for ind, freq in enumerate(freqs):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_strehl(self):\n\n self.strehl = np.exp(-1*((2*np.pi/self.science_wavelength)*self.high_order_wfe)**2)",
"def rochelobe(q):\n return 0.49*q**(2./3)/(0.6*q**(2./3) + log(1+q**(1./3)))",
"def soundspeed(temp,pres):\n g_p = liq_g(0,1,temp,pres)\n g_tt = liq_g(2,0,temp,pres)\n g_tp... | [
"0.5506311",
"0.54322857",
"0.54039633",
"0.53244144",
"0.5197453",
"0.51922834",
"0.5187615",
"0.5161913",
"0.5131058",
"0.5111093",
"0.50948024",
"0.5079271",
"0.5075758",
"0.5067517",
"0.50656",
"0.5057913",
"0.5053487",
"0.5033692",
"0.5029003",
"0.50254285",
"0.5017855",... | 0.0 | -1 |
Terminate the connection between the specified analytic and the video source. Does not terminate the service, so the service will still accept new configuration requests. | def kill(ctx, analytic_host, analytic_port):
client = aceclient.ConfigClient(host=analytic_host, port=analytic_port)
client.kill() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_advertising(self):\n self._periph.stop_advertising()",
"def __del__(self):\n try:\n self.api.transport.session.close()\n except Exception as e:\n log.debug(f\"Failed to close VSO API connection with: {e}\")",
"def terminate(self):\r\n for call in self.... | [
"0.605665",
"0.5903019",
"0.5880774",
"0.587189",
"0.5814706",
"0.56979114",
"0.5695248",
"0.56684774",
"0.56481856",
"0.56481856",
"0.56199515",
"0.55669135",
"0.5565821",
"0.5560698",
"0.55319697",
"0.54918116",
"0.5473794",
"0.5461876",
"0.5455388",
"0.54313624",
"0.542883... | 0.6198811 | 0 |
Here we have to return the item requested by `idx` The PyTorch DataLoader class will use this method to make an iterable for our training or validation loop. | def __getitem__(self, idx):
img = self.images[idx]
label = self.labels[idx].split(" ")[-1]
img = Image.open(img)
img = img.convert('RGB')
img = self.transform(img)
return(img, label[:-1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\r\n\r\n # Generate indexes of the batch\r\n indexes = self.indexes[index * self.batch_size:(index + 1) * self.batch_size]\r\n\r\n # Find list of IDs\r\n list_ids_temp = [self.list_IDs[k] for k in indexes]\r\n\r\n # Calls function to load batch of dat... | [
"0.74892426",
"0.73380893",
"0.7252037",
"0.7252037",
"0.7225515",
"0.7225515",
"0.72105503",
"0.7205475",
"0.71967584",
"0.7196699",
"0.7186608",
"0.7160526",
"0.70343167",
"0.70343167",
"0.69605625",
"0.695354",
"0.69118977",
"0.6877463",
"0.6862981",
"0.6838847",
"0.683674... | 0.0 | -1 |
Build a heap from any list | def heapify(self, not_a_heap, show_details=False):
self._heap = not_a_heap[:]
cur_idx = len(self._heap) // 2 - 1
while cur_idx >= 0:
self._perc_down(cur_idx)
cur_idx = cur_idx - 1
if show_details:
print(self._heap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_max_heap(self, list_to_be_heap):\n self.heaplist = self.heaplist + list_to_be_heap\n self.currentsize = len(list_to_be_heap)\n\n # as it follow properties of complete binary tree, non leaf nodes will end to total size / 2\n index = self.currentsize // 2\n\n # > 0 : to i... | [
"0.76261926",
"0.7623257",
"0.76100385",
"0.75984156",
"0.7476745",
"0.7468826",
"0.7464773",
"0.74451417",
"0.7419377",
"0.7419377",
"0.73608005",
"0.7357161",
"0.72729564",
"0.7228793",
"0.7202468",
"0.71796215",
"0.7140627",
"0.700787",
"0.6988573",
"0.69858456",
"0.694692... | 0.0 | -1 |
Generates negative 2D bounding boxes. This is computed in a semibrute force fashion. For any given bounding box, we first try to calculate the desired shift based on the selected IoU. If this failes, we just randomly shift the centroid and generate new bounding boxes. If it lies within the desired IoU threshold bound, ... | def calculate_negative_2d_bb(obj_label,
boxes2d,
iou_threshold_min,
iou_threshold_max,
samples,
rand_sampl=False):
x1 = obj_label.x1
y1 = obj_label.y1
x2 = obj_la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_negative_3d_bb(obj_label,\n boxes3d,\n iou_threshold_min,\n iou_threshold_max,\n samples):\n box_corners = od.compute_box_corners_3d(obj_label)\n # make sure this is not empty\n assert(... | [
"0.69121605",
"0.6865389",
"0.6467625",
"0.6369781",
"0.62754124",
"0.6056862",
"0.6002797",
"0.5892907",
"0.5846243",
"0.5825292",
"0.5823235",
"0.580352",
"0.5802652",
"0.5774881",
"0.57701665",
"0.5769676",
"0.5751968",
"0.5746477",
"0.5703305",
"0.5696509",
"0.56963754",
... | 0.7597889 | 0 |
Generates negative 2D bounding boxes. This is computed in a brute force fashion. For any given bounding box, we randomly shift the centroid and generate new bounding boxes and if it lies within the desired IoU threshold bound, we will keep it. Otherwise it is thrown out and this is repeated until number of valid sample... | def generate_negative_2d_bb(obj_label,
boxes2d,
iou_threshold_min,
iou_threshold_max,
samples):
x1 = obj_label.x1
y1 = obj_label.y1
x2 = obj_label.x2
y2 = obj_label.y2
diff_x = (x2 - x1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_negative_2d_bb(obj_label,\n boxes2d,\n iou_threshold_min,\n iou_threshold_max,\n samples,\n rand_sampl=False):\n\n x1 = obj_label.x1\n y1 = obj_label.y1\n ... | [
"0.7722662",
"0.71809816",
"0.674753",
"0.64723235",
"0.6354109",
"0.6349555",
"0.634271",
"0.63150364",
"0.6310376",
"0.6043694",
"0.60284215",
"0.6015984",
"0.6009575",
"0.5999829",
"0.59859705",
"0.59692276",
"0.59401596",
"0.59201664",
"0.5919447",
"0.59148026",
"0.589876... | 0.7171472 | 2 |
Generates negative 3D bounding boxes. This is the 3D version of generate_negative_3d_bb. | def generate_negative_3d_bb(obj_label,
boxes3d,
iou_threshold_min,
iou_threshold_max,
samples):
box_corners = od.compute_box_corners_3d(obj_label)
# make sure this is not empty
assert(len(box_corn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_negative_2d_bb(obj_label,\n boxes2d,\n iou_threshold_min,\n iou_threshold_max,\n samples,\n rand_sampl=False):\n\n x1 = obj_label.x1\n y1 = obj_label.y1\n ... | [
"0.6293331",
"0.6009182",
"0.5801561",
"0.5799778",
"0.5769917",
"0.57271326",
"0.5657494",
"0.5643734",
"0.5588344",
"0.5588344",
"0.5566045",
"0.55655116",
"0.55625165",
"0.55415875",
"0.55285263",
"0.54892945",
"0.5468024",
"0.5447369",
"0.5443272",
"0.54351157",
"0.542643... | 0.7253786 | 0 |
Add the amount of Water to the reserve | def findWater(self, found):
self.amount = max(0, self.amount + found) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def useWater(self, used):\n self.amount = max(0, self.amount - used)",
"def with_water(self, water):\n self.ingredients.append(water)\n return self",
"def add_to_water_level(self, amount):\n self.water_level += amount\n if self.water_level < 0:\n self.water_level =... | [
"0.678656",
"0.64859027",
"0.64751625",
"0.636471",
"0.63474596",
"0.6072444",
"0.6055405",
"0.60548395",
"0.60482985",
"0.59617096",
"0.59285605",
"0.58456117",
"0.5789698",
"0.57580453",
"0.57145965",
"0.5689935",
"0.56603473",
"0.56373537",
"0.5628167",
"0.55672455",
"0.55... | 0.63367224 | 5 |
plots the graph for life expectancy vs income category for the years from 1960 to 2015 | def income_graph(t0, t1, t2, t3):
medians0 = sorted(high_income_countries())
t3.goto(-250, ((2.5*medians0[0])-15))
t3.rt(90)
for idx in range(1, len(medians0)):
t3.pd()
t3.setpos((-250+(idx*8.8)), (2.5*medians0[idx])-25)
medians1 = sorted(low_income_countries())
t0.goto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def income_distribution_plot(income_data,year):\n income_year = income_data.loc[year]\n plt.figure(figsize=(10,8))\n income_year.hist(bins=100,alpha=0.3,color='k')\n plt.title('Income Distribution of Year %s' % year)\n plt.xlabel('Income per person')\n plt.ylabel('Frequency')\n plt.savefig('In... | [
"0.7102294",
"0.6791818",
"0.66974103",
"0.66413957",
"0.65676576",
"0.63302284",
"0.63299006",
"0.6252672",
"0.6244726",
"0.6215606",
"0.6192069",
"0.6141037",
"0.59000665",
"0.58274305",
"0.5784233",
"0.5737825",
"0.57364583",
"0.57241774",
"0.56863356",
"0.56375414",
"0.56... | 0.0 | -1 |
Checks if the user has money. | def has_money(self) -> bool:
return self.money > 0.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_user_has_enough_money(session, user_id, amount):\n user_funds = get_user_balance(session, user_id)\n if user_funds + amount < 0:\n raise NotEnoughMoneyException(\"Not enough money in your wallet!\")",
"def balance_money_check():\r\n print(balance_money)",
"def positive_balance_check(u... | [
"0.72290194",
"0.70000076",
"0.6976345",
"0.67223203",
"0.6660722",
"0.6602281",
"0.6554564",
"0.65110725",
"0.6492368",
"0.6469948",
"0.64189357",
"0.6256046",
"0.6249659",
"0.62413937",
"0.62168956",
"0.6193624",
"0.6191508",
"0.6180676",
"0.615271",
"0.6132183",
"0.6107606... | 0.784849 | 0 |
Validates the image_info dictionary has all required information. | def _validate_image_info(ext, image_info=None, **kwargs):
image_info = image_info or {}
checksum_avail = False
md5sum_avail = False
os_hash_checksum_avail = False
for field in ['id', 'urls']:
if field not in image_info:
msg = 'Image is missing \'{}\' field.'.format(field)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_missing_info(self):\r\n self.validate(None, None,\r\n N_image_shape=(3, 2, 8, 8),\r\n N_filter_shape=(4, 2, 5, 5))\r\n self.validate((3, 2, None, None), None,\r\n N_image_shape=(3, 2, 8, 8),\r\n N_filter_shap... | [
"0.6829416",
"0.64101285",
"0.6372421",
"0.6283547",
"0.62626284",
"0.623681",
"0.61904836",
"0.6102994",
"0.6038631",
"0.6016138",
"0.5986248",
"0.59705144",
"0.59603906",
"0.59208983",
"0.589194",
"0.5877769",
"0.5828762",
"0.5828762",
"0.58162236",
"0.5749991",
"0.56880915... | 0.74150187 | 0 |
Map raw labels onto their numerical representation. | def vectorize_labels(self):
label_counter = Counter(self.raw_labels)
if 'oos' in label_counter:
label_counter.pop('oos')
unique_labels, label_cnts = zip(*sorted(label_counter.items()))
unique_labels, label_cnts = list(unique_labels), list(label_cnts)
label_vocab = {la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertLabels(self, labels):\n counter = 0\n numericLabels = []\n for label in labels:\n if label not in self.labelDict:\n self.labelDict[label] = counter\n self.backwards_conversion[counter] = label\n counter += 1\n numeri... | [
"0.7552026",
"0.673033",
"0.65772784",
"0.65754217",
"0.6574145",
"0.652427",
"0.6432568",
"0.6432568",
"0.64288896",
"0.6390633",
"0.6351704",
"0.6344979",
"0.63178086",
"0.62096834",
"0.6207216",
"0.6198722",
"0.61695147",
"0.6168775",
"0.615346",
"0.6135756",
"0.6106407",
... | 0.56232923 | 60 |
Get train/dev/test split of the OOD dataset in the form suitable for transformer models. | def get_transformer_splits(loader_cls, tokenizer, return_intent_labels=True):
datasets = []
for subset in SUBSETS:
dataset = OODDataset(loader_cls(subset=subset), tokenizer.tokenize,
return_intent_labels)
dataset.vectorize_texts(tokenizer)
datasets.append(dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_split_data(self):\n X, y, _, _ = self.get_subsets()\n return train_test_split(X, y, test_size=0.3, random_state=42)",
"def dataset_splits(self):\n return [{\n \"split\": problem.DatasetSplit.TRAIN,\n \"shards\": 80,\n }, {\n \"split\": problem.DatasetSplit.EVAL,\n... | [
"0.73489857",
"0.7299666",
"0.7240295",
"0.6996687",
"0.69727206",
"0.6866645",
"0.6861226",
"0.68377197",
"0.68276453",
"0.6814517",
"0.680304",
"0.678786",
"0.6782424",
"0.6765372",
"0.67429614",
"0.67218626",
"0.6718416",
"0.6713332",
"0.67119724",
"0.67029387",
"0.6696772... | 0.0 | -1 |
Get loader class for a dataset. | def get_loader(dataset_name, **kwargs):
if dataset_name == "rostd":
loader = partial_class(ROSTDLoader,
data_root_dir="data/rostd",
use_coarse_labels=False)
elif dataset_name == "rostd_coarse":
loader = partial_class(ROSTDLoader,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loader(self):\n return self.loader_class()",
"def get_cls(dataset_name):\n return find_dataset_using_name(dataset_name)",
"def init_loader(dataset):\n if dataset == 'chaos':\n return ChaosLoader()\n return None",
"def get_data_loader(\n name: str, **kwargs) -> data_loader.DataLo... | [
"0.746107",
"0.6963209",
"0.6959952",
"0.68778324",
"0.665751",
"0.66192013",
"0.6553479",
"0.6545444",
"0.65317357",
"0.6488149",
"0.6470945",
"0.6427437",
"0.63847756",
"0.63402325",
"0.6329773",
"0.6324222",
"0.63233507",
"0.62848765",
"0.6283929",
"0.6254267",
"0.625302",... | 0.7470058 | 0 |
Return the start time of the simulation. | def get_start_time(settings: SimulationSettingsModel):
return settings.project.start_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"start_time\")",
"def start_time(self) -> float:\n return self._start_time",
"def start_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"start_time\")",
"def start_time(self):\n return se... | [
"0.8377511",
"0.83447194",
"0.8335398",
"0.8305851",
"0.8246277",
"0.8246277",
"0.8148698",
"0.8148698",
"0.8148698",
"0.8148698",
"0.8148698",
"0.8148698",
"0.8148698",
"0.8148698",
"0.80517",
"0.80485797",
"0.80266994",
"0.7996719",
"0.7996719",
"0.79724574",
"0.79643977",
... | 0.77836007 | 30 |
Return a loadshape dataframe representing all available data. This assumes that a loadshape has been selected in OpenDSS. | def create_loadshape_pmult_dataframe(settings: SimulationSettingsModel):
start_time = settings.project.loadshape_start_time
data = dss.LoadShape.PMult()
interval = timedelta(seconds=dss.LoadShape.SInterval())
npts = dss.LoadShape.Npts()
indices = []
cur_time = start_time
for _ in range(npts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_to_lay(self) -> pd.DataFrame:\n if not self.data_is_loaded:\n self.load_data()\n\n return self._available_to_lay",
"def dataframe(self):\n if not self.all_records:\n print('No rows cached.')\n return\n dict_list = [row.as_dict() for row i... | [
"0.6330568",
"0.6241007",
"0.623866",
"0.62355924",
"0.6206864",
"0.6149052",
"0.61322594",
"0.6111406",
"0.6104934",
"0.6099539",
"0.6048846",
"0.5989554",
"0.597556",
"0.5946196",
"0.59261596",
"0.5890683",
"0.5890246",
"0.58660966",
"0.5862521",
"0.58139795",
"0.5796813",
... | 0.6537646 | 0 |
Read filename into a pandas Dataframe and extract items in ids_df. It reads items (flights, positions or events) from filename into a pandas Dataframe and merges the items with ids_df on FLIGHT_ID as a UUID. It writes a copy of the Dataframe items WITHOUT mathing ids into a file called 'new_' + filename Returns a panda... | def extract_next_day_items(filename, ids_df, date_fields=[]):
# An empty data frame to return
new_items_df = pd.DataFrame()
next_df = pd.DataFrame()
try:
if date_fields:
next_df = pd.read_csv(filename, parse_dates=date_fields,
converters={'FLIGHT_ID... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_dataframe_with_new_ids(filename, ids_df, *, date_fields=['TIME']):\n df = pd.read_csv(filename, parse_dates=date_fields, memory_map=True)\n return pd.merge(ids_df, df, left_index=True, right_on='FLIGHT_ID')",
"def extract_overnight_data(filenames):\n day_ids_filename = filenames[0]\n\n fligh... | [
"0.7330701",
"0.5534461",
"0.54933244",
"0.5378836",
"0.52908814",
"0.52467626",
"0.5233091",
"0.52184945",
"0.5193366",
"0.5172495",
"0.51131463",
"0.51092166",
"0.50987095",
"0.509562",
"0.5085387",
"0.50284123",
"0.49850348",
"0.4975146",
"0.49732038",
"0.49651432",
"0.496... | 0.71169 | 1 |
The row principal coordinates. | def row_coordinates(self, X):
utils.validation.check_is_fitted(self, 's_')
return super().row_coordinates(
X=pd.concat(
(
X.select_dtypes(exclude=self.categorical_dtypes),
self.one_hot_.transform(X.select_dtypes(include=self.categorica... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def principal(self):\n s = [self.voigt[i] for i in range(6)]\n\n # calculate centers\n cxy = (s[0] + s[1]) / 2\n cyz = (s[1] + s[2]) / 2\n czx = (s[2] + s[0]) / 2\n\n # calculate radii\n rxy = ((s[0] - s[1])**2 + (2*s[3])**2)**(1/2) / 2\n ryz = ((s[1] - s[2])... | [
"0.65612423",
"0.61977327",
"0.6183964",
"0.6094005",
"0.60902977",
"0.6071574",
"0.6052542",
"0.6049814",
"0.6042885",
"0.6027983",
"0.59492373",
"0.5946421",
"0.5932701",
"0.5921994",
"0.5921964",
"0.58941716",
"0.58855975",
"0.58855975",
"0.58805096",
"0.58790445",
"0.5876... | 0.0 | -1 |
Return all leaf nodes of the graph Note that this does not necessarily mean that they will all be paragraphs We're returning all the nodes that do not have predecessors in the direct graph | def leaf_nodes(self, data=True):
leaf_nodes = [
node for node in self.graph.nodes()
if self.graph.in_degree(node) != 0 and self.graph.out_degree(node) == 0
]
for node in leaf_nodes:
yield (node, self.graph.node[node]) if data else node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaf_nodes(self):\n deps = set([\n item for sublist in self.edges.values() for item in sublist\n ]) # Now contains all nodes that contain dependencies.\n return (x for x in self.nodes if x not in deps) # Generator that\n # contains all nodes *without* any dependencies (... | [
"0.775657",
"0.7487987",
"0.7303196",
"0.7146874",
"0.70538235",
"0.68833375",
"0.663359",
"0.65542793",
"0.6508919",
"0.6458122",
"0.64562976",
"0.6455231",
"0.6405333",
"0.64006096",
"0.63531864",
"0.63287926",
"0.6294102",
"0.6271516",
"0.62543935",
"0.62504905",
"0.621953... | 0.6968675 | 5 |
get maximum depth of the graph | def _max_depth(self):
max_depth = 0
for node, data in self.traverse():
max_depth = max(max_depth, data['level'])
return max_depth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_depth(self) -> int:\n return pulumi.get(self, \"max_depth\")",
"def depth(self):\n return self._max_depth",
"def get_max_depth(self):\n return self.MAX_DEPTH",
"def max_depth(self) -> int:\n return 0",
"def depth(self):\n return max(n.depth for n in self.iternodes... | [
"0.82280046",
"0.82237023",
"0.8172066",
"0.81567633",
"0.8010133",
"0.79035956",
"0.7708579",
"0.7676142",
"0.75978315",
"0.7511025",
"0.75060564",
"0.7479909",
"0.7451953",
"0.742769",
"0.73627543",
"0.7344261",
"0.7339484",
"0.72891027",
"0.727792",
"0.7275108",
"0.7264026... | 0.81646323 | 3 |
Reads data from buffer or fileas pandas.DataFrame. Gets the same arguments like pandas.read_csv and pandas.read_xlsx.Uses proper function depending on file extension. | def read_data(file_name: str, buffer=None, **kwargs) -> pd.DataFrame:
file_name = file_name.strip()
extension = file_name.split('.')[-1].lower()
if extension in _read_methods.keys():
if not buffer:
if os.path.exists(os.path.dirname(file_name)):
data = _read_methods[ext... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read(**kwargs) -> DataFrame:\n Engine.subscribe(_update_engine)\n\n try:\n pd_obj = FactoryDispatcher.read_csv_glob(**kwargs)\n except AttributeError:\n raise AttributeError(\"read_csv_glob() is only implemented for pandas on Ray.\")\n\n # This happens when `read_csv` returns a TextF... | [
"0.68633926",
"0.68517303",
"0.67032105",
"0.6589057",
"0.6454073",
"0.6440621",
"0.6402511",
"0.6398542",
"0.6308621",
"0.6294428",
"0.62939626",
"0.6235024",
"0.62328905",
"0.6164969",
"0.61351067",
"0.6109234",
"0.6075392",
"0.6034535",
"0.60162234",
"0.60016567",
"0.59829... | 0.8271098 | 0 |
Returns all 3x3 slices of the board corresponding to neighbors for all cells on the board. | def get_all_neighbors(self):
m, n = self.board.shape
return as_strided(self.expanded_board,
shape = (m,n,3,3),
strides = self.expanded_board.strides + self.expanded_board.strides) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(i: int, j: int) -> np.array:\n k, l = (i//3)*3, (j//3)*3 # noqa E741\n return np.array([\n np.r_[i:i:8j, 0:i, i + 1:9, np.repeat(np.r_[k:i, i + 1:k + 3], 2)],\n np.r_[0:j, j + 1:9, j:j:8j, np.tile(np.r_[l:j, j + 1:l + 3], 2)],\n ], dtype=np.uint8)",
"def four_neighbors(self,... | [
"0.6740089",
"0.66890025",
"0.66793936",
"0.6594341",
"0.65792316",
"0.6524311",
"0.6460481",
"0.63912827",
"0.6384827",
"0.6378845",
"0.63124657",
"0.6298454",
"0.62896365",
"0.62230825",
"0.61602503",
"0.6158862",
"0.6150496",
"0.6133123",
"0.61103034",
"0.6041652",
"0.6035... | 0.79104733 | 0 |
For a square matrix with shape (`dimension`, `dimension`), return a list of indices into a vector with `dimension dimension` elements that correspond to its upper triangular part after reshaping. | def upper_triangular_indices(dimension):
assert dimension > 0, "tensor_utils.upper_triangular_indices: Dimension must be positive integer!"
for row in range(dimension):
for column in range(row + 1, dimension):
element_index = dimension * row + column
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_indices(dimensions):\n\n level = len(dimensions)\n\n if level == 1:\n return range(dimensions[0])\n\n indices = [[]]\n\n while level:\n\n _indices = []\n\n for j in range(dimensions[level - 1]):\n\n _indices += [[j] + i for i in indices]\n\n indices = _in... | [
"0.61439174",
"0.6052947",
"0.6035017",
"0.60090554",
"0.5936174",
"0.58033603",
"0.57944226",
"0.57944226",
"0.5761883",
"0.5708514",
"0.56910044",
"0.5668839",
"0.5661304",
"0.5629464",
"0.5621799",
"0.5600451",
"0.5595236",
"0.555132",
"0.55404836",
"0.55397177",
"0.553816... | 0.7299493 | 0 |
Convert a datetime to a different format so it can be accessible in Jinja. | def datetimefilter(value, format='%b %d'):
return value.strftime(format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_datetime(value, format=\"datetime\"):\n if format == \"datetime\":\n render_as = value.strftime(\"%d/%m/%Y %H:%M\")\n elif format == \"date\":\n render_as = value.strftime(\"%d/%m/%Y\")\n elif format == \"time\":\n render_as =... | [
"0.73895514",
"0.7053604",
"0.69976836",
"0.6970745",
"0.69488513",
"0.68443584",
"0.6805817",
"0.6787198",
"0.676419",
"0.6692726",
"0.66346955",
"0.6610277",
"0.6608763",
"0.6596385",
"0.65597314",
"0.6558347",
"0.6536109",
"0.65202",
"0.6515687",
"0.65024954",
"0.64961064"... | 0.6137935 | 47 |
Method to return a single user base on a given id | def get_single_user(self, id):
for user in self.users:
if user['id'] == id:
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(id):\n return User.query.filter_by(id=id).first()",
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def find_by_id(cls, _id):\n user = cls.query.filter_by(id=_id).first()\n return user",
"def get_user(id):\n pass",
"def find_user_by_id(id: str) -> User:\n\n ... | [
"0.87406313",
"0.87194085",
"0.86879575",
"0.8629455",
"0.8574395",
"0.854622",
"0.84706885",
"0.84516245",
"0.8389576",
"0.8380215",
"0.83528787",
"0.8348613",
"0.82819223",
"0.8277447",
"0.82162476",
"0.82110035",
"0.82092386",
"0.81851685",
"0.8184536",
"0.8169312",
"0.816... | 0.8726376 | 1 |
Return a probability distribution over which page to visit next, given a current page. With probability `damping_factor`, choose a link at random linked to by `page`. With probability `1 damping_factor`, choose a link at random chosen from all pages in the corpus. | def transition_model(corpus, page, damping_factor):
prob_dist = defaultdict(float)
corpus_len = len(corpus)
if not corpus[page]:
for corpus_page in corpus:
prob_dist[corpus_page] += 1/corpus_len
return prob_dist
len_linked_pages = len(corpus[page])
for linked_page in cor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transition_model(corpus, page, damping_factor):\n distribution = dict() #Create a dictionary for the probability distribution\n all_pages = []\n links = list(corpus[page]) #All pages linked by current page\n for u in corpus:\n all_pages.append(u)\n\n #If the current page does not link to ... | [
"0.7992964",
"0.77270436",
"0.764785",
"0.7500536",
"0.72686094",
"0.70465213",
"0.6915432",
"0.68950415",
"0.6844223",
"0.6782304",
"0.6755477",
"0.6724492",
"0.66375583",
"0.6618151",
"0.6553851",
"0.65046436",
"0.63941073",
"0.63314575",
"0.6278812",
"0.62436855",
"0.62332... | 0.7451512 | 4 |
update an existing categories | def update(self, instance, validated_data):
instance.cat_name = validated_data.get('cat_name', instance.cat_name)
instance.img = validated_data.get('img', instance.img)
instance.desc = validated_data.get('desc', instance.desc)
instance.save()
return instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, request, *args, **kwargs):\n response = super(CategoryViewSet).update(self, request, *args, *kwargs)\n response.data['message'] = \"Categoria ha sido editada\"",
"def update(self, request, pk=None):\n if not request.auth.user.is_staff:\n return Response(\n ... | [
"0.7418198",
"0.7234741",
"0.72183055",
"0.7139743",
"0.7106988",
"0.69815934",
"0.6827737",
"0.68089455",
"0.67316884",
"0.67297924",
"0.6729216",
"0.67233735",
"0.66815853",
"0.6635296",
"0.6604073",
"0.65747875",
"0.6562277",
"0.65461564",
"0.6542109",
"0.6527648",
"0.6495... | 0.0 | -1 |
Strip braces enclosing string | def _strip_braces(self, val):
logger.debug('Strip braces')
val = val.strip()
if val.startswith('{') and val.endswith('}') and self._full_span(val):
return val[1:-1]
return val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stray_braces(self, tex):\n num_lefts, num_rights = [\n tex.count(char)\n for char in \"{}\"\n ]\n if num_rights > num_lefts:\n backwards = tex[::-1].replace(\"}\", \"\", num_rights - num_lefts)\n tex = backwards[::-1]\n elif num_lef... | [
"0.7257907",
"0.6704662",
"0.663527",
"0.663437",
"0.65309894",
"0.65099",
"0.6454627",
"0.63949865",
"0.6302393",
"0.6281844",
"0.62191236",
"0.62042516",
"0.6161475",
"0.60913813",
"0.60668725",
"0.6063109",
"0.5937413",
"0.59302425",
"0.58825225",
"0.58386445",
"0.58217025... | 0.76519185 | 0 |
Provides an organization from its given ID. | def get_organization(
self, organization_id: Union[str, int], *, params: Optional[dict] = None
) -> "resource_types.Organization":
return communicator.Organization(self.__requester).from_id(
organization_id=organization_id, parameters=params
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organization(self, id: str) -> dict[str, Any]:\n params = {}\n\n return self.client.get(self._url(id), params=params)",
"def organization(self, organization_id):\r\n return organizations.Organization(self, organization_id)",
"def find_organization(self):\n if self.org_id is ... | [
"0.7779527",
"0.7667834",
"0.72960305",
"0.7177982",
"0.6943155",
"0.6880863",
"0.6874825",
"0.6787914",
"0.6783364",
"0.6768005",
"0.6724089",
"0.67040336",
"0.6621863",
"0.65592504",
"0.653614",
"0.6531504",
"0.64872956",
"0.64778906",
"0.6453674",
"0.64502835",
"0.6436561"... | 0.79455 | 0 |
Samples quaternions of random rotations along the zaxis. | def sample_quat(self):
if self.z_rotation:
rot_angle = np.random.uniform(high=2 * np.pi, low=0)
return [np.cos(rot_angle / 2), 0, 0, np.sin(rot_angle / 2)]
return [1, 0, 0, 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_quaternions(count=100):\n rands = np.random.rand(count,3)\n root_1 = np.sqrt(rands[:,0])\n minus_root_1 = np.sqrt(1-rands[:,0])\n two_pi_2 = np.pi*2*rands[:,1]\n two_pi_3 = np.pi*2*rands[:,2]\n \n res = np.zeros((count,4))\n res[:,0] = minus_root_1*np.sin(two_pi_2)\n res[:,1] ... | [
"0.7073986",
"0.68722045",
"0.6529664",
"0.6503195",
"0.6345796",
"0.6336485",
"0.6277915",
"0.61840326",
"0.61288977",
"0.60825557",
"0.6078604",
"0.60223764",
"0.60217965",
"0.60030395",
"0.6001181",
"0.5951943",
"0.59054774",
"0.58579105",
"0.58181906",
"0.57951933",
"0.57... | 0.7299934 | 0 |
Return the lifetime exposure number. Returns | def to_observation_counter(self) -> int:
return self.to_exposure_id() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exposure(self):\n exposure = float(self._driver.ExposureTime)\n\n return exposure",
"def lifetime(self) -> str:\n return pulumi.get(self, \"lifetime\")",
"def get_life(self):\n return self.life",
"def exposuretime(self):\n _, = self.exposuretimes\n return _",
"def ... | [
"0.68661416",
"0.6797006",
"0.661743",
"0.6530258",
"0.64460176",
"0.6445488",
"0.6433524",
"0.63488317",
"0.6323735",
"0.6315333",
"0.63136095",
"0.6303788",
"0.6302292",
"0.6228902",
"0.6205906",
"0.6149555",
"0.61349577",
"0.6120186",
"0.60959166",
"0.6037626",
"0.5971728"... | 0.6145864 | 16 |
precision positive predictive value | def get_precision(TP, FP):
precision = TP / (TP + FP)
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(y_true, y_pred):\n tp = true_positive(y_true, y_pred)\n fp = false_positive(y_true, y_pred)\n precision = tp / (tp + fp)\n return precision",
"def precision(y_true, y_pred):\n true_positives = bk.sum(bk.round(bk.clip(y_true * y_pred, 0, 1)))\n predicted_positives =... | [
"0.7635932",
"0.7559498",
"0.7515403",
"0.7424766",
"0.74078333",
"0.74078333",
"0.74078333",
"0.74078333",
"0.74078333",
"0.74078333",
"0.7381328",
"0.73782855",
"0.73782855",
"0.73782855",
"0.73782855",
"0.73782855",
"0.73782855",
"0.73782855",
"0.73782855",
"0.73782855",
"... | 0.0 | -1 |
CHANGE NAME TO REFERENCE QRES | def show_precision_recall_curve_(qres, ibs=None, gt_aids=None, fnum=1):
recall_range_, p_interp_curve = get_interpolated_precision_vs_recall_(qres, ibs=ibs, gt_aids=gt_aids)
title_pref = qres.make_smaller_title() + '\n',
return draw_precision_recall_curve_(recall_range_, p_interp_curve, title_pref, fnum) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reference(self, name):\n pass",
"def ref_name(self, name):\n self._ref_name = name if self._ref_name is None else self._ref_name\n return self",
"def new_name(self,new_name):\n self.name = new_name",
"def named_back_reference(name:str) -> str:\n # TODO error handling \n ... | [
"0.6836514",
"0.68362606",
"0.6407378",
"0.6379306",
"0.6241517",
"0.6167758",
"0.6128833",
"0.61171496",
"0.61073583",
"0.60798806",
"0.6016807",
"0.60081804",
"0.5997102",
"0.5988722",
"0.59712064",
"0.59712064",
"0.5968742",
"0.5943854",
"0.5943854",
"0.5943854",
"0.594385... | 0.0 | -1 |
Gets the object_type of this AssetManagedDeviceStatus. The concrete type of this complex type. The ObjectType property must be set explicitly by API clients when the type is ambiguous. In all other cases, the ObjectType is optional. The type is ambiguous when a managed object contains an array of nested documents, and ... | def object_type(self):
return self._object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self):\n if not self.Flags & gdef.ACE_OBJECT_TYPE_PRESENT:\n return None\n return self.ObjectType",
"def object_type(self) -> str:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> str:\n return pulumi.get(self, \"object_type\")",
"d... | [
"0.67666554",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6751302",
"0.6748769",
"0.670453",
"0.670453",
"0.64563984",
"... | 0.7034013 | 4 |
Sets the object_type of this AssetManagedDeviceStatus. The concrete type of this complex type. The ObjectType property must be set explicitly by API clients when the type is ambiguous. In all other cases, the ObjectType is optional. The type is ambiguous when a managed object contains an array of nested documents, and ... | def object_type(self, object_type):
self._object_type = object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self, object_type: str):\n allowed_values = [\"actuator\", \"sensor\", \"human\", \"service\", \"skill\", \"task\", \"action\", \"healthdata\",\n \"humanrole\", \"message\", \"permission\", \"preference\", \"property\"] # noqa: E501\n if object_type not in al... | [
"0.755974",
"0.5921794",
"0.575162",
"0.56026995",
"0.56026995",
"0.56026995",
"0.56026995",
"0.56026995",
"0.55906165",
"0.5489738",
"0.54524934",
"0.544844",
"0.5446077",
"0.5446077",
"0.5446077",
"0.5446077",
"0.5446077",
"0.5446077",
"0.5446077",
"0.5446077",
"0.5446077",... | 0.7447152 | 5 |
Sets the cloud_port of this AssetManagedDeviceStatus. Port used for the connection to the Cloud by the Device Connector for the Managed Device. | def cloud_port(self, cloud_port):
self._cloud_port = cloud_port | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cloud_port(self):\n return self._cloud_port",
"def cloud(self, cloud):\n\n self._cloud = cloud",
"def cloud_platform(self, cloud_platform):\n\n self._cloud_platform = cloud_platform",
"def port(self, port):\n\n self._port = port",
"def port(self, port):\n\n self._port... | [
"0.6861406",
"0.6428192",
"0.63073575",
"0.57456225",
"0.57456225",
"0.57456225",
"0.5698453",
"0.5344858",
"0.53202885",
"0.5274588",
"0.5266092",
"0.5238477",
"0.5181552",
"0.50226223",
"0.5014965",
"0.49952412",
"0.49680263",
"0.49337366",
"0.49337366",
"0.4925041",
"0.492... | 0.8312118 | 0 |
Gets the connection_status of this AssetManagedDeviceStatus. Maintains the status of the connection to the Device. | def connection_status(self):
return self._connection_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> 'outputs.ConnectionStatusResponse':\n return pulumi.get(self, \"status\")",
"def GetAdbConnectionStatus(self):\n if not self._adb_port:\n return None\n\n return self._device_information[\"adb_status\"]",
"def status(self) -> Optional[pulumi.Input[Union[str, '... | [
"0.69990855",
"0.67396075",
"0.6585936",
"0.6561341",
"0.6351244",
"0.63025033",
"0.6184628",
"0.5918606",
"0.58362716",
"0.5818522",
"0.5818522",
"0.5785592",
"0.57839364",
"0.5760275",
"0.5753956",
"0.57480794",
"0.572511",
"0.56983143",
"0.5695774",
"0.5664015",
"0.5664015... | 0.73128605 | 0 |
Sets the connection_status of this AssetManagedDeviceStatus. Maintains the status of the connection to the Device. | def connection_status(self, connection_status):
allowed_values = ["Unknown", "Success", "Failure"]
if connection_status not in allowed_values:
raise ValueError(
"Invalid value for `connection_status` ({0}), must be one of {1}"
.format(connection_status, allowe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_connection_status(self, connection_status: Literal[ConnectionState]) -> None:\n self.connection_status = connection_status\n self.publish(self.key_gen(\"connection_status\"), connection_status)",
"def set_desired_connection_status(self, connection_status: Literal[ConnectionState]) -> None:\... | [
"0.7622204",
"0.71229255",
"0.67075294",
"0.642478",
"0.6304812",
"0.57982844",
"0.5712975",
"0.5712975",
"0.5712975",
"0.5702602",
"0.56843436",
"0.56608224",
"0.5657329",
"0.56564194",
"0.5575543",
"0.5575543",
"0.5575543",
"0.5575543",
"0.5575543",
"0.5575543",
"0.5575543"... | 0.7380079 | 1 |
Sets the server_port of this AssetManagedDeviceStatus. Port used for receiving requests from Intersight Assist by the Device Connector for the Managed Device. | def server_port(self, server_port):
self._server_port = server_port | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setServerPort(self, serverPort):\n\n _ExceptionUtil.raiseOnError(\n internals.blpapi_SessionOptions_setServerPort(self.__handle,\n serverPort))",
"def SetServerInformation(self, server, port):\n self.hostname = server\n self.por... | [
"0.70623255",
"0.65183854",
"0.64270973",
"0.64270973",
"0.6307212",
"0.6213667",
"0.61758465",
"0.60316",
"0.60316",
"0.60316",
"0.59650874",
"0.58534414",
"0.5831054",
"0.5787459",
"0.5720148",
"0.5708671",
"0.5708671",
"0.56616724",
"0.5628659",
"0.561165",
"0.5568586",
... | 0.77997637 | 0 |
Gets the state of this AssetManagedDeviceStatus. Maintains the state of the Managed Device, such as Start Success, Start Failure, etc. See ManagedDeviceState for device connection states. | def state(self):
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self) -> 'outputs.DeviceStateResponse':\n return pulumi.get(self, \"state\")",
"def device_state_attributes(self):\n return self._device.status",
"def state(self):\n return self.coordinator.data[METER_DEVICE_TYPE][self.base_unique_id][METER_STATE]",
"def state(self):\n r... | [
"0.68895024",
"0.68079215",
"0.66896343",
"0.66657823",
"0.65847945",
"0.64756274",
"0.64477634",
"0.63459176",
"0.62486476",
"0.61321944",
"0.6100846",
"0.6098232",
"0.60503274",
"0.6047438",
"0.6041383",
"0.60354865",
"0.6020574",
"0.600182",
"0.59860885",
"0.5965785",
"0.5... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, AssetManagedDeviceStatus):
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 |
Returns the rectangle occupied by the given menu item. It can be used with `mouseInView()` to determine if a mouse click has occurred on a given menu selection. | def getItemRect(self, item):
r = Rect(1, 0, 1, 1)
for p in self.menu.items:
r.topLeft.x = r.bottomRight.x
if p.name:
r.bottomRight.x += (nameLength(p.name) + 2)
if p is item:
return r
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetBoundingRect(self, item, textOnly=False):\r\n \r\n i = item\r\n\r\n startX, startY = self.GetViewStart()\r\n rect = wx.Rect()\r\n\r\n rect.x = i.GetX() - startX*_PIXELS_PER_UNIT\r\n rect.y = i.GetY() - startY*_PIXELS_PER_UNIT\r\n rect.width = i.GetWidth()\r\n ... | [
"0.6840595",
"0.6723916",
"0.62039435",
"0.60061646",
"0.5800066",
"0.5797162",
"0.570646",
"0.5655264",
"0.56232053",
"0.5483383",
"0.54546165",
"0.5424792",
"0.5416514",
"0.54087716",
"0.53720254",
"0.53371376",
"0.53336966",
"0.5329836",
"0.5325443",
"0.5323548",
"0.529638... | 0.7746237 | 0 |
Corrects the position of self.x and self.y Only Applies if the screen width or height gets smaller | def correct_position(self):
width = self.screen.get_width()
height = self.screen.get_height()
if self.last_screen_dimensions["width"] > width:
self.x -= self.last_screen_dimensions["width"] - width
if self.last_screen_dimensions["height"] > height:
self.y -= se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keepInBounds(self):\n screenWidth, screenHeight = self.screen.get_size()\n\n self.pos.x = max(0, self.pos.x)\n self.pos.x = min(screenWidth, self.pos.x)\n\n self.pos.y = max(0, self.pos.y)\n self.pos.y = min(screenHeight, self.pos.y)",
"def update(self): \n super().... | [
"0.78119874",
"0.7653817",
"0.75469375",
"0.7439028",
"0.7326057",
"0.7271567",
"0.72375256",
"0.7131026",
"0.712786",
"0.7124782",
"0.71077716",
"0.7093469",
"0.7079267",
"0.7074412",
"0.70671827",
"0.70496273",
"0.70259625",
"0.69542825",
"0.69437736",
"0.6918284",
"0.69038... | 0.8278624 | 0 |
Sigmoid function. This function accepts any shape of np.ndarray object as input and perform sigmoid operation. | def sigmoid(x):
return 1 / (1 + np.exp(-x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x: np.ndarray \n ) -> np.ndarray:\n return 1/(1+np.exp(-x))",
"def sigmoid(X):\n if isinstance(X,(list,tuple)):\n X=np.array(X)\n return 1/(1+np.exp(-X))\n #return np.exp(X)/(1+np.exp(X))",
"def sigmoid(x):\n return 1.0/(1 + np.exp(-x))",
"def sigmoid(x):\r\... | [
"0.82872546",
"0.77726996",
"0.75892836",
"0.75803345",
"0.75792193",
"0.75692123",
"0.75561017",
"0.7554079",
"0.7553817",
"0.75433666",
"0.7523711",
"0.7523711",
"0.7517644",
"0.74938184",
"0.7459675",
"0.7390222",
"0.7347192",
"0.7343358",
"0.7307995",
"0.72994894",
"0.729... | 0.75519615 | 14 |
First derivative of Sigmoid function. The input to this function should be the value that output from sigmoid function. | def der_sigmoid(y):
return y * (1 - y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_derivative(x):\n return x * (1-x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def sigmoid_der... | [
"0.87601984",
"0.87236494",
"0.87236494",
"0.87169576",
"0.8606332",
"0.84701663",
"0.8355083",
"0.7660587",
"0.76379246",
"0.76147074",
"0.75108695",
"0.7500872",
"0.74812835",
"0.7464008",
"0.74280185",
"0.7420573",
"0.7313185",
"0.7219959",
"0.72071964",
"0.71963114",
"0.7... | 0.7864624 | 7 |
Data visualization with ground truth and predicted data comparison. There are two plots for them and each of them use different colors to differentiate the data with different labels. | def plot_result(data, gt_y, pred_y):
assert data.shape[0] == gt_y.shape[0]
assert data.shape[0] == pred_y.shape[0]
plt.figure()
plt.subplot(1, 2, 1)
plt.title('Ground Truth', fontsize=18)
for idx in range(data.shape[0]):
if gt_y[idx] == 0:
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_true_predictions(self):\n \n if self.data_generated:\n \n # Choosing a different color for each target\n n_targets = len(self.true_data['targets'])\n cmap = plt.get_cmap('gnuplot')\n colors = [cmap(i) for i in np.linspace(0, 0.9, n_targe... | [
"0.72492915",
"0.69190305",
"0.6835955",
"0.66809905",
"0.667098",
"0.666655",
"0.66369617",
"0.6629329",
"0.65713775",
"0.6568579",
"0.6568099",
"0.65115273",
"0.65052915",
"0.6482675",
"0.645257",
"0.64101094",
"0.63752383",
"0.6353995",
"0.63376975",
"0.63136935",
"0.63063... | 0.761913 | 1 |
Implementation of the forward pass. It should accepts the inputs and passing them through the network and return results. | def forward(self, inputs):
#print("w1 shape", self.w1.shape)
z1 = np.dot(inputs, self.w1)
self.a1 = sigmoid(z1)
z2 = np.dot(self.a1, self.w2)
self.a2 = sigmoid(z2)
z3 = np.dot(self.a2, self.w3)
self.y = sigmoid(z3)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inputs):\r\n #print (len(inputs))\r\n out = self.fc1(inputs)\r\n out = self.fc2(out)\r\n self.out = out\r\n return out\r\n #raise NotImplementedError('Implement the forward method of the model')\r",
"def forward(self, inputs):\n raise NotImplemen... | [
"0.8330594",
"0.8141684",
"0.7926628",
"0.78035897",
"0.78035897",
"0.78035897",
"0.7752818",
"0.7752818",
"0.7738907",
"0.7679073",
"0.7660625",
"0.7643285",
"0.7581304",
"0.7569203",
"0.7479867",
"0.74048865",
"0.7394922",
"0.73774797",
"0.7364085",
"0.73442876",
"0.7337264... | 0.0 | -1 |
Implementation of the backward pass. It should utilize the saved loss to compute gradients and update the network all the way to the front. | def backward(self, i):
#Compute gradient for w1, w2, w3
w1_grad = np.zeros((2, 3))
w2_grad = np.zeros((3, 3))
w3_grad = np.zeros((3, 1))
w3_backward_pass = np.zeros((1, 1))
w2_backward_pass = np.zeros((1, 3))
#print("self.error shap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward_pass(self, loss):\n\n self.optimizer.zero_grad()\n self.optimizer.backward(loss)\n self.optimizer.step()",
"def backward(self, loss):\n global_timer.my_timer.start_profile(\"BWD\")\n mgr = PatrickStarManager()\n mgr.set_training_stage(TrainingStage.BWD)\n\n ... | [
"0.8116909",
"0.788521",
"0.78546345",
"0.7807031",
"0.7777338",
"0.7689684",
"0.7631545",
"0.7611851",
"0.76023585",
"0.75521505",
"0.75045365",
"0.7501314",
"0.7501314",
"0.7485868",
"0.7481361",
"0.7481292",
"0.7444571",
"0.739935",
"0.73771346",
"0.73410493",
"0.7311101",... | 0.704288 | 47 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.