query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Generator for a sliding window walker; yields a new substring of sequence as well as the position of the left end of the window.
def sliding_window(sequence, width=2, step=1, seq_only=False): for position in range(0, len(sequence) - width, step): yield sequence[position: position + width] if seq_only else (position, sequence[position: position + width])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sliding_window(seq, n=DEFAULT_WINDOW_WIDTH):\n it = iter(seq)\n result = tuple(islice(it, n))\n if len(result) == n:\n yield result \n for elem in it:\n result = result[1:] + (elem,)\n yield result", "def sliding_window_analysis(sequence, function,\n ...
[ "0.6834851", "0.65151423", "0.6398749", "0.6279482", "0.6083154", "0.60000926", "0.5993172", "0.5971204", "0.5971204", "0.5791553", "0.56396246", "0.5636666", "0.5559646", "0.5535868", "0.54835385", "0.54810375", "0.5475382", "0.5470839", "0.5463914", "0.5445849", "0.5411979"...
0.7074384
0
This function like generate_pediction is called automatically by sciunit which RestingVmTest is a child of. This function must be named compute_score The prediction processed from "vm_soma" is compared against the experimental_data to get the binary score; 0 if the prediction correspond with experiment, else 1.
def compute_score(self, observation, prediction, verbose=False): #print(observation) score = TScore.compute( self.observation, prediction ) print("compute_score")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, test_data):\n\n\t\tpass", "def score():\n # Get probability from our data\n data = flask.request.json\n x = np.matrix(data[\"example\"])\n x_add = scaler.transform(x[0, (0,4,5,6,7,8)])\n x_scaled = np.delete(x, [0,4,5,6,7,8], axis=1)\n x_scaled = np.insert(x_scaled, (0,3,3,3,3,3...
[ "0.6292821", "0.6264465", "0.6261162", "0.6158336", "0.61248165", "0.60617495", "0.6059161", "0.6052629", "0.5940177", "0.5930881", "0.59085554", "0.59062296", "0.58507663", "0.58476144", "0.5836477", "0.5834371", "0.58234507", "0.5818891", "0.58088255", "0.58037376", "0.5802...
0.66401887
0
Get account record for project.
def record_get_for_project(project_id, deleted=False, session=None): session = session or get_session() result = session.query(models.ProjectAccountRecord).\ filter_by(project_id=project_id).\ filter_by(deleted=deleted).\ first() if not result: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account(self):\n return self._account", "def get_account(self):\n return self._account", "def get_account(self, account):\n \n pass", "def account(self, account_code):\r\n return acc.Account(self, account_code)", "def account(self, account_id: str):\n retur...
[ "0.6873403", "0.6873403", "0.6768942", "0.65608275", "0.6481947", "0.6471267", "0.6470501", "0.64585155", "0.6380671", "0.63713425", "0.63052857", "0.63029593", "0.6294659", "0.61823344", "0.616734", "0.61592054", "0.61530197", "0.6139093", "0.6127555", "0.61225945", "0.60992...
0.7251701
0
Create account record for project.
def record_create_for_project(project_id, values): values['project_id'] = project_id values['created_at'] = datetime.datetime.utcnow() values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = models.ProjectAccountRecord() record_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_account_project(self, create):\n row = {'PROJ_NAME1': 'Some Proj', 'PROJ_NO': '121-212',\n 'SECTOR': 'IT'}\n sync.create_account(row, None)\n self.assertTrue(create.called)\n account, row, issue_map = create.call_args[0]\n self.assertEqual(account.na...
[ "0.75250834", "0.7177558", "0.71739244", "0.707201", "0.7024612", "0.6820869", "0.67543614", "0.6753563", "0.6743432", "0.67337596", "0.6614218", "0.65826344", "0.6565613", "0.65346366", "0.647355", "0.6444409", "0.64416903", "0.6433336", "0.6433", "0.64252216", "0.6414233", ...
0.76885504
0
Destroy account record for project.
def record_destroy_for_project(project_id): session = get_session() with session.begin(): session.query(models.ProjectAccountRecord).\ filter_by(project_id=project_id).\ update({'deleted': True, 'deleted_at': datetime.datetime.utcnow(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account(self, account):\n \n pass", "def delete_account(self):\n Credential.account_list.remove(self)", "def delete(account):\n account.stripe_account.delete()\n account.delete()", "def delete_account(self):\n signals.before_gameaccount_deleted.send(gameaccount=se...
[ "0.76962966", "0.74316823", "0.7380734", "0.7321574", "0.6965246", "0.69463253", "0.6917392", "0.69166034", "0.68574756", "0.6784433", "0.6770951", "0.6721752", "0.66982305", "0.6688007", "0.66563594", "0.6620386", "0.65966487", "0.6591575", "0.6591472", "0.6562468", "0.65266...
0.77929056
0
Destroy account record for project by record id.
def destroy_project_record_by_id(record_id): session = get_session() with session.begin(): record_ref = get_project_record_by_id(record_id, session=session) record_ref.delete(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_destroy_for_project(project_id):\n session = get_session()\n with session.begin():\n session.query(models.ProjectAccountRecord).\\\n filter_by(project_id=project_id).\\\n update({'deleted': True,\n 'deleted_at': datetime.datetime.utcnow()...
[ "0.7914912", "0.74007756", "0.7235547", "0.6944781", "0.6778722", "0.6724235", "0.67061377", "0.6690477", "0.6684126", "0.6674596", "0.6673089", "0.6586451", "0.65708244", "0.6446228", "0.63494915", "0.63357514", "0.6325784", "0.6323633", "0.6301844", "0.62872565", "0.6274903...
0.8081782
0
Get all item record for project by project id.
def get_all_item_record_for_project(project_id, deleted=False, session=None): session = session or get_session() result = session.query(models.ProjectItemRecord).\ filter_by(project_id=project_id).\ filter_by(deleted=deleted).\ all() if not result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_item_record_for_project(project):\r\n db_api = flask.request.db_api\r\n try:\r\n records = db_api.get_all_item_record_for_project(project)\r\n items = db_api.get_all_item()\r\n item_dict = dict([(i.id, i) for i in items])\r\n record_dict = {}\r\n for record in r...
[ "0.813911", "0.7328739", "0.69601107", "0.67463654", "0.6533493", "0.63821095", "0.63788885", "0.634504", "0.63328993", "0.6316908", "0.6295516", "0.62620634", "0.61942583", "0.61678183", "0.6166824", "0.6155322", "0.6145036", "0.6108053", "0.60920167", "0.6046282", "0.602754...
0.79447895
1
Get item record for project by item id.
def item_record_get_for_project(project_id, item_id, deleted=False, session=None): session = session or get_session() result = session.query(models.ProjectItemRecord).\ filter_by(project_id=project_id).\ filter_by(item_id=item_id).\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(item_id):\n return Item.query.filter_by(id=item_id).first()", "def get_project_item_record_by_name(project_id, item_name,\n deleted=False, session=None):\n session = session or get_session()\n if not item_get_by_name(item_name, session=session):\n i...
[ "0.79094803", "0.78173584", "0.779059", "0.7556272", "0.74198294", "0.7246455", "0.72274256", "0.7185601", "0.70975524", "0.7045275", "0.7031257", "0.700558", "0.69499576", "0.69349205", "0.69239855", "0.6913654", "0.6911511", "0.68850607", "0.68822163", "0.6859151", "0.67955...
0.82235324
0
Get item record for a project by item name.
def get_project_item_record_by_name(project_id, item_name, deleted=False, session=None): session = session or get_session() if not item_get_by_name(item_name, session=session): item_create(item_name, session=session) item = item_get_by_name(item_name, session=ses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_record_get_for_project(project_id, item_id,\n deleted=False, session=None):\n session = session or get_session()\n result = session.query(models.ProjectItemRecord).\\\n filter_by(project_id=project_id).\\\n filter_by(item_id=item_i...
[ "0.7511793", "0.6906444", "0.6748321", "0.6576447", "0.657298", "0.65694696", "0.6549003", "0.6524026", "0.649842", "0.64756", "0.63357013", "0.628752", "0.6284544", "0.6263267", "0.6244177", "0.61833465", "0.6174139", "0.6136428", "0.61308837", "0.6121236", "0.61090165", "...
0.8403567
0
Create item record for project.
def item_record_create_for_project(project_id, values, session=None): values['created_at'] = datetime.datetime.utcnow() values['project_id'] = project_id values['used'] = 0 if 'price' in values: values['price'] = int(values['price']) session = session or get_session() with session.begi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_project_item_records(project, item):\r\n db_api = flask.request.db_api\r\n record = {}\r\n\r\n if flask.request.method == 'GET':\r\n try:\r\n records = db_api.get_project_item_record_by_name(project_id=project,\r\n it...
[ "0.67992556", "0.66644853", "0.6627822", "0.66117144", "0.65483904", "0.64934033", "0.6480519", "0.64766985", "0.64618635", "0.64616525", "0.643769", "0.6425833", "0.6419744", "0.6397447", "0.6312063", "0.62760675", "0.62558514", "0.6227413", "0.62180895", "0.62023485", "0.62...
0.7986861
0
Update item record by item record_id.
def update_project_item_record_by_id(record_id, values): values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = get_project_item_record(record_id, session=session) price = values.get('price', None) if price and price != record_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_item_record(id):\r\n db_api = flask.request.db_api\r\n record = {}\r\n\r\n if flask.request.method == 'GET':\r\n try:\r\n record = db_api.get_project_item_record(id)\r\n except exception.ProjectItemRecordNotFound:\r\n raise webob.exc.HTTPNotFound()\r\n\r\n ...
[ "0.7118001", "0.7086754", "0.6939123", "0.6875679", "0.67684174", "0.6705709", "0.6603891", "0.6562499", "0.6495993", "0.642799", "0.63300025", "0.62748045", "0.62592906", "0.6219607", "0.6203007", "0.6176232", "0.6166459", "0.61270183", "0.61230475", "0.61213315", "0.6054235...
0.7189731
0
Destroy account record for user by record id.
def destroy_user_record_by_id(record_id): session = get_session() with session.begin(): session.query(models.UserAccountRecord).\ filter_by(id=record_id).\ update({'deleted': True, 'deleted_at': datetime.datetime.utcnow(), '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_record(self, record_id):\r\n self.record.deleteObject(id=record_id)", "def record_destroy_for_user(project_id, user_id):\n session = get_session()\n with session.begin():\n session.query(models.UserAccountRecord).\\\n filter_by(project_id=project_id).\\\n ...
[ "0.7428881", "0.70678204", "0.69996387", "0.69786745", "0.6923281", "0.6863564", "0.6838221", "0.67867917", "0.6773444", "0.6655968", "0.66454196", "0.66296005", "0.655638", "0.65561914", "0.6556088", "0.6553839", "0.6539259", "0.65297717", "0.65183675", "0.6514868", "0.65042...
0.826225
0
Get event log for tenant or user.
def event_get(tenant_id, user_id=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAccessLogForUser(cls, user):\n return cls.objects.filter(user_id=user.pk).order_by('timestamp')", "def get_eventlogs_detail(self, conn, id):\n path = urlJoin(urls.EVENT_LOG[\"GET\"], id)\n resp = conn.command(apiMethod=\"GET\", apiPath=path)\n return resp", "def getLog(self):...
[ "0.6378935", "0.6191199", "0.6155786", "0.6149457", "0.6149457", "0.6101304", "0.5987789", "0.59368587", "0.59368587", "0.5933352", "0.58958244", "0.58567405", "0.5849712", "0.57722425", "0.57491046", "0.57342017", "0.5707942", "0.56680214", "0.5650455", "0.5649152", "0.56258...
0.7186435
0
Create event log for tenant or user.
def event_create(tenant_id, user_id=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_create(sender, instance, created, **kwargs):\n if created:\n stracks.user(instance).log(\"? has been created\")", "def create_log_entry_when_user_logs_in(sender, request, user, **kwargs):\n create_user_log(\n request=request,\n user=user,\n type=_account_const.AUTHENTICA...
[ "0.64820445", "0.63328654", "0.6176685", "0.6098838", "0.6082016", "0.60325897", "0.6020694", "0.5998269", "0.59666187", "0.58728296", "0.5845204", "0.5739365", "0.5670226", "0.56540704", "0.5646611", "0.56244636", "0.5620357", "0.5588737", "0.5570638", "0.55596507", "0.55296...
0.7805796
0
Destroy event log for tenant or user.
def event_destroy(tenant_id, user_id=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_audit_delete(sender, user, request, **kwargs):\n\n try:\n UserAudit.objects.get(audit_key=request.session[constants.USERWARE_AUDIT_KEY]).delete()\n except:\n pass\n logger.info(_('User {} logged out'.format(request.user.username)))", "def delete(self):\n backend = self._get...
[ "0.68693596", "0.62246245", "0.61553496", "0.61405814", "0.6087588", "0.59832424", "0.5951968", "0.58644575", "0.582783", "0.58232427", "0.5809617", "0.5775968", "0.57755435", "0.5759473", "0.57312846", "0.570118", "0.5697515", "0.56482196", "0.56314635", "0.55968815", "0.557...
0.813976
0
Retrieve, update or delete a Incident.
def incident_detail(request, pk): try: Incident = Incident.objects.get(pk=pk) except Incident.DoesNotExist: return HttpResponse(status=404) if request.method == 'GET': serializer = IncidentSerializer(Incident) return JsonResponse(serializer.data) elif request.method == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_an_incident(self, id):\n sql = f\"SELECT * FROM incidences WHERE incidences.id={id}\"\n curr = Db().cur\n curr.execute(sql)\n output = curr.fetchone()\n return output", "def get(*, db_session, incident_id: int) -> Optional[Incident]:\n return db_session.query(Inciden...
[ "0.57337767", "0.5693353", "0.56903386", "0.54576063", "0.5443404", "0.5376091", "0.5369639", "0.53686297", "0.53374654", "0.5288004", "0.5210048", "0.51772356", "0.51492304", "0.50980365", "0.5071856", "0.5063114", "0.5051532", "0.50009227", "0.4985093", "0.4922284", "0.4906...
0.6207881
0
Tests the creation of an text layer via the layer factory.
def test_layer_factory(self): self.graphic = Text('Test') assert_layer_factory(self, 'text')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fixed_text_layer(self):\n\t\tself.graphic = Text('text')\n\t\tself.viewport = Viewport(0, 0, 100, 100)\n\t\tself.offset_x = 10\n\t\tself.offset_y = 5\n\n\t\t# Test a static text layer first\n\t\tself.layer = text_layer.FixedStaticTextLayer(\n\t\t\tself.graphic, viewport=self.viewport,\n\t\t\toffset_x=self...
[ "0.68004715", "0.62582254", "0.6083502", "0.5984313", "0.5946537", "0.5838513", "0.5829028", "0.58284557", "0.5803945", "0.5803416", "0.57713497", "0.5756482", "0.56175125", "0.560891", "0.5477224", "0.5453544", "0.5436384", "0.5339267", "0.5318148", "0.53089434", "0.53021735...
0.8442944
0
Tests fixed text layers. Also ensures that LiveText objects are updated.
def test_fixed_text_layer(self): self.graphic = Text('text') self.viewport = Viewport(0, 0, 100, 100) self.offset_x = 10 self.offset_y = 5 # Test a static text layer first self.layer = text_layer.FixedStaticTextLayer( self.graphic, viewport=self.viewport, offset_x=self.offset_x, offset_y=self.offset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_layer_factory(self):\n\t\tself.graphic = Text('Test')\n\n\t\tassert_layer_factory(self, 'text')", "def test_generate_mine_text(self):\n pg.font.init()\n font_surface = utils.generate_mine_text(1)\n self.assertIsInstance(font_surface, pg.Surface)", "def test_gameAddText(self):\n ...
[ "0.6388988", "0.59385103", "0.5931025", "0.5791703", "0.57001746", "0.5595606", "0.5564164", "0.55368245", "0.5527248", "0.5493804", "0.54809046", "0.5429338", "0.5343724", "0.53400725", "0.53017783", "0.5292878", "0.5261921", "0.5240859", "0.5239271", "0.52359575", "0.522805...
0.7963431
0
Asserts that the layer's graphic is at the expected coordinates.
def assert_layer_graphic_position(self): expected_x = self.offset_x + self.viewport.x expected_y = self.offset_y + self.viewport.y graphic = self.layer.graphic self.assertEqual(graphic.x, expected_x, "x of layer graphic is %s, should be %s." % (graphic.x, expected_x)) self.assertEqual(graphic.y, expected_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_game_over_coordinates(self):\n pg.font.init()\n font = utils.FONT.render(\"test\", True, utils.FONT_COLOUR)\n game_over_coords = utils.game_over_coords(font)\n self.assertIsInstance(game_over_coords, pg.Rect)", "def test_layer_ok(self):\n self.assertTrue(self.vector)",...
[ "0.6886318", "0.6400074", "0.61993706", "0.6192627", "0.61068124", "0.6041083", "0.6019883", "0.6003798", "0.59852034", "0.59708446", "0.5953457", "0.594311", "0.59375787", "0.5932929", "0.58274615", "0.58258504", "0.5810158", "0.5809842", "0.57834", "0.57723904", "0.57717806...
0.87353176
0
Fuses spacetodepth and transpose. Spacetodepth performs the following permutation, which is equivalent to tf.nn.space_to_depth. As spacetodepth has an implicitly transpose, input transpose is fused into spacetodepth transform. images = tf.reshape(images, [batch, h // block_size, block_size, w // block_size, block_size,...
def fused_transpose_and_space_to_depth( images, block_size=2, transpose_input=True): batch_size, h, w, c = images.get_shape().as_list() if block_size != 0: images = tf.reshape(images, [batch_size, h // block_size, block_size, w // block_size, block_size, c]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_conv2d_transpose(g, op, block):\n\n dilations = op.attr(\"dilations\")\n groups = op.attr(\"groups\")\n paddings = op.attr(\"paddings\")\n padding_algorithm = op.attr(\"padding_algorithm\")\n strides = op.attr(\"strides\")\n output_padding = op.attr(\"output_padding\") if op.attr(\"ou...
[ "0.6252821", "0.6187393", "0.6059542", "0.60442156", "0.60276586", "0.60033554", "0.5998148", "0.59918356", "0.5949912", "0.5934507", "0.5899734", "0.5860573", "0.58351976", "0.5719159", "0.570773", "0.56841886", "0.5680008", "0.56749076", "0.56631535", "0.5646647", "0.563803...
0.7638583
0
Strided 2D convolution with explicit padding. The padding is consistent and is based only on `kernel_size`, not on the dimensions of `inputs` (as opposed to using `tf.layers.conv2d` alone).
def conv2d_fixed_padding(inputs, filters, kernel_size, strides, data_format='channels_first'): if strides > 1: inputs = fixed_padding(inputs, kernel_size, data_format=data_format) outputs = tf.layers.conv2d( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv2d_fixed_padding(inputs, filters, kernel_size, strides, data_format):\n # The padding is consistent and is based only on `kernel_size`, not on the\n # dimensions of `inputs` (as opposed to using `tf.layers.conv2d` alone).\n if strides > 1:\n inputs = fixed_padding(inputs, kernel_size, data_format)\n\...
[ "0.7897865", "0.78809714", "0.78273654", "0.7678087", "0.7575362", "0.7527666", "0.7510199", "0.7343924", "0.733184", "0.72405255", "0.7214543", "0.7163506", "0.7088934", "0.706851", "0.6946939", "0.6916445", "0.69016784", "0.68804586", "0.68630147", "0.6833584", "0.6829672",...
0.793444
0
Transforms the convolution kernel for spacetodepth computation. This function transforms the kernel for spacetodepth convolution. For example, the kernel size is [7, 7, 3, 64] (conv0 in ResNet), and the block_size is 2. First the kernel is padded with (top and left) zeros to [8, 8, 3, 64]. Then, it is transformed to [4...
def transform_space_to_depth_kernel(kernel, dtype, block_size=2): def _round_up(num, multiple): remainder = num % multiple if remainder == 0: return num else: return num + multiple - remainder h, w, in_d, out_d = kernel.get_shape().as_list() pad_h = _round_up(h, block_size) - h pad_w = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_conv2d(g, op, block):\n\n dilations = op.attr(\"dilations\")\n groups = op.attr(\"groups\")\n paddings = op.attr(\"paddings\")\n padding_algorithm = op.attr(\"padding_algorithm\")\n strides = op.attr(\"strides\")\n\n kernel = g.get_node(op.input(\"Filter\")[0])\n input_x = g.get_no...
[ "0.6796937", "0.66202474", "0.65691066", "0.65528923", "0.64849013", "0.643785", "0.6437256", "0.62981987", "0.62667286", "0.6247232", "0.62432134", "0.6236941", "0.6229701", "0.62242377", "0.6193961", "0.61879545", "0.61837673", "0.61757994", "0.6170011", "0.6163105", "0.613...
0.7187211
0
Prints a chain iterating its headers
def print_headers(headers_map, fork=False): print("\nHeaders") for header_hash in list(headers_map.keys()): header = headers_map[header_hash] if fork and header.hashMerkleRoot != b"\xcc" * 32: continue print("header hash:\t\t", header.GetHash().hex()) print() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_subheaders(self):\n for subheader in self.subheaders:\n print(subheader)", "def printme(self):\n sys.stdout.write(self._header)\n for k in range(len(self)):\n sys.stdout.write(self.line(k))", "def get_headers_for_print(self):\n lines_for_print = []\n ...
[ "0.65482354", "0.64316934", "0.6394731", "0.6159447", "0.6078206", "0.60606414", "0.60512024", "0.6042295", "0.6005242", "0.59862447", "0.58384", "0.5827246", "0.57998735", "0.57509196", "0.5744481", "0.5736322", "0.57327485", "0.5727085", "0.5698431", "0.5691338", "0.569043"...
0.6886069
0
Print the interlinks of the blocks of a chain
def print_interlinks(headers_map, interlink_map): print("\nInterlinks") for i in interlink_map.keys(): print("Key:", i.hex()[:6], "| Level:", int(headers_map[i].compute_level())) print_tuple(interlink_map[i]) print("+" * 32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_paths_between_yields(paths): # pragma: no cover\n from graphviz import Digraph\n dot = Digraph(name=\"top\")\n for i, path in enumerate(paths):\n prev = None\n for block in path:\n if isinstance(block, Branch):\n label = \"if \" + astor.to_source(block.c...
[ "0.6082883", "0.5979062", "0.59749126", "0.59170777", "0.5899505", "0.5830778", "0.5731966", "0.5722667", "0.56706434", "0.5669561", "0.5637989", "0.5628519", "0.56036234", "0.5600618", "0.5568108", "0.5546844", "0.5495533", "0.54540217", "0.5449112", "0.5428345", "0.54201317...
0.6727348
0
Removes the genesis block of the proof
def remove_genesis(proof): old_size = len(proof) print("Removing genesis block from proof ...") proof.pop(-1) print("OK") print("old size:", old_size, "-> new size:", len(proof))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_block(self, block):\n raise NotImplementedError()", "def remove_from_block(self):\n self.enclosing_block.remove_ops([self])", "def delete_block(self, block):\n raise NotImplementedError('delete_block')", "def remove(self, block):\n try:\n self.blocks[block.he...
[ "0.6290408", "0.5996669", "0.59115857", "0.5884244", "0.5854443", "0.58376217", "0.58081526", "0.57852006", "0.57547975", "0.5726658", "0.56836265", "0.5676911", "0.5623997", "0.5612229", "0.5596398", "0.55962217", "0.55749035", "0.5566368", "0.5550208", "0.5549425", "0.55247...
0.8608646
0
Changes a specific byte in a byte array
def swap_byte(byte_array, index): if byte_array[index] == 0: changed_byte_array = byte_array[0:index] + b"\xff" + byte_array[index + 1 :] changed_byte_array = byte_array[0:index] + b"\x00" + byte_array[index + 1 :] return changed_byte_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bit(self, index_of_byte, index_of_bit, new_value):\n if index_of_bit >= self.binary_size:\n print(\"You tried to modify a byte at %d index. This cannot be done. The maximum index is %d.\"%(index_of_bit, self.binary_size - 1))\n else:\n new_value = str(new_value)\n ...
[ "0.7607034", "0.7187944", "0.6851375", "0.6837722", "0.6780952", "0.6729589", "0.6723024", "0.6679319", "0.64730704", "0.6376428", "0.6333384", "0.62949824", "0.62935746", "0.6257262", "0.6237112", "0.6162971", "0.6119067", "0.6108211", "0.61019486", "0.609579", "0.5928492", ...
0.7412648
1
Changes the interlink hash in a block hash Each block is represented with a 112 bytes hash.
def change_interlink_hash(proof, block_index): block_of_interest = proof[block_index][0] changed_block = swap_byte(block_of_interest, 0) changed_proof = ( proof[0:block_index] + [(changed_block, proof[block_index][1])] + proof[block_index + 1 :] ) return changed_proof
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_block(self):\n sha = hasher.sha256()\n sha.update((str(self.index) + str(self.timestamp) + str(self.data) + str(self.previous_hash)).endswith('utf-8'))\n return sha.hexdigest()", "def hash(self, hash):\n\n self._hash = hash", "def hash(self, hash):\n\n self._hash = h...
[ "0.6883189", "0.67876226", "0.67876226", "0.67761916", "0.67401713", "0.65702283", "0.65575254", "0.64846873", "0.6470802", "0.64679575", "0.6459402", "0.64477664", "0.6369744", "0.6369744", "0.6367037", "0.6361284", "0.6347822", "0.6322299", "0.6299315", "0.6297634", "0.6277...
0.6925265
0
Deletes a number of blocks from the proof starting from block_index
def skip_blocks(proof, block_index, skipped_blocks=1): if block_index >= len(proof): return proof for i in range(block_index, block_index + skipped_blocks): print("Deleting block", i) del proof[i] return proof
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __delitem__(self, index):\n def _removeBlock(blockIndex):\n block = self._doc.findBlockByNumber(blockIndex)\n if block.next().isValid(): # not the last\n cursor = QTextCursor(block)\n cursor.movePosition(QTextCursor.NextBlock, QTextCursor.KeepAnchor)\...
[ "0.71626973", "0.68964684", "0.62942344", "0.625104", "0.6132582", "0.60548794", "0.6051101", "0.6042633", "0.6016819", "0.59291697", "0.5908609", "0.5838923", "0.58307886", "0.5816913", "0.581112", "0.5768777", "0.5763255", "0.5763255", "0.5733283", "0.5707062", "0.5648815",...
0.8000275
0
Replaces a block in the proof. The new block has the same interlink but different header hash
def replace_block(proof, headers_map, interlink_map, block_index): prevous_block = proof[block_index - 1][0] block_hash = prevous_block[36:68] block = headers_map[block_hash] interlink = list_flatten(interlink_map[block.GetHash()]) block_2 = mine_block( block.hashPrevBlock, block.nBits - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_interlink_hash(proof, block_index):\n\n block_of_interest = proof[block_index][0]\n changed_block = swap_byte(block_of_interest, 0)\n changed_proof = (\n proof[0:block_index]\n + [(changed_block, proof[block_index][1])]\n + proof[block_index + 1 :]\n )\n return change...
[ "0.6696862", "0.6492034", "0.62668824", "0.62506884", "0.62480694", "0.6142988", "0.61030936", "0.6102814", "0.6081092", "0.6058437", "0.6036382", "0.6030431", "0.60070413", "0.5958737", "0.5852314", "0.58496255", "0.5832161", "0.5744932", "0.57379293", "0.5737272", "0.572282...
0.8152844
0
Create, edit and print chains and proofs
def main(): parser = argparse.ArgumentParser(description="Prints the contents of a NiPoPoW") parser.add_argument("--blocks", required=True, type=int, help="Number of blocks") parser.add_argument( "--output", default="proof.pkl", type=str, help="Name of exported proof" ) args = parser.parse_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n parser = argparse.ArgumentParser(\n description=\"Create and store proof from create_blockchain_new.py\"\n )\n group = parser.add_mutually_exclusive_group()\n group.add_argument(\"--blocks\", type=int, help=\"Number of blocks\")\n group.add_argument(\"--proof\", type=str, help...
[ "0.6269092", "0.593019", "0.5699991", "0.566571", "0.558477", "0.5554511", "0.5437828", "0.53985196", "0.5362294", "0.53594774", "0.5350961", "0.5350664", "0.5346109", "0.53326225", "0.5318476", "0.5311653", "0.53101516", "0.5306257", "0.5296305", "0.52940077", "0.529166", ...
0.68124014
0
Compute the structure factor through a fourier transform of the radial distribution function. The consdered trajectory must include valid elements. Atomic form factors are estimated by atomic number. The computed structure factor is only valid for certain values of Q. The lowest value of Q that can sufficiently be desc...
def structure_factor(trj, Q_range=(0.5, 50), n_points=1000, framewise_rdf=False, weighting_factor='fz'): if weighting_factor not in ['fz']: raise ValueError('Invalid weighting_factor `{}` is given.' ' The only weighting_factor currently supported is `fz`.'.format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StructureFactor(ID,f,hkl,z=None):\n ID=goodID(ID)\n i=complex(0,1)\n h=hkl[0]\n k=hkl[1]\n l=hkl[2]\n L=latticeType[ID]\n if L=='fcc':\n F=f*(1+np.exp(-i*np.pi*(k+l))+np.exp(-i*np.pi*(h+l))+np.exp(-i*np.pi*(h+k)))\n elif L=='bcc':\n F=f*(1+np.exp(-i*np.pi*(h+k+l))) \n elif...
[ "0.61005145", "0.5547126", "0.5504173", "0.54883736", "0.53962797", "0.5384088", "0.5333023", "0.5327243", "0.52803975", "0.52569383", "0.5241156", "0.52071124", "0.51957417", "0.5193955", "0.5186578", "0.51780033", "0.51702636", "0.51467496", "0.51093566", "0.5086104", "0.50...
0.62520516
0
Compute r_ij(t), the distance between atom j at time t and atom i and time 0. Note that this alone is likely useless, but is an intermediate variable in the construction of a dynamic structure factor. See 10.1103/PhysRevE.59.623.
def compute_dynamic_rdf(trj): n_atoms = trj.n_atoms n_frames = trj.n_frames r_ij = np.ndarray(shape=(trj.n_atoms, trj.n_atoms, trj.n_frames)) for n_frame, frame in enumerate(trj): for atom_i in range(trj.n_atoms): for atom_j in range(trj.n_atoms): r_ij[atom_i, atom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(ri, rj):\n return abs(ri[0] - rj[0]) + abs(ri[1] - rj[1])", "def r(self, t):\n from scipy.optimize import fsolve\n t = YEAR_TO_SEC * t\n t_coll = fsolve(lambda x: self.r_free(x) - self.snr.r_reverse(x), 4e3)\n # 4e3 years is a typical value that works for fsolve\n ...
[ "0.5410007", "0.52558136", "0.52129275", "0.51934403", "0.5120384", "0.50158536", "0.49003237", "0.48539624", "0.48512992", "0.4837882", "0.48160997", "0.4813014", "0.48086157", "0.48014414", "0.47951403", "0.47862214", "0.47764075", "0.47283062", "0.47244427", "0.47240275", ...
0.60190296
0
get the showreel item url array
def get_showreel_item_urls(self): links = [] rel_path = "../" if self.display: rel_path = rel_path * 2 for item in self.showreel_document["reels"]: if item["item_type"] == 'dashboard': link = "../%sdisplay/dashboard/%s" % (rel_path, item["title"])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURLs():", "def url(self):\n return url_for_item(self.key)", "def url(self):\n return url_for_item(self.key)", "def url(self, index):\r\n return self.arraydata[index.row()][3]", "def get_item_url(self, item):\n return self.get_absolute_url(item, 'detail')", "def get_url(...
[ "0.6485568", "0.645834", "0.645834", "0.6320854", "0.6319648", "0.63013756", "0.6289393", "0.6228144", "0.6174826", "0.6151455", "0.60874134", "0.5989771", "0.59726894", "0.59524935", "0.5925669", "0.59131056", "0.5910598", "0.58754987", "0.58629525", "0.5838614", "0.58370227...
0.8105406
0
Try to add the reporter as a fallback owner or if no alternative owners have been specified. This should work since only employees are allowed to use this request type and all employees are in LDAP.
def handle_empty_owners(): result = shared_ldap.find_from_email(shared.globals.REPORTER) if result is not None: shared_sd.post_comment( "Adding %s as the owner of the group." % shared.globals.REPORTER, True) return [result] # OK - something stupid is happening but let's give our...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user(self, requestor, requestee, default=None):\n self.lock.acquire()\n self.users.add(requestor)\n ok = requestee in self.users\n self.lock.release()\n\n # if this isn't the default app, also add the user to the default app\n if default != self and default != No...
[ "0.5346557", "0.5095638", "0.50383765", "0.5028467", "0.48953253", "0.48707283", "0.4851011", "0.48406032", "0.48377118", "0.48243517", "0.48027915", "0.4784198", "0.47707832", "0.47077477", "0.46895742", "0.46746963", "0.46505794", "0.46497324", "0.4624019", "0.46179965", "0...
0.63934386
0
From the start node assign registers as they are laid out in the ideal circuit diagram in [CDKM96]_. Assumes that the there are no dead ends in the graph, and any available neighbor can be selected from the start without any further checks.
def assign_registers_to_line_or_cycle(start: int, graph: nx.Graph, num_length: int) \ -> Tuple[Sequence[int], Sequence[int], int, int]: if 2 * num_length + 2 > nx.number_of_nodes(graph): raise ValueError("There are not enough qubits in the graph to support the computation.") graph = graph.copy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign(self, starts):\n # Initialize the set of open and closed nodes, and the connection map\n open_set, closed_set = starts, set()\n \n # Initialize a map of assignments and associated profits\n profits = {s:0 for s in starts}\n \n while open_set:\n\n ...
[ "0.62554306", "0.5982689", "0.5950736", "0.5790706", "0.5765575", "0.5628461", "0.5544183", "0.55432373", "0.55188954", "0.550841", "0.54753715", "0.5472471", "0.5345496", "0.5322016", "0.53219366", "0.5297514", "0.5297507", "0.5270394", "0.52688956", "0.5244919", "0.52377003...
0.6497673
0
Searches for a layout among the given qubits for the two nbit registers and two additional ancilla that matches the simple layout given in figure 4 of [CDKM96]_. This method ignores any considerations of physical characteristics of the qc aside from the qubit layout. An error is thrown if the appropriate layout is not ...
def get_qubit_registers_for_adder(qc: QuantumComputer, num_length: int, qubits: Optional[Sequence[int]] = None)\ -> Tuple[Sequence[int], Sequence[int], int, int]: if qubits is None: unavailable = [] # assume this means all qubits in qc are available else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_mapping_consistency(layout):\n values = sorted(layout.values())\n keys = list(layout)\n ref_keys = [\"q\" + str(i) for i in range(len(keys))]\n if keys != ref_keys:\n raise PlacementError(\"Some physical qubits in the layout may be missing or duplicated.\")\n if values != list(rang...
[ "0.49703202", "0.48756662", "0.48414853", "0.46022666", "0.45521045", "0.45476255", "0.44789764", "0.43654552", "0.43505117", "0.4343972", "0.43153837", "0.43040147", "0.43010375", "0.4282951", "0.42795786", "0.4265875", "0.42644864", "0.42477572", "0.42424133", "0.42418486", ...
0.49284887
1
Convenient wrapper for collecting the results of addition for every possible pair of n_bits long summands.
def get_n_bit_adder_results(qc: QuantumComputer, n_bits: int, registers: Optional[Tuple[Sequence[int], Sequence[int], int, int]] = None, qubits: Optional[Sequence[int]] = None, in_x_basis: bool = False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BitAdd(m, n, length):\n\n lmax = max(len(m), len(n))\n c = 0\n ml = [0] * (lmax - len(m)) + [int(x) for x in list(m)]\n nl = [0] * (lmax - len(n)) + [int(x) for x in list(n)]\n rl = []\n for i in range(1, lmax+1):\n if ml[-i] + nl[-i] + c == 0:\n rl.insert(0, 0)\n ...
[ "0.639511", "0.63929343", "0.59793633", "0.59044194", "0.5766572", "0.573465", "0.56742185", "0.5659172", "0.5646547", "0.56439763", "0.56177783", "0.5554337", "0.555092", "0.5537357", "0.5496097", "0.549155", "0.5491507", "0.54769105", "0.54585946", "0.54068106", "0.54036504...
0.6577094
0
Get the probability of a successful addition for each possible pair of two n_bit summands from the results output by get_n_bit_adder_results
def get_success_probabilities_from_results(results: Sequence[Sequence[Sequence[int]]]) \ -> Sequence[float]: num_shots = len(results[0]) n_bits = len(results[0][0]) - 1 probabilities = [] # loop over all binary strings of length n_bits for result, bits in zip(results, all_bitstrings(2 * n_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_n_bit_adder_results(qc: QuantumComputer, n_bits: int,\n registers: Optional[Tuple[Sequence[int], Sequence[int], int,\n int]] = None,\n qubits: Optional[Sequence[int]] = None, in_x_basis: bool = False,...
[ "0.67043245", "0.6088592", "0.6078585", "0.60144264", "0.5993007", "0.59269917", "0.59174794", "0.5848427", "0.58017844", "0.5783029", "0.57710576", "0.57601815", "0.5722196", "0.57119036", "0.5695961", "0.5689013", "0.5688207", "0.56689256", "0.5668077", "0.5657879", "0.5653...
0.6910166
0
Get the distribution of the hamming weight of the error vector (number of bits flipped between output and expected answer) for each possible pair of two n_bit summands using results output by get_n_bit_adder_results
def get_error_hamming_distributions_from_results(results: Sequence[Sequence[Sequence[int]]]) \ -> Sequence[Sequence[float]]: num_shots = len(results[0]) n_bits = len(results[0][0]) - 1 hamming_wt_distrs = [] # loop over all binary strings of length n_bits for result, bits in zip(results, al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_possible_outcomes(m, bits):\n\n # This is filled with loads of dirty binary tricks...You have been warned\n\n size = max(m.shape) # Max of shape to account for bra or ket\n nqubits = int(math.log(size, 2) + .1) # Number of qubits possible\n\n # Make the output states and put in output_matric...
[ "0.616687", "0.588979", "0.5826358", "0.58103514", "0.5805173", "0.5767479", "0.5664263", "0.5663091", "0.5662125", "0.56533957", "0.5645126", "0.56185484", "0.556853", "0.55329996", "0.54994404", "0.5493898", "0.546257", "0.544698", "0.5440642", "0.5435228", "0.5425672", "...
0.70478463
0
Writes the predicted bounds in a CSV file.
def write_results(file_path, predictions): with open(file_path, "w") as csv_file: writer = csv.writer(csv_file, delimiter=",") writer.writerow(["Id", "Bound"]) for id, bound in enumerate(predictions): writer.writerow([id, bound])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounds():\n\n with open('bounds.csv', 'w', newline='') as file:\n writer = csv.writer(file, delimiter=\",\")\n writer.writerow([\"File_number\", \"Bounds:Left\", \"Bounds:Bottom\" , \"Bounds:Right\" , \"Bounds:Top\"])\n \n for i in range(1,44):\n if i < 10:\n df = raste...
[ "0.67489994", "0.64240366", "0.6419536", "0.6406355", "0.63975656", "0.6377383", "0.6377383", "0.63396955", "0.6324414", "0.61491704", "0.61022496", "0.60909176", "0.6053285", "0.60495895", "0.59979385", "0.5981814", "0.59722394", "0.5954778", "0.59425664", "0.59258956", "0.5...
0.72739613
0
compute water flux through each node
def get_flux(self): # iterate through points from top to bottom points = sorted(self.graph,key=lambda n: -n.z) for n in points: if n.z >= self.sealevel: n.flux += 1 zmin = n.z zmin2 = 1e99 min_n = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.6161182", "0.5917691", "0.58981144", "0.5796191", "0.57369494", "0.57369494", "0.5732621", "0.5730577", "0.56704056", "0.5608803", "0.5575318", "0.5570114", "0.5533653", "0.55209166", "0.54866004", "0.5477688", "0.5452558", "0.5441911", "0.5438859", "0.5436432", "0.5420254...
0.66064185
0
normalize the water flux
def normalize_flux(self): fmax = 0 fmin = 1e99 for n in self.graph: if n.flux > fmax: fmax = n.flux if n.flux < fmin: fmin = n.flux for n in self.graph: n.flux = (n.flux-fmin)/(fmax-fmin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(wav, flux):\n return flux / flux.max() # maximum flux = 1\n\n # flux_norm = flux[wav>wav_norm][0]\n # return flux / flux_norm", "def _remove_flux_extinction(self):\n self.fluxUnred = self.flux.copy()\n self.fluxErrUnred = self.fluxErr.copy()\n self.fluxRenorm = self.f...
[ "0.720098", "0.71839106", "0.6935991", "0.6906558", "0.6506962", "0.6337792", "0.63301474", "0.6324191", "0.6317181", "0.63122255", "0.63009006", "0.62984145", "0.62856394", "0.6277954", "0.6255731", "0.62402797", "0.62205225", "0.6218154", "0.6181237", "0.61712116", "0.61687...
0.77366555
0
Saves the parameters into a dictionary that can later be e.g. savez'd. It is different from the Pytorch version in that the prefix of the variables is determined by the variable (/name?) scopes used when the cell was defined.
def save_parameters(self, session, out_dict=None): if out_dict is None: out_dict = {} for w in self.weights: out_dict[w.name.rsplit(':', 1)[0]] = session.run([w])[0] return out_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _variables_to_save(self):\n save_vars = self.weights + self.biases\n save_names = [_.name for _ in save_vars]\n save_dict = {name: var for name, var in zip(save_names, save_vars)}\n return save_dict", "def save_parameters(self):\n paramfile = os.path.join(self._datadir, sel...
[ "0.70121944", "0.6368089", "0.636776", "0.63463885", "0.622241", "0.6198613", "0.61972576", "0.616711", "0.6138725", "0.61033726", "0.6083243", "0.6026282", "0.5963769", "0.5925412", "0.5909473", "0.5871749", "0.5840318", "0.58307344", "0.5823209", "0.5816673", "0.5795027", ...
0.6631182
1
Get a list containing all elements in the arma_container.
def _get_list_of_elements(arma_container): n_elem = arma_container["n_elem"] mem = arma_container["mem"] elem_type = mem.type.target().unqualified() if 'complex' in elem_type.name: return [_cast_to_complex(mem[i]) for i in range(n_elem)] return [mem[i] for i in range(n_elem)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(self):\n return list(self.iterator())", "def get_array(arma_container):\n # In case the user passed the name of the varaible, instead of a gdb.Value,\n # we get the corresponding gdb.Value\n if isinstance(arma_container, str):\n arma_container = gdb.parse_and_eval(arma_container)\n...
[ "0.6568955", "0.65409666", "0.65166247", "0.6506832", "0.6444223", "0.64083475", "0.6289796", "0.62836426", "0.6215201", "0.62119395", "0.62043554", "0.6201367", "0.61920005", "0.61659324", "0.6161435", "0.61315525", "0.6113563", "0.610823", "0.61022896", "0.60991925", "0.607...
0.77745867
0
Get a numpy array with the elements and shape of arma_container.
def get_array(arma_container): # In case the user passed the name of the varaible, instead of a gdb.Value, # we get the corresponding gdb.Value if isinstance(arma_container, str): arma_container = gdb.parse_and_eval(arma_container) n_rows = arma_container["n_rows"] n_cols = arma_container["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_array(self):\n return numpy.array(self._ar)", "def _get_list_of_elements(arma_container):\n n_elem = arma_container[\"n_elem\"]\n mem = arma_container[\"mem\"]\n elem_type = mem.type.target().unqualified()\n\n if 'complex' in elem_type.name:\n return [_cast_to_complex(mem[i]) fo...
[ "0.63321656", "0.60761553", "0.59460145", "0.5888306", "0.577478", "0.5766841", "0.5765605", "0.5678656", "0.5668666", "0.5647278", "0.56204003", "0.5608568", "0.5605443", "0.55823827", "0.558154", "0.55734915", "0.55721813", "0.55278605", "0.55197483", "0.5516481", "0.550788...
0.8301161
0
Resolve the class from the name.
def _find_class(self, class_name: str) -> Type: return self.class_resolver.find_class(class_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(self, name):\n return self.host.get_class(name)", "def resolve(name, package=None):\n if isinstance(package, str):\n package = resolve_exposing(package)\n\n if package:\n name = resolve_name('.{}'.format(name), package.__name__)\n\n try:\n # Try to get a module\...
[ "0.74996245", "0.73361564", "0.7004807", "0.6987053", "0.6950935", "0.6922196", "0.6742277", "0.6717653", "0.6633428", "0.65981287", "0.65763247", "0.65573215", "0.653002", "0.6524172", "0.6512038", "0.64399755", "0.64003175", "0.6386054", "0.63680243", "0.63540214", "0.63294...
0.74676466
1
Create an instance from a string used as option values in the configuration.
def from_config_string(self, v: str) -> Any: try: v = eval(v) except Exception: pass return self.instance(v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromstring(cls, string: str) -> 'Config':\n parser: configparser.ConfigParser = configparser.ConfigParser()\n parser.read_dict(dict(wpwatcher=Config.DEFAULT_CONFIG))\n parser.read_string(string)\n return cls.fromparser(parser)", "def from_str(cls, string):", "def create_from_arg...
[ "0.7496791", "0.7046284", "0.69129837", "0.6713198", "0.6646999", "0.6635789", "0.65656", "0.6554868", "0.6504417", "0.6445628", "0.6414875", "0.64102495", "0.64068425", "0.63516784", "0.63483465", "0.6325155", "0.63146764", "0.63088036", "0.62712175", "0.62662363", "0.625306...
0.7862316
0
Clear any shared instances.
def clear(self): if self._shared is not None: self._shared.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(cls):\n cls._options = None\n cls._scoped_instances = {}", "def clear(self):\n return self._shared.clear()", "def clear_all(self):\n self.clear_redis()\n self.clear_cache()", "def clear_existing_modulestores():\r\n _MODULESTORES.clear()\r\n # pylint: disable=W0603\r...
[ "0.7023126", "0.6997275", "0.6878664", "0.6802849", "0.67914337", "0.6789421", "0.677575", "0.6768056", "0.67593515", "0.67557675", "0.6740717", "0.673127", "0.66101474", "0.6594861", "0.6563134", "0.65380585", "0.6535941", "0.65331453", "0.65293664", "0.6524044", "0.64898026...
0.7952969
0
Remove a shared (cached) object instance.
def clear_instance(self, name: str): if self._shared is not None: return self._shared.pop(name, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __delete__(self, obj):\n self._instances.pop(obj, None)", "def __delete__(self, obj):\n try:\n delattr(obj, self.cache_attr)\n except AttributeError:\n pass", "def __delete__(self, instance):\r\n self._set_instance_tag_cache(instance, '')", "def __delitem...
[ "0.72336996", "0.70047504", "0.67317575", "0.65398216", "0.64740163", "0.6439759", "0.6388525", "0.63874376", "0.6383596", "0.6340609", "0.63090307", "0.62901396", "0.62720126", "0.6261938", "0.62247956", "0.61950535", "0.6124602", "0.6124602", "0.6124602", "0.6124602", "0.61...
0.7036074
1
test escape value as list
def test_escape_value_as_list(self): testdict = escapeddict.EscapedDict({'key1': 'value1', 'key2': ['value2', '${key1}']}) for key in testdict.keys(): print testdict[key] assert testdict['key1'] == 'value1' assert testdict['key2'] == ['value2', 'value1']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listify(string, cast, expected):\n assert listify(string, cast) == expected", "def test_list(self):\n self.assertValue(\n ['foo', 'bar', 'hello'],\n 'foo\\nbar\\nhello\\n')", "def escape_list(mylist, escape_func):\n def escape(obj, escape_func=escape_func):\n tr...
[ "0.6201542", "0.61983675", "0.6041012", "0.6039107", "0.5854672", "0.5772972", "0.577114", "0.5768124", "0.5748182", "0.5698718", "0.5668131", "0.56647766", "0.56357306", "0.5625137", "0.561815", "0.5606561", "0.5593773", "0.55318505", "0.553185", "0.55124164", "0.5487262", ...
0.662992
0
List the labels for the selected repository, default to repo in $PWD
def list_labels(service, repo): app = App() if repo: serv = app.get_service(service, repo=repo) else: serv = app.guess_service() repo_labels = serv.list_labels() if not repo_labels: print("No labels.") return print(tabulate([ ( label.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels(self):\r\n return labels.RepoLabels(self)", "def pull_labels(self, org):\n pass", "def getRepositoryName(self) -> unicode:\n ...", "def label(self, name):\r\n return labels.RepoLabel(self, name)", "def list_labels(self, repository):\n data = self._get_all_data(...
[ "0.7004953", "0.6531647", "0.6462931", "0.64514655", "0.6393306", "0.62721145", "0.6158077", "0.60925114", "0.6084946", "0.6084346", "0.6019508", "0.5938833", "0.590257", "0.5895671", "0.58784527", "0.5789973", "0.5752763", "0.57323766", "0.5720196", "0.5695936", "0.5695936",...
0.6889077
1
Initializes the Perceptron classifier. X and Y is the training data over which to learn the hyperplane If is_stochastic is True then the perceptron gradient steps will be stochastic not batch. step_size is the learning rate to be used. max_steps is the maximum number of iterations to use before giving up reg_constant i...
def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) self.X = X self.Y = Y self.is_stochastic = is_stochastic if is_stochastic: self.logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, reg_penalty='l2', reg=0.001, k_fold=5, random_state=0):\n print(\"Initialize model Perceptron\")\n self.reg_penalty = reg_penalty\n self.reg = reg\n self.k_fold = k_fold\n self.random_state = random_state\n self.model = sklearn.linear_model.Perceptron(pe...
[ "0.68595326", "0.65547884", "0.5741013", "0.5741013", "0.5584914", "0.55068773", "0.5470129", "0.54565686", "0.5436972", "0.5432392", "0.5429865", "0.54216933", "0.5421074", "0.5415532", "0.5360338", "0.5347944", "0.53139025", "0.5288166", "0.5265048", "0.5245604", "0.5243017...
0.75320524
0
Learn the separating hyperplane on the training data
def learn(self): Xt = np.append(np.ones((self.X.shape[0], 1)), self.X, axis=1) Yt = self.Y * 2 - 1 w = np.ones(Xt.shape[1]) # avoiding random init, for debugging lw = [[] for k in range(len(w))] for iter in range(self.max_steps): P = Yt * np.dot(Xt, w) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learn(self, Xtrain, ytrain):", "def train(self,features,y):\r\n \r\n if self.learn_type == \"nn\":\r\n #generate supervised dataset\r\n return(self.learner.train_on_batch(features,y))\r\n elif self.learn_type == \"linear\":\r\n grad = 0\r\n n =...
[ "0.6684203", "0.65931565", "0.6561966", "0.65566397", "0.65173364", "0.65173364", "0.65173364", "0.65173364", "0.65173364", "0.651586", "0.6497621", "0.6492383", "0.64562017", "0.64562017", "0.64539695", "0.6443783", "0.64437324", "0.6395101", "0.63939685", "0.6296024", "0.62...
0.69079155
0
Classify the given test set using the learned perceptron (and learning the perceptron to being with if not already done so). Returns confusion matrix of test result accuracy.
def classify(self, X_test, Y_test): if self.w is None: self.learn() c_matrix = np.asarray([[0, 0],[0,0]]) Xt = np.append(np.ones((X_test.shape[0], 1)), X_test, axis=1) Yt = Y_test class_prediction = np.sign(np.dot(Xt, self.w)) class_prediction = ((class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_confusion_matrix(y_true, y_pred):\r\n\r\n ## 3 classes\r\n TP1, TP2, TP3, FP1, FP2, FP3, TN1, TN2, TN3, FN1, FN2, FN3 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\r\n\r\n for i in range(y_true.shape[0]):\r\n if y_true[i] == 0 and y_pred[i] == 0:\r\n TN1 += 1\r\n elif y_true[i] == ...
[ "0.6630832", "0.6571028", "0.6556596", "0.6473314", "0.64309907", "0.63886297", "0.6370331", "0.63595635", "0.6339869", "0.6319275", "0.6307369", "0.6293895", "0.6267422", "0.6246962", "0.6246624", "0.62017965", "0.61903733", "0.61852807", "0.6155317", "0.61364126", "0.613271...
0.66055423
1
Provides callable object inspection result or raises an error when obj is not callable.
def __call__(self, obj: Any) -> CallableDetails: try: return CallableInspector.inspect(obj) except TypeError as e: raise IncompatibleHandlerFactoryError(f"{obj!r}: {e}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, obj: Any) -> CallableDetails:\n if self.subtype_of:\n if not isinstance(obj, self.subtype_of):\n raise IncompatibleHandlerFactoryError(\n f\"Object {obj!r} is not type of {self.subtype_of}\"\n )\n\n try:\n attr ...
[ "0.7163641", "0.69516593", "0.6710954", "0.66706973", "0.65568036", "0.624132", "0.61493", "0.6052162", "0.59412193", "0.5892052", "0.5885314", "0.58713126", "0.5717462", "0.57091385", "0.56844", "0.5650436", "0.5562526", "0.5492107", "0.5492107", "0.5463869", "0.5458223", ...
0.7690511
0
(Optionally) checks if object has valid type and performs callable inspection for given object attribute.
def __call__(self, obj: Any) -> CallableDetails: if self.subtype_of: if not isinstance(obj, self.subtype_of): raise IncompatibleHandlerFactoryError( f"Object {obj!r} is not type of {self.subtype_of}" ) try: attr = getattr(obj, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_object_input_type(func):\n @functools.wraps(func)\n def wrapper_check_input_type(ref, *args):\n new_args = [ref]\n for X in list(args):\n new_args.append(_check_type(X))\n return func(*new_args)\n return wrapper_check_input_type", "def callable(obj): # pylint: ...
[ "0.61445147", "0.60613203", "0.60088813", "0.6008327", "0.58711815", "0.5799993", "0.579401", "0.5771895", "0.5769235", "0.5731567", "0.57004875", "0.56973535", "0.5679467", "0.5675889", "0.5657475", "0.5612071", "0.55735457", "0.5561901", "0.5561592", "0.5544593", "0.5535281...
0.6381683
0
Provides callable primary argument using `CallableDetails` object.
def __call__(self, details: CallableDetails) -> CallableArg: if not details.args: raise IncompatibleHandlerFactoryError( f"Callable {details.obj!r} has no explicit argument" ) arg = self._find(details) self._check_type(details, arg) return arg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_first(details: CallableDetails) -> CallableArg:\n return details.args[0]", "def _find(self, details: CallableDetails) -> CallableArg:\n if self.name:\n return self._find_by_name(details, self.name)\n else:\n return self._get_first(details)", "def test_from_ca...
[ "0.7109241", "0.59839714", "0.5851964", "0.58431125", "0.5791142", "0.54043776", "0.5352862", "0.5227098", "0.5096238", "0.50932515", "0.5063101", "0.5007558", "0.49452066", "0.49097756", "0.48993295", "0.48318905", "0.4823576", "0.47898644", "0.47738937", "0.47529116", "0.47...
0.6864968
1
Finds primary callable argument using given details
def _find(self, details: CallableDetails) -> CallableArg: if self.name: return self._find_by_name(details, self.name) else: return self._get_first(details)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_by_name(details: CallableDetails, name: str):\n arg = details.arg_by_name(name)\n if not arg:\n raise IncompatibleHandlerFactoryError(\n f\"Callable {details.obj!r} has no argument named {name}\"\n )\n return arg", "def _get_first(details: Calla...
[ "0.7250849", "0.7104405", "0.7012228", "0.631682", "0.6020039", "0.6020039", "0.58984846", "0.57014513", "0.56677234", "0.56464416", "0.5597287", "0.55221516", "0.55119926", "0.55059236", "0.5500081", "0.54900837", "0.5486182", "0.5480125", "0.5451048", "0.5394405", "0.539440...
0.80219805
0
Tries to find primary argument by name using given callable details.
def _find_by_name(details: CallableDetails, name: str): arg = details.arg_by_name(name) if not arg: raise IncompatibleHandlerFactoryError( f"Callable {details.obj!r} has no argument named {name}" ) return arg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find(self, details: CallableDetails) -> CallableArg:\n if self.name:\n return self._find_by_name(details, self.name)\n else:\n return self._get_first(details)", "def __call__(self, details: CallableDetails) -> CallableArg:\n if not details.args:\n raise ...
[ "0.77201855", "0.67343926", "0.66744506", "0.6343532", "0.6250514", "0.6208963", "0.6162616", "0.6035895", "0.6024393", "0.5917119", "0.58666784", "0.5737716", "0.57368076", "0.5725504", "0.55969244", "0.5583836", "0.5477477", "0.5477477", "0.54448164", "0.54358494", "0.54218...
0.79737496
0
Returns first callable argument as primary
def _get_first(details: CallableDetails) -> CallableArg: return details.args[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCallable():", "def one():\n return lambda f: lambda x: f(x)", "def _sfn(x):\n if len(x) == 1:\n return x[0]\n return fn(*x)", "def get_function(callable_):\n if isinstance(callable_, types.MethodType):\n return callable_.__func__\n return callable_", "def ide...
[ "0.66960406", "0.66022676", "0.63933474", "0.63744426", "0.62180066", "0.62013626", "0.6177867", "0.6130913", "0.60381055", "0.5894257", "0.5885121", "0.5880763", "0.5877375", "0.5840235", "0.58239746", "0.5770503", "0.57519287", "0.5726868", "0.5700403", "0.568225", "0.56512...
0.77594995
0
The column_expression() method is overridden to ensure that the SRID of the resulting WKBElement is correct
def column_expression(self, col): return getattr(func, self.impl.as_binary)( func.ST_Transform(col, self.app_srid), type_=self.__class__.impl(srid=self.app_srid) # srid could also be -1 so that the SRID is deduced from the # WKB data )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _column_water_vapor_expression(self):\n cwv_expression = '({c0}) + ({c1}) * ({Rji}) + ({c2}) * ({Rji})^2'\n\n return cwv_expression.format(c0=self.c0, c1=self.c1,\n Rji=DUMMY_Rji, c2=self.c2)", "def getGeometryColumnDef(self, schema, table, column):\r\n ...
[ "0.54994905", "0.51402336", "0.5061275", "0.501166", "0.49931175", "0.49211967", "0.4909486", "0.49018234", "0.4897842", "0.4888631", "0.487397", "0.4867399", "0.480978", "0.4799372", "0.4791726", "0.47903332", "0.47858167", "0.47667444", "0.47633633", "0.47496134", "0.474640...
0.7445827
0
Check if driver is installed and returns path
def getDriverPath(self, driverFolder, browser=None): for driverPath in list(driverFolder.glob('**/*.exe')): if browser is not None: if browser.lower() in driverPath.name: self.driverInstalledBool = True self.driverPath = driverPath ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_driver(drv):\n return GenericDriver.get_driver(drv)", "def driver_dir(self):\n if not self.metadata.driver_path:\n raise DriverParameterUndefined(\"driver_path undefined in metadata\")\n \n return os.path.join(self.driver_base_dir(),self.metadata.driver_path)", "def i...
[ "0.62105215", "0.59944856", "0.59613276", "0.5892248", "0.58769554", "0.5870386", "0.5859039", "0.58575493", "0.5809612", "0.57703876", "0.5740861", "0.57091326", "0.5631043", "0.5594376", "0.5565031", "0.5551958", "0.5550571", "0.55480534", "0.55416816", "0.5540941", "0.5538...
0.60263956
1
Creates selenium driver for webscrapping automation Downloads it into driver folder if not installed
def _downloadDriver(self): if not self.driverFolder.exists(): os.mkdir("driver") msgTxt = "User agent: " + self.userAgent + "<br>" self.announcer.announce(self.announcer.format_sse(msgTxt)) for browserVersion in self.userAgent.split(" "): if browserVersion.spli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_selenium():\n # Define the options to run with headless mode enabled\n options = Options()\n options.headless = True\n\n # Instatiate the browser object here, pointing at an exectable location which should be located in the same\n # base directory as the script\n driver = webdriver.Fire...
[ "0.6866805", "0.6855302", "0.6822128", "0.6610871", "0.6569253", "0.656648", "0.6483102", "0.64660627", "0.6465365", "0.6460813", "0.63670164", "0.6320266", "0.6313826", "0.6309802", "0.6277847", "0.62708163", "0.62688744", "0.62457854", "0.6199809", "0.61945736", "0.6123801"...
0.7487497
0
load old similarity matrix
def load_similarity(self, old_similarity_file): with open(old_similarity_file) as old_sim_f: for line in old_sim_f: fields = line.strip('\n').strip('\t').split('\t') if len(fields) == 2: s_vid = fields[0] score_str = fields[1] score_list = score_str.strip(' ').strip(',').split(',') if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_matrix(self,filename):\n\n f = open(filename,'rb')\n tmp_dict = pickle.load(f)\n f.close()\n\n self.__dict__.update(tmp_dict)", "def loadmm(filepath):\n X = mmread(filepath)\n return fast_sparse_matrix(X)", "def load_matrices(self):\n self.wine_matrix =...
[ "0.62743086", "0.60209167", "0.5906724", "0.5877388", "0.58082116", "0.5714799", "0.5703919", "0.5644914", "0.56408775", "0.56357896", "0.56273323", "0.559635", "0.55857587", "0.5553376", "0.5532568", "0.55293345", "0.5527956", "0.5517922", "0.5509022", "0.55003285", "0.54926...
0.7791207
0
compute similarity matrix first compute similarity between old_video and videos then compute inner similarity of videos
def compute(self, old_videos, videos): linear_simialarity = LinearStructuralSimilarity([1.0, 0.5, 0.5, 0.5]) title_similarity = TitleSimilarity() tag_similarity = TagSimilarity() star_similarity = StarSimilarity() #compute doc vector for new vector self.compute_doc_vector(videos) #init s_matrix for new v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_similarity(self):\n self.assertTrue(np.allclose(self.vectors.similarity('dog.n.01', 'dog.n.01'), 1))\n self.assertTrue(np.allclose(self.vectors.similarity('dog.n.01', 'mammal.n.01'), 0.180901358))", "def _calculate_similarity(self):\n self._logger.info(\"Calculating the similarity b...
[ "0.64262533", "0.6343288", "0.62151086", "0.6100288", "0.6099385", "0.60799444", "0.60501516", "0.6000153", "0.5994331", "0.5971573", "0.59625435", "0.5956585", "0.59330136", "0.5927438", "0.5920449", "0.5868006", "0.586378", "0.5842844", "0.5842844", "0.5830501", "0.58297914...
0.82006574
0
Returns the nested nodes in the body of a node.
def get_children(cls, node: ast.AST) -> Iterable[ast.AST]: body: Optional[Sequence[ast.AST]] = getattr(node, 'body', None) if body is not None: for child in body: yield child
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_child_nodes(node):\r\n return list(iter_child_nodes(node))", "def nodes(self):\r\n return (node.content for node in self.traverse())", "def children(node):\n\n return snd(node)", "def getVisitableNodes(self):\n\n value = self.subnode_loop_body\n\n if value is None:\n ...
[ "0.62883824", "0.6253895", "0.60750514", "0.60332704", "0.6013374", "0.58077276", "0.5789496", "0.56801975", "0.5561987", "0.54618096", "0.5426877", "0.5400886", "0.5373536", "0.5360819", "0.53477675", "0.534337", "0.5341113", "0.528977", "0.52756613", "0.52542585", "0.524975...
0.659452
0
Utility function to iterate assignments targets.
def iterassign(node:_AssingT) -> Iterator[Optional[List[str]]]: for target in node.targets if isinstance(node, ast.Assign) else [node.target]: dottedname = node2dottedname(target) yield dottedname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[BaseAssignment]:\n for assignments in self._assignments.values():\n for assignment in assignments:\n yield assignment", "def itermappings(self):\r\n return self.by_target.iteritems()", "def _init_targets(self):\n for ga_main, ga_targ i...
[ "0.6238221", "0.5730798", "0.57177293", "0.5576891", "0.5542461", "0.5514287", "0.5509637", "0.5486392", "0.5366283", "0.52967846", "0.52836627", "0.52819365", "0.5270679", "0.52261263", "0.52149117", "0.5211757", "0.5205998", "0.5185069", "0.5171819", "0.51701444", "0.514724...
0.71894705
0
Resove expression composed by L{ast.Attribute} and L{ast.Name} nodes to a list of names.
def node2dottedname(node: Optional[ast.AST]) -> Optional[List[str]]: parts = [] while isinstance(node, ast.Attribute): parts.append(node.attr) node = node.value if isinstance(node, ast.Name): parts.append(node.id) else: return None parts.reverse() return parts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllNames(eList):\n if isinstance(eList, ast.Name): return [eList.id]\n if isinstance(eList, ast.List) or isinstance(eList, ast.Tuple):\n res = []\n for e in eList.elts:\n res += ModuleAffectation.getAllNames(e)\n return res\n\n #in attribute case\n return []", "def get_al...
[ "0.6460676", "0.60729074", "0.60377926", "0.59901816", "0.5879251", "0.58321583", "0.5814663", "0.5758657", "0.5712307", "0.5655078", "0.5655078", "0.5606655", "0.56022793", "0.55556303", "0.5539344", "0.553789", "0.55322945", "0.5528631", "0.5528631", "0.5498755", "0.5482725...
0.6924144
0
Binds the arguments of a function call to that function's signature.
def bind_args(sig: Signature, call: ast.Call) -> BoundArguments: kwargs = { kw.arg: kw.value for kw in call.keywords # When keywords are passed using '**kwargs', the 'arg' field will # be None. We don't currently support keywords passed that way. if kw.arg is not None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind(self, arg_names, **bound_params):\n bound_params=bound_params.copy()\n covered_args=set(bound_params)\n covered_args.update(arg_names)\n uncovered_mand_args=self.get_mandatory_args().difference(covered_args)\n if len(uncovered_mand_args)>0:\n raise TypeError(\...
[ "0.686672", "0.651832", "0.6490218", "0.64504725", "0.6233059", "0.61366934", "0.61016405", "0.6081702", "0.6081072", "0.5982045", "0.5922101", "0.5889668", "0.5869697", "0.5827673", "0.58158183", "0.57584053", "0.57411826", "0.57127994", "0.571075", "0.5703124", "0.5699975",...
0.7262054
0
Returns whether or not the given L{ast.Compare} is equal to C{__name__ == '__main__'}.
def is__name__equals__main__(cmp: ast.Compare) -> bool: return isinstance(cmp.left, ast.Name) \ and cmp.left.id == '__name__' \ and len(cmp.ops) == 1 \ and isinstance(cmp.ops[0], ast.Eq) \ and len(cmp.comparators) == 1 \ and _is_str_constant(cmp.comparators[0], '__main__')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyname(ifmain=False):\n\n if ifmain is True:\n return __name__ == \"__main__\"\n return __name__", "def test_86_entry_point(self):\n\t\tinput = \"\"\"function main():boolean; begin return true; end\"\"\"\n\t\texpect = \"No entry point\"\n\t\tself.assertTrue(TestChecker.test(input,expect,486))", ...
[ "0.6524941", "0.5941381", "0.58739746", "0.56843954", "0.5605056", "0.5605056", "0.55951595", "0.555615", "0.5535139", "0.5534004", "0.5527757", "0.5511792", "0.5495729", "0.54766375", "0.5437922", "0.53829", "0.53390026", "0.5324442", "0.5317175", "0.5284627", "0.5268249", ...
0.81914234
0
Detect if this expr is firstly composed by one of the specified annotation(s)' full name.
def is_using_annotations(expr: Optional[ast.AST], annotations:Sequence[str], ctx:'model.Documentable') -> bool: full_name = node2fullname(expr, ctx) if full_name in annotations: return True if isinstance(expr, ast.Subscript): # Final[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _has_annotation(annotation, value):\n def matches_property_name(fun):\n \"\"\" return true if fun is a callable that has the correct annotation with value \"\"\"\n return callable(fun) and getattr(fun, annotation, None) == value\n\n return matches_property_name", "def find_decorator_annot...
[ "0.6133732", "0.5805781", "0.5771596", "0.57191354", "0.57060945", "0.56400615", "0.545979", "0.52515405", "0.518645", "0.5162041", "0.51450115", "0.51298565", "0.5105125", "0.509733", "0.5071324", "0.50644857", "0.5061237", "0.50583386", "0.50457674", "0.5022702", "0.5016724...
0.70489085
0
Does this AST node represent the literal constant None?
def is_none_literal(node: ast.expr) -> bool: return isinstance(node, (ast.Constant, ast.NameConstant)) and node.value is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_literal(node):\n # Normal literals, True/False/None/Etc. in Python3\n if is_constant(node):\n return True\n\n # True/False/None/Etc. in Python2\n if isinstance(node, gast.Name) and node.id in ['True', 'False', 'None']:\n return True\n\n return False", "def is_none(obj):\n return obj is None"...
[ "0.71573704", "0.69151956", "0.685752", "0.6803881", "0.67793304", "0.6737035", "0.6721206", "0.6624201", "0.66209817", "0.6463004", "0.64455515", "0.6415827", "0.6412687", "0.63989663", "0.6345217", "0.63196254", "0.63196254", "0.6287789", "0.6263268", "0.6203727", "0.616627...
0.8856685
0
Whether this annotation node refers to a typing alias.
def is_typing_annotation(node: ast.AST, ctx: 'model.Documentable') -> bool: return is_using_annotations(node, TYPING_ALIAS, ctx) or \ is_using_annotations(node, SUBSCRIPTABLE_CLASSES_PEP585, ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assigns_typealias(node: nodes.NodeNG | None) -> bool:\n inferred = utils.safe_infer(node)\n if isinstance(inferred, nodes.ClassDef):\n if inferred.qname() == \".Union\":\n # Union is a special case because it can be used as a type alias\n # or as a type a...
[ "0.802317", "0.6705739", "0.6592284", "0.6592182", "0.65373164", "0.6446264", "0.64429694", "0.6420348", "0.5929463", "0.591582", "0.5890334", "0.5854305", "0.5834295", "0.58193356", "0.58193356", "0.5818589", "0.5749064", "0.57306594", "0.57211465", "0.5695293", "0.56425035"...
0.7278951
1
r""" In older CPython versions, the AST only tells us the end line number and we must approximate the start line number. This approximation is correct if the docstring does not contain explicit newlines ('\n') or joined lines ('\' at end of line). Leading blank lines are stripped by cleandoc(), so we must return the li...
def extract_docstring_linenum(node: ast.Str) -> int: doc = node.s lineno = node.lineno if _string_lineno_is_end: # In older CPython versions, the AST only tells us the end line # number and we must approximate the start line number. # This approximation is correct if the docstring do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_docstring(node: ast.Str) -> Tuple[int, str]:\n lineno = extract_docstring_linenum(node)\n return lineno, inspect.cleandoc(node.s)", "def get_line_no(obj):\n try:\n lineno = getsourcelines(obj)[1]\n except:\n # no code found\n lineno = None\n return lineno", "def ...
[ "0.6592318", "0.64880145", "0.62865794", "0.6142324", "0.6134017", "0.6064574", "0.5985964", "0.598403", "0.59628624", "0.5903572", "0.5894252", "0.5847096", "0.5840898", "0.5822657", "0.5815142", "0.58113086", "0.57936656", "0.57820433", "0.5780574", "0.5721187", "0.57102555...
0.82820135
0
Extract docstring information from an ast node that represents the docstring.
def extract_docstring(node: ast.Str) -> Tuple[int, str]: lineno = extract_docstring_linenum(node) return lineno, inspect.cleandoc(node.s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_info(self, docstring):\n pass", "def get_docstring(node, trim=True):\r\n if not isinstance(node, (FunctionDef, ClassDef, Module)):\r\n raise TypeError(\"%r can't have docstrings\" % node.__class__.__name__)\r\n if node.body and isinstance(node.body[0], Expr) and \\\r\n isins...
[ "0.7227713", "0.68695927", "0.6678261", "0.6563689", "0.65097564", "0.63284135", "0.6290309", "0.62477165", "0.6228817", "0.6196725", "0.59609747", "0.58749866", "0.58451766", "0.58434576", "0.58255154", "0.57662874", "0.57577497", "0.5751068", "0.57465714", "0.5742046", "0.5...
0.77947456
0
Parse binary data to a (list of) ticks structure.
def _parse_binary(self, bin): packets = self._split_packets(bin) # split data to individual ticks packet data = [] print_message("_parse_binary ") for packet in packets: instrument_token = self._unpack_int(packet, 0, 4) segment = instrument_token & 0xff # Retriv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_data( self, data ):\n data = data.split( ',' )\n data = list( map( lambda x: x.strip(), data ) ) # remove white space\n # create data structure\n fields = [\n 'time',\n 'value'\n ] \n Reading = namedtuple( 'Reading', fields )\n \n ...
[ "0.61135006", "0.6055378", "0.60015744", "0.58360213", "0.58193314", "0.57560265", "0.5685558", "0.5674893", "0.5644839", "0.56013477", "0.5601027", "0.5582937", "0.55707127", "0.55646104", "0.55526763", "0.55485", "0.5535959", "0.5530505", "0.55291134", "0.5478263", "0.54535...
0.6553171
0
get_output_names(hf) Returns a list of the output variables names in the HDF5 file.
def get_output_names(hf): return sorted(map(str, hf['/output/data'].keys()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_names(self):\n outputNames = []\n for outVar in self.outputs:\n # outVar is of type InOutVar and the object that it contains is a PyFMI variable\n outputNames.append(outVar.get_object().name)\n return outputNames", "def get_output_names():\n names = [d...
[ "0.76356333", "0.6916509", "0.6748627", "0.65659255", "0.6232123", "0.61639875", "0.6125135", "0.6119702", "0.61163217", "0.6079278", "0.60771716", "0.6036082", "0.59585243", "0.5932175", "0.5917851", "0.59070086", "0.58867127", "0.5840342", "0.57954717", "0.5775529", "0.5723...
0.84170973
0
set_result(hf, var, data, desc='') Sets values of the output variable in the HDF5 file. Writes array to '/output/data/var'.
def set_result(hf, var, data, desc=''): try: del hf['/output/data/%s' % var] except: pass hf['/output/data/%s' % var] = data hf['/output/data/%s' % var].attrs['description'] = desc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result(hf, var=None):\n if '/output/data' not in hf:\n return []\n\n output_variables = get_output_names(hf)\n if len(output_variables) == 0:\n return []\n\n if var and var not in output_variables:\n print(\"Variable %s not found in output data\" % var)\n raise Value...
[ "0.6182932", "0.58338", "0.580313", "0.57810116", "0.57189673", "0.563597", "0.54657924", "0.53459704", "0.5341494", "0.5316227", "0.526054", "0.52308077", "0.5229582", "0.5224582", "0.52132416", "0.52110887", "0.52061415", "0.51927775", "0.5171107", "0.51699406", "0.5156512"...
0.7462429
0
get_result(hf, var=None) Returns an array containing the values of the output variable.
def get_result(hf, var=None): if '/output/data' not in hf: return [] output_variables = get_output_names(hf) if len(output_variables) == 0: return [] if var and var not in output_variables: print("Variable %s not found in output data" % var) raise ValueError if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response(hf, var):\n psweep = hf.attrs['UQtype']\n return unpickle(hf['/%s/%s/response' % (psweep, var)].value)", "def _get_result(self):\r\n \r\n return self._result", "def remote_getResult(i=None):", "def get_result(self) -> Any:\n ...", "def getOutputValue(self, paramn...
[ "0.5833718", "0.5822366", "0.5708725", "0.5597114", "0.5449637", "0.540228", "0.5389764", "0.5344381", "0.53330904", "0.5330267", "0.5330267", "0.5330267", "0.5330267", "0.5330267", "0.5330267", "0.5304302", "0.5272941", "0.52592576", "0.52443486", "0.52309984", "0.52123004",...
0.86683446
0
get_param_names(hf) Returns a list of the input parameter names in the HDF5 file.
def get_param_names(hf): parameters = get_params(hf) return [p.name for p in parameters]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_names(self):\n return list(self.params.keys())", "def _get_fitted_param_names(self):\n return self._fitted_param_names", "def parameter_names(self) -> List[str]:", "def param_names(\n self, *, include_tp: bool = False, include_gq: bool = False\n ) -> List[str]:\n ...
[ "0.678714", "0.6763911", "0.67390025", "0.65343535", "0.64527595", "0.640645", "0.6373287", "0.63533026", "0.62380046", "0.62231135", "0.62230515", "0.6222808", "0.61919844", "0.6164576", "0.6138721", "0.60182977", "0.6003311", "0.59651834", "0.59189415", "0.5841817", "0.5808...
0.84310985
0
get_params(hf) Returns a list of arrays of input parameter values.
def get_params(hf): plist = [] for p in hf['/input/params']: val = hf['/input/params'][p].value if type(val) != str: val = val.decode('UTF-8') plist.append(unpickle(val)) return plist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_names(hf):\n parameters = get_params(hf)\n return [p.name for p in parameters]", "def _get_parameters(self) -> list:\n return self.parameters", "def get_params(self):\n return list(self.params.values())", "def get_params(self):\n return self.arr", "def get_params(se...
[ "0.6893457", "0.6837561", "0.6804596", "0.6723788", "0.66528517", "0.65687764", "0.6551635", "0.6501132", "0.6497645", "0.64971256", "0.64833355", "0.63932973", "0.63927233", "0.63927233", "0.63614494", "0.636041", "0.6346599", "0.63385177", "0.63385177", "0.6331291", "0.6312...
0.778357
0
data_description(hf, var) Returns the description of an output variable. If the description is empty, returns the variable name.
def data_description(hf, var): desc = hf['/output/data/%s' % var].attrs['description'] if type(desc) != str: desc = desc.decode('UTF-8') if desc: return desc return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_description(hf, var):\n val = hf['/input/params/%s' % var].value\n if type(val) != str:\n val = val.decode('UTF-8')\n val = unpickle(val)\n desc = val.description\n\n if desc:\n return desc\n return var", "def get_result(hf, var=None):\n if '/output/data' not in hf:\n...
[ "0.6864165", "0.6221898", "0.60169995", "0.57531977", "0.55221105", "0.55126", "0.54335487", "0.5421851", "0.5389285", "0.5331602", "0.5328696", "0.5308557", "0.5298564", "0.52873766", "0.5269236", "0.5197202", "0.5176139", "0.5157434", "0.51519734", "0.51199126", "0.5100956"...
0.8516398
0
param_description(hf, var) Returns the description of an input variable. If the description is empty, returns the variable name.
def param_description(hf, var): val = hf['/input/params/%s' % var].value if type(val) != str: val = val.decode('UTF-8') val = unpickle(val) desc = val.description if desc: return desc return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_description(hf, var):\n desc = hf['/output/data/%s' % var].attrs['description']\n if type(desc) != str:\n desc = desc.decode('UTF-8')\n\n if desc:\n return desc\n return var", "def prompt_for_var_name():\n return input('Variable name? ')", "def __make_description(self, par...
[ "0.66426176", "0.5668525", "0.55906206", "0.5473964", "0.54583865", "0.540782", "0.540782", "0.540782", "0.540782", "0.540782", "0.53399444", "0.5315237", "0.5301181", "0.5249107", "0.52275527", "0.5164749", "0.5137802", "0.50963116", "0.5015387", "0.50141335", "0.50134474", ...
0.83119935
0
get_response(hf, var) Returns the response function for an output variable.
def get_response(hf, var): psweep = hf.attrs['UQtype'] return unpickle(hf['/%s/%s/response' % (psweep, var)].value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result(hf, var=None):\n if '/output/data' not in hf:\n return []\n\n output_variables = get_output_names(hf)\n if len(output_variables) == 0:\n return []\n\n if var and var not in output_variables:\n print(\"Variable %s not found in output data\" % var)\n raise Value...
[ "0.6871027", "0.5856201", "0.5806765", "0.56712204", "0.56248873", "0.5505011", "0.54478437", "0.544699", "0.541844", "0.536069", "0.5339047", "0.53001714", "0.5293824", "0.51962996", "0.51894706", "0.5179314", "0.51732165", "0.5162863", "0.5153784", "0.5099067", "0.5099067",...
0.75603396
0
Gets the id from a slack users name
def get_id_from_name(slack_client, name): api_call = slack_client.api_call("users.list") if api_call.get('ok'): # retrieve all users so we can find our bot users = api_call.get('members') for user in users: if 'name' in user and user['name'] == name: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_slack_id(user):\n members = get_slack_users()\n user_name = [member for member in members if member.get('profile').get(\n 'email') == user['email']]\n return user_name[0].get('id') if user_name else ''", "def _get_user_id(self, name):\n try:\n apiResponse = twitchAPI.twi...
[ "0.8026936", "0.7219842", "0.7033729", "0.701138", "0.69746554", "0.6746316", "0.6746316", "0.6746316", "0.6739249", "0.67276496", "0.6724841", "0.6632618", "0.6632618", "0.66051096", "0.65846807", "0.6565719", "0.65635425", "0.65570116", "0.652876", "0.65262294", "0.651276",...
0.8519256
0
Will log details of the user
def details(self): logging.info(self.user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_successful_login(sender, request, user, **kwargs):\r\n if settings.FEATURES['SQUELCH_PII_IN_LOGS']:\r\n AUDIT_LOG.info(u\"Login success - user.id: {0}\".format(user.id))\r\n else:\r\n AUDIT_LOG.info(u\"Login success - {0} ({1})\".format(user.username, user.email))", "def log_user_logg...
[ "0.7045293", "0.686289", "0.6788697", "0.67700326", "0.676148", "0.676148", "0.6721874", "0.67000073", "0.66643417", "0.6644595", "0.6636795", "0.6549175", "0.6535793", "0.64914346", "0.6446965", "0.64277387", "0.64151555", "0.63879734", "0.6370343", "0.6360823", "0.63441104"...
0.83647823
0
Will get the users presence
def presence(self): return self.slack_client.api_call("users.getPresence?user="+self.user_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def online(self):\n api_call = self.presence()\n if api_call.get('ok'):\n # retrieve all users so we can find our bot\n return api_call.get('online')\n return None", "def presence(self, params=None, timeout=None):\n params = params or {}\n path = '/channel...
[ "0.6822324", "0.6642054", "0.64109", "0.61725354", "0.60397285", "0.6022395", "0.60211736", "0.5923945", "0.584164", "0.58316106", "0.57659245", "0.5763912", "0.5741214", "0.5738428", "0.57166594", "0.5693123", "0.5687724", "0.56435466", "0.56251895", "0.56243795", "0.5612464...
0.8522565
0
Initialize left and right lane cache
def init_cache(self): self.left_lane_cache = list() self.right_lane_cache = list()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.side = None\n \"\"\"\n Cache to store the evaluation of board positions that we have already looked at. This avoids repeating a lot\n of work as we do not look at all the possible continuation from this position again.\n \"\"\"\n self.cache = {}\...
[ "0.62603575", "0.6206263", "0.57225484", "0.5583743", "0.55815846", "0.55552655", "0.55008185", "0.54288805", "0.5391921", "0.5384816", "0.53778046", "0.5362928", "0.53568006", "0.5348835", "0.53398573", "0.53301936", "0.5324952", "0.52990544", "0.5280529", "0.5273415", "0.52...
0.82159823
0
take the average of past cached endpoints as the new end point of line segments
def probablistic_smoothing(self, line, cache): new_line_wght = self.prob_smoothing_params["current_line_weight"] past_lines_wght = self.prob_smoothing_params["past_lines_weight"] if line is None: return np.mean(cache, axis=0).round().astype(int), cache[-self.cache_size :] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(self):\n return (self.current + self.last) / 2.0", "def avg_removed(self):\n avg = {}\n for path, lines in self.lines_removed.items():\n avg[path] = round(statistics.mean(lines))\n\n return avg", "def get_avg_points(self):\n pass", "def avg_added(self...
[ "0.54744446", "0.53983194", "0.5389896", "0.5363136", "0.5295096", "0.5293981", "0.5252361", "0.524959", "0.52452606", "0.52328026", "0.51629716", "0.513422", "0.5134078", "0.5078152", "0.5069658", "0.5062421", "0.50586176", "0.50559497", "0.5050954", "0.50039643", "0.5003947...
0.5614162
0
New() > itkMeshSourceMD2Q Create a new object of the class itkMeshSourceMD2Q and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The n...
def New(*args, **kargs): obj = itkMeshSourceMD2Q.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def New(*args, **kargs):\n obj = itkMeshSourceMD3Q.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkMeshSourceMD2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **karg...
[ "0.7639044", "0.727875", "0.7128952", "0.698582", "0.6949615", "0.6797933", "0.6774174", "0.67558956", "0.6738865", "0.66925174", "0.6649819", "0.66396123", "0.6613809", "0.6544495", "0.6528151", "0.6504718", "0.6462523", "0.6440543", "0.6421221", "0.6412888", "0.63615274", ...
0.80018705
0
New() > itkMeshSourceMD3Q Create a new object of the class itkMeshSourceMD3Q and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The n...
def New(*args, **kargs): obj = itkMeshSourceMD3Q.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def New(*args, **kargs):\n obj = itkMeshSourceMD3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkMeshSourceMD2Q.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **karg...
[ "0.76424545", "0.75177705", "0.72723085", "0.72642565", "0.70665973", "0.70411664", "0.6989817", "0.69875216", "0.69681907", "0.6827896", "0.6809468", "0.6800386", "0.676918", "0.6702616", "0.6649606", "0.6634698", "0.6605022", "0.6587581", "0.65751237", "0.6470867", "0.64678...
0.821262
0
Get room associated to camera.
def get_camera_room(camera_serial: str) -> Optional[dict]: response = api.get_camera_room_api(camera_serial) return response.json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room(self) -> Room:\n return self.__room", "def _get_camera(self, mode):\n cam_bp = self.blueprint_lib.find(f\"sensor.camera.{mode}\")\n cam_bp.set_attribute(\"image_size_x\", f\"{self.img_x}\")\n cam_bp.set_attribute(\"image_size_y\", f\"{self.img_y}\")\n cam_bp.set_attrib...
[ "0.6728357", "0.6713514", "0.66802335", "0.66802335", "0.6673557", "0.6614773", "0.6601712", "0.6572413", "0.64967835", "0.6476653", "0.644459", "0.6427372", "0.63323754", "0.62849903", "0.62781805", "0.6241834", "0.6104265", "0.6080289", "0.6042704", "0.6021046", "0.5986032"...
0.7647021
0
Get meeting associated to room.
def get_room_meeting(room_id: str) -> Optional[dict]: try: response = api.get_current_meeting_api(room_id) return response.json() except Exception as err: logger.error(str(err))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_room(meeting_length: int) -> Optional[dict]:\n try:\n return api.get_available_room_api(meeting_length)\n except Exception as err:\n logger.error(str(err))", "def get_room(self, room_name):\r\n try:\r\n return self._rooms[room_name]\r\n except KeyErr...
[ "0.6984332", "0.69794464", "0.67528933", "0.6715093", "0.67126834", "0.6698961", "0.66711736", "0.65913105", "0.65708464", "0.653867", "0.6510884", "0.6465517", "0.64232916", "0.63283277", "0.62482256", "0.62274766", "0.6225368", "0.6223397", "0.61770236", "0.6148605", "0.608...
0.79889804
0
Get meeting associated to room.
def get_available_room(meeting_length: int) -> Optional[dict]: try: return api.get_available_room_api(meeting_length) except Exception as err: logger.error(str(err))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_room_meeting(room_id: str) -> Optional[dict]:\n try:\n response = api.get_current_meeting_api(room_id)\n return response.json()\n except Exception as err:\n logger.error(str(err))", "def get_room(self, room_name):\r\n try:\r\n return self._rooms[room_name]\r\n...
[ "0.7989579", "0.6980983", "0.67531663", "0.6716604", "0.6714134", "0.6698416", "0.6672643", "0.6593494", "0.657104", "0.65401155", "0.651163", "0.6467212", "0.6424745", "0.6329888", "0.62470394", "0.6228443", "0.6226526", "0.62244844", "0.61769843", "0.6148223", "0.6081408", ...
0.6984546
1
Get T10 associated to room.
def get_room_t10(room_id: str) -> Optional[dict]: response = api.get_room_device_info_api(room_id) return response.json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thermostat(self, room_id: str) -> Dict:\n for key, value in self.thermostats.items():\n if value[\"id\"] == room_id:\n return self.thermostats[key]\n\n raise InvalidRoom(\"No room with ID %s\" % room_id)", "def get_room_by_id(self, id):\n if not isinstance(i...
[ "0.5800181", "0.55277616", "0.5490227", "0.5306537", "0.52587366", "0.5116882", "0.50899786", "0.50812876", "0.50075823", "0.49847156", "0.49410293", "0.49252138", "0.4911232", "0.49048966", "0.4873999", "0.48427808", "0.48284218", "0.4821396", "0.48073527", "0.478201", "0.47...
0.77276736
0
Identify user using picture.
def identify_user(picture: str) -> Optional[dict]: data = api.identify_person_api(picture) return data.json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_photo_id_image(self):\r\n if settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'):\r\n return\r\n\r\n self.photo_id_key = self.original_verification(self.user).photo_id_key\r\n self.save()", "def ldap_get_picture(self, user):\n result = super(Aut...
[ "0.6500659", "0.61352795", "0.60135627", "0.59738946", "0.59686816", "0.59163946", "0.5890044", "0.58772194", "0.5856343", "0.58339924", "0.58264804", "0.578972", "0.5787088", "0.5768975", "0.57652503", "0.5759215", "0.57336044", "0.57251793", "0.56909114", "0.5689006", "0.56...
0.74471325
0
Send raw message to T10.
async def async_send_raw_message_to_t10(ip: str, username: str, password: str, message: str) -> dict: async with xows.XoWSClient(ip, username, password) as client: encoded_message = f"711:{message}" logger.info(f"Sending message {encoded_message} to T10 {ip} ...") return await client.xComman...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_raw_message_to_t10(ip: str, username: str, password: str, message: str) -> dict:\n return loop.run_until_complete(async_send_raw_message_to_t10(ip, username, password, message))", "async def send_raw(self, raw_message : str):\n await self._connection.send_raw(raw_message)", "def on_t10_messa...
[ "0.74833804", "0.6996694", "0.68469405", "0.67557174", "0.6609407", "0.6496932", "0.6457618", "0.6448156", "0.6433971", "0.63890254", "0.6379464", "0.6365795", "0.63269436", "0.6312104", "0.627904", "0.6275915", "0.62649065", "0.62612236", "0.62591565", "0.62560403", "0.62076...
0.7725625
0
Send raw message to T10.
def send_raw_message_to_t10(ip: str, username: str, password: str, message: str) -> dict: return loop.run_until_complete(async_send_raw_message_to_t10(ip, username, password, message))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_send_raw_message_to_t10(ip: str, username: str, password: str, message: str) -> dict:\n async with xows.XoWSClient(ip, username, password) as client:\n encoded_message = f\"711:{message}\"\n logger.info(f\"Sending message {encoded_message} to T10 {ip} ...\")\n return await c...
[ "0.7725625", "0.6996694", "0.68469405", "0.67557174", "0.6609407", "0.6496932", "0.6457618", "0.6448156", "0.6433971", "0.63890254", "0.6379464", "0.6365795", "0.63269436", "0.6312104", "0.627904", "0.6275915", "0.62649065", "0.62612236", "0.62591565", "0.62560403", "0.620767...
0.74833804
1
Get person and meeting from camera serial.
def get_person_meeting_from_camera(camera_serial: str) -> Optional[dict]: # Get the network network_data = get_camera_network(camera_serial) # Get the camera capture capture_data = take_picture_from_camera(network_data["id"], camera_serial) # Identify person person_data = identify_user(capture_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_camera_room(camera_serial: str) -> Optional[dict]:\n response = api.get_camera_room_api(camera_serial)\n return response.json()", "def process_camera():\n\n pic_array = take_picture()\n detections, shapes, descriptors = detect_faces(person_database,pic_array)\n\n names = []\n\n for desc...
[ "0.60853714", "0.5921881", "0.5721924", "0.5563192", "0.535188", "0.52540827", "0.51830184", "0.5151382", "0.5135098", "0.5082099", "0.5072988", "0.5030921", "0.5015844", "0.49833044", "0.49457884", "0.49433827", "0.4942929", "0.4939665", "0.4928585", "0.49259174", "0.492482"...
0.7313161
0
Send JSON message to T10.
def send_json_message_to_t10(ip: str, username: str, password: str, message: dict) -> dict: json_data = json.dumps(message) return loop.run_until_complete(async_send_raw_message_to_t10(ip, username, password, json_data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_t10_message():\n send_json_message_to_t10(\"10.89.130.68\", \"cisco\", \"cisco\", request.get_json())\n return \"ok\"", "def _send_json(self, data):\n return self.sendMessage(json.dumps(data).encode(\"utf-8\"))", "def on_t10_message():\n handle_t10_message(request.get_json())\n retu...
[ "0.7853554", "0.74417216", "0.7421759", "0.70720935", "0.6974595", "0.6911024", "0.66566676", "0.6652311", "0.6516209", "0.64711666", "0.64438486", "0.64244586", "0.64066106", "0.63929725", "0.6370944", "0.6368785", "0.63646865", "0.63458747", "0.62323713", "0.6206355", "0.61...
0.79545933
0