query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
Check if the pipeline predictions change before and after conversion through the adapter
def test_preds_before_and_after_convert_equal(): init_alpha = 12.1 pipeline = pipeline_with_custom_parameters(init_alpha) # Generate data input_data = get_synthetic_regression_data(n_samples=10, n_features=2, random_state=2021) # Init fit pipeline....
[ "def _is_feed_forward(self, op):\n return len(op.measurement_deps) != 0", "def on_outcome_changed(self, old, new):", "def transformChanged(self):\n prof = pg.debug.Profiler()\n globalTr = self.scannerDev.globalTransform()\n pt1 = globalTr.map(self.currentRoi.scannerCoords[0])\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attach a pair of fc layers to encoder_output and predict labels optionally reverse gradient flow into the encoder
def regressor(self, labels, encoder_output, reverse_grads=False, attention_fn=None, name='regressor'): # TODO - this is repeated wit hclassifier. find out if safe to abstract? encoder_output_output = encoder_output.outputs encoder_output_output_shape = encoder_output_output.get_shape() e...
[ "def classifier(self, labels, encoder_output, num_classes, reverse_grads=False, attention_fn=None, name='classifier'):\n # TODO - this is repeated with regressor. find out if safe to abstract?\n encoder_output_output = encoder_output.outputs\n encoder_output_output_shape = encoder_output_output...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attach a pair of fc layers to encoder_output and predict labels optionally reverse gradient flow into the encoder
def classifier(self, labels, encoder_output, num_classes, reverse_grads=False, attention_fn=None, name='classifier'): # TODO - this is repeated with regressor. find out if safe to abstract? encoder_output_output = encoder_output.outputs encoder_output_output_shape = encoder_output_output.get_sha...
[ "def regressor(self, labels, encoder_output, reverse_grads=False, attention_fn=None, name='regressor'):\n # TODO - this is repeated wit hclassifier. find out if safe to abstract?\n encoder_output_output = encoder_output.outputs\n encoder_output_output_shape = encoder_output_output.get_shape()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
looks up word embeddings for a source sequence
def get_embeddings(self, source): E = tf.get_variable('E', shape=[self.vocab_size, self.embedding_size]) embedding = tf.nn.embedding_lookup(E, source) return embedding
[ "def build_seq_embeddings(self):\n\n\t\twith tf.variable_scope(\"input_embedding\"):\n\t\t\tinput_embedding_map = tf.Variable(tf.random_uniform(name = 'input_embedding_map', \n\t\t\t\tshape = [self.config.vocab_size, self.config.embedding_size]))\n\t\t\tinput_embeddings = tf.nn.embedding_lookup(input_embedding_map,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
runs the source embeddings through an encoder
def run_encoder(self, source, source_len): cell1, cell2 = self.build_rnn_cells() if self.attention_keys == 'word_vectors': encoder = encoders.IdentityEncoder() elif self.num_layers == 1: encoder = encoders.BidirectionalEncoder(cell1, cell2) else: enco...
[ "def run_encoder(self,\n source: mx.nd.NDArray,\n source_length: mx.nd.NDArray,\n bucket_key: int) -> Tuple[mx.nd.NDArray, mx.nd.NDArray,\n mx.nd.NDArray, mx.nd.NDArray,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove ticks, tick labels, and frame from axis
def clean_axis(ax): ax.get_xaxis().set_ticks([]) ax.get_yaxis().set_ticks([]) for sp in ax.spines.values(): sp.set_visible(False)
[ "def _clean_axis(ax):\n ax.get_xaxis().set_ticks([])\n ax.get_yaxis().set_ticks([])\n for sp in list(ax.spines.values()):\n sp.set_visible(False)\n ax.grid(False)\n ax.set_facecolor('white')", "def kill_ticks(axes, spines=True):\n axes.set_xticks([])\n axes.set_yticks([])\n if spine...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set repetition rate in Hz of the laser. rate = 0 enters the single shot mode
def setRate(self, rate): if rate > 10: self.printError("Too high repetition rate") return -1 if rate == 0: pulse_division = 0 else: pulse_division = int(10 / rate) self.setParameter("setPulseDivision", format(pulse_division, "03"))
[ "def set_repetition_rate(self, rate):\n if not (type(rate) == int or type(rate) == float) or rate < 1 or rate > 5:\n raise ValueError(\"Laser repetition rate must be a positive number from 1 to 5!\")\n\n response = self._send_command(\"RR \" + str(rate))\n if response == b\"ok\\r\\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scrape lyrics from metrolyrics.com
def scrape(title, artist): # Format artist and title for building url title = format(title) artist = format(artist) # Build url url = "http://www.metrolyrics.com/{}-lyrics-{}.html".format(title, artist) # Request url try: log.debug("Requesting %s", url) resp = re...
[ "def getlyrics(musixmatch_lyrics_page):\n doc = html.fromstring(musixmatch_lyrics_page.read())\n ret = [e.text_content() for e in doc.find_class('mxm-lyrics__content')]\n ret = \"\\n\".join(ret)\n return ret", "def scrape(self):\n\n print \"Scraping lyrics for\", self.name\n page = get(self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read a file in FASTA format, either from a file or from a string of raw data.
def read_fasta( file_path='', data_string='', ): # ensure we are only given one file specification if len(file_path) > 0 and len(data_string) > 0: raise Exception( "Please specify either a file path or a \ string of data." ) raw_data = [] # open...
[ "def _read_fasta_file(self,fasta_file):\n\n self._fasta_file = fasta_file\n\n f = open(self._fasta_file,'r')\n lines = f.readlines()\n f.close()\n\n # Remove blank lines\n lines = [l.strip() for l in lines if l.strip() != \"\"]\n\n # Make sure this is a sane, reasona...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls `func(event, context)` and returns a properly formatted response, also reporting the transaction results to APM using either the given `transaction_name` or `func`'s name.
def response(func, event, context, transaction_name=''): if not transaction_name: transaction_name = func.__name__ apm.begin_transaction('Request') elasticapm.set_custom_context({ 'event': event, 'function_name': context.function_name, 'aws_request_id': context.aws_request_i...
[ "def Invoke(self,fcn_name: str,event: dict):\n\t\t\t\t\n\t\t\tresponse = self.client.invoke(\n\t\t\t\tFunctionName=fcn_name,\n\t\t\t\tInvocationType='RequestResponse',\n\t\t\t\tPayload=json.dumps(event),\n\t\t\t\t)\n\n\t\t\treturn json.loads(response['Payload'].read())", "def log_transaction():\n if settings.D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In this case our method predefines all of it's parameters, i.e. int, string, list The int and string are required, but the list is not. ParameterValidator inputs line up directly against the defined parameters in the method signature.
def test_predefine_params(): @ParameterValidator((int, False, (3,5)), (str, False), (list, True)) def myfunc(num, str, list): print("Hello from standalone function") # Splatting - OK single_args = [3, "hey", None] print("Standalone Args Splatting - success") myfunc(*single_args) ...
[ "def _validate_parameters(self, parameters):\n raise NotImplementedError()", "def required_params(self) -> list:", "def _validate_parameters(supplied_params):\n\n # Define the parameters, their data types, and if they are required\n parameters = [('Rs', float, True),\n ('Mp', float...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In this case our method predefines all of it's parameters, i.e. int, string, list The int and string are required, but the list is not (as with the above function). ParameterValidator inputs are defined as any kwargs would be for any other entry point. The difference being, there is no one to one mapping here and those...
def test_predfined_params_2(): @ParameterValidator(age=(int, False), name=(str, False), addresses=(list, True)) def mykwfunc(**kwargs): print("Hello from kwargs standalone function") print("Standalone Kwargs Standard - success") mykwfunc(age=25, name="Fred Jones") try: print("...
[ "def test_predefine_params():\n @ParameterValidator((int, False, (3,5)), (str, False), (list, True))\n def myfunc(num, str, list):\n print(\"Hello from standalone function\")\n\n\n # Splatting - OK\n single_args = [3, \"hey\", None]\n print(\"Standalone Args Splatting - success\")\n myfunc(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the current weather conditions
def print_conditions(self, data): self._print("Weather for {0}".format(data['display_location']['full'])) temp_c = format_degree({"metric": data['temp_c']}, Units.METRIC) temp_f = format_degree({"english": data['temp_f']}, Units.ENGLISH) if self.settings.units == Units.METRIC: ...
[ "def display_weather(formats):\n city = str(json.dumps(formats['name'])).replace('\"', '')\n country = str(json.dumps(formats['sys']['country'])).replace('\"', '')\n timezone = int(json.dumps(formats['timezone']))\n times = int(json.dumps(formats['dt']))\n actual_time = times + timezone\n present_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the hourly weather data in a table
def print_hourly(self, data): # Need to generate an array to send the print_table, first row must be the keys val = [] val.append(["Date", "Hour", "Temperature", "Chance of Rain", "Weather"]) for item in data: time = format_hour(item["FCTTIME"], self.settings.time) ...
[ "def get_weather_report():\n weather_dict = {'locality': [], 'weather': []}\n weather = get_weather()\n for w in weather:\n weather_dict['locality'].append(w)\n weather_dict['weather'].append(weather[w]['forecast'])\n\n keys = ['locality', 'weather']\n length = len(weather_dict[keys[0]]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a formatted windspeed, for example, >>>format_windspeed({
def format_windspeed(windspeed_dict, unit): direction = Direction.shorthand(windspeed_dict['dir']) idx = 'kph' if unit == Units.METRIC else 'mph' return FORMAT_STRINGS['windspeed'].format(str(windspeed_dict[idx]), idx, direction)
[ "def wind_speed(self):\r\n return self.get_average(self._past_weather_list, \"wind_speed\")", "def wind_speed(self):\n speed_km_h = self.get_value(\"wind_speed\")\n if self._is_metric or speed_km_h is None:\n return speed_km_h\n\n speed_mi_h = convert_distance(speed_km_h, LE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the supplied weather data as specified by the options and program arguments.
def print_weather_data(data, args, settings): data = json.loads(data.decode('utf-8')) if 'error' in data['response']: print(data['response']['error']['description']) return if 'results' in data['response']: print("More than 1 city matched your query, try being more specific") ...
[ "def main():\n usage = \"usage: %prog [-c] location\"\n parser = OptionParser(usage=usage)\n parser.add_option(\"-c\", \"--celsius\", dest=\"celsius\", help=\"return temp\"+\\\n \"eratures in Celsius (Fahrenheit without this switch\",\n action=\"store_true\", defau...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a url to the weather underground API endpoint by parsing program arguments.
def make_api_url(args, settings): base_url="http://api.wunderground.com/api/%s/" % settings.api_key # Create a location string, or use autoip query="q/%s.json" if args.location: query = query % "_".join(args.location); else: query = query % "autoip" return base_url + make_query...
[ "def get_dash_url(args: Optional[\"DictConfig\"] = None):\n headers_dict = {\"Accept\": \"application/json\"}\n r = requests.get(\n \"http://localhost:3032/api/search?query=Default%20Mephisto%20Monitoring\",\n headers=headers_dict,\n auth=HTTPBasicAuth(\"admin\", \"admin\"),\n )\n o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produces a PDF plot of q vs. time
def make_plot(): # options q = -1e5 # n electrons - same as LW v_elec = 1.71 # mm / microsecond # arxiv 1306.6106 time_duration = 200 # microseconds delta_t = 0.1 # microseconds z_0 = 250 # starting position in mm ...
[ "def plot_pdf(x, mu, nu, H, N, m, results):\r\n constant = integration_constant(x, mu, nu, H, N, m)\r\n t_values = np.linspace(0.01, 0.99, num=50)\r\n\r\n values_analytical = [G(x, t, mu, nu, H, N) / constant for t in t_values]\r\n values_simulated = results[:, index_of_closest(m, x)] / float(N)\r\n\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_availability_set_get
def test_azure_service_api_availability_set_get(self): pass
[ "def test_azure_service_api_availability_sets_get(self):\n pass", "def test_azure_service_api_availability_zone_get(self):\n pass", "def test_vmware_service_resources_availability_zones_get(self):\n pass", "def create(**_):\n utils.validate_node_property(constants.AVAILABILITY_SET_KEY,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_availability_sets_get
def test_azure_service_api_availability_sets_get(self): pass
[ "def test_azure_service_api_availability_set_get(self):\n pass", "def test_vmware_service_resources_availability_zones_get(self):\n pass", "def create(**_):\n utils.validate_node_property(constants.AVAILABILITY_SET_KEY, ctx.node.properties)\n\n azure_config = utils.get_azure_config(ctx)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_availability_zone_get
def test_azure_service_api_availability_zone_get(self): pass
[ "def test_vmware_service_resources_availability_zones_get(self):\n pass", "def test_azure_service_api_availability_set_get(self):\n pass", "def test_zone_get_function():\n response = zone.get(domain_name='example.com')\n assert response.success\n\n payload = response.payload\n assert p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_flavor_get
def test_azure_service_api_flavor_get(self): pass
[ "def test_azure_service_api_flavors_get(self):\n pass", "def test_vmware_service_resources_flavor_get(self):\n pass", "def test_vmware_service_resources_flavors_get(self):\n pass", "def test_get_flavor_id(self):\r\n flav_id = str(uuid.uuid4())\r\n flav_name = 'X-Large'\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_flavors_get
def test_azure_service_api_flavors_get(self): pass
[ "def test_vmware_service_resources_flavors_get(self):\n pass", "def test_azure_service_api_flavor_get(self):\n pass", "def test_vmware_service_resources_flavor_get(self):\n pass", "def list_flavors(*args, **kwargs):\n return __list_flavors(*args, **kwargs)", "def test_azure_service_a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_image_get
def test_azure_service_api_image_get(self): pass
[ "def test_azure_service_api_public_image_get(self):\n pass", "def test_azure_service_api_public_images_get(self):\n pass", "def test_azure_service_api_private_image_get(self):\n pass", "def test_azure_service_api_private_images_get(self):\n pass", "def test_vmware_service_resourc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_interfaces_get
def test_azure_service_api_interfaces_get(self): pass
[ "def test_vmware_service_resources_interfaces_get(self):\n pass", "def test_interfaces(self):\n remote_client = RemoteClient(iface=IResourceAgent, xs_name=self._xs_name,\n resource_id='fake_id', process=FakeProcess())\n\n interfaces = providedBy(remote_client)\n self.assertI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_keypair_delete
def test_azure_service_api_keypair_delete(self): pass
[ "def test_vmware_service_resources_keypair_delete(self):\n pass", "def test_delete_service_key(self):\n pass", "def test_delete_key(client):\n resp = client.delete_key(PROJECT_ID, 48855760)\n assert resp['project_id'] == PROJECT_ID\n assert resp['key_removed']", "def test_azure_service_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_keypair_generate_post
def test_azure_service_api_keypair_generate_post(self): pass
[ "def test_azure_service_api_keypair_import_post(self):\n pass", "def test_azure_service_api_keypair_get(self):\n pass", "def test_create_service_key(self):\n pass", "def test_vmware_service_resources_keypairs_post(self):\n pass", "def test_azure_service_api_keypairs_get(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_keypair_get
def test_azure_service_api_keypair_get(self): pass
[ "def test_azure_service_api_keypairs_get(self):\n pass", "def test_azure_service_api_keypair_generate_post(self):\n pass", "def test_vmware_service_resources_keypairs_get(self):\n pass", "def test_get_service_key(self):\n pass", "def test_azure_service_api_keypair_delete(self):\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_keypair_import_post
def test_azure_service_api_keypair_import_post(self): pass
[ "def test_azure_service_api_keypair_generate_post(self):\n pass", "def test_azure_service_api_keypair_get(self):\n pass", "def test_azure_service_api_keypairs_get(self):\n pass", "def test_azure_service_api_keypair_delete(self):\n pass", "def test_vmware_service_resources_keypair...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_keypairs_get
def test_azure_service_api_keypairs_get(self): pass
[ "def test_azure_service_api_keypair_get(self):\n pass", "def test_vmware_service_resources_keypairs_get(self):\n pass", "def test_azure_service_api_keypair_generate_post(self):\n pass", "def test_azure_service_api_keypair_delete(self):\n pass", "def test_azure_service_api_keypair...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_network_subnets_get
def test_azure_service_api_network_subnets_get(self): pass
[ "def test_vmware_service_resources_subnets_get(self):\n pass", "def _get_subnets(self) -> List[dict]:\n print('Getting subnets...')\n\n return self._run_az([\n 'network', 'vnet', 'subnet', 'list',\n '--resource-group', self._selected_resource_group['name'],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_networks_get
def test_azure_service_api_networks_get(self): pass
[ "def test_vmware_service_resources_networks_get(self):\n pass", "def test_organization_networks_show(self):\n self.assertEqual(\n \"https://dashboard.meraki.com/api/v0/organizations/\"\n + ORGANIZATION_ID\n + \"/networks/\"\n + NETWORK_ID\n , Me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_private_image_get
def test_azure_service_api_private_image_get(self): pass
[ "def test_azure_service_api_private_images_get(self):\n pass", "def test_azure_service_api_public_image_get(self):\n pass", "def test_vmware_service_resources_image_get_private(self):\n pass", "def test_vmware_service_resources_images_get_private(self):\n pass", "def test_azure_s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_private_images_get
def test_azure_service_api_private_images_get(self): pass
[ "def test_azure_service_api_private_image_get(self):\n pass", "def test_azure_service_api_public_images_get(self):\n pass", "def test_vmware_service_resources_images_get_private(self):\n pass", "def test_azure_service_api_public_image_get(self):\n pass", "def test_vmware_service_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_public_image_get
def test_azure_service_api_public_image_get(self): pass
[ "def test_azure_service_api_public_images_get(self):\n pass", "def test_azure_service_api_image_get(self):\n pass", "def test_azure_service_api_private_image_get(self):\n pass", "def test_azure_service_api_private_images_get(self):\n pass", "def test_vmware_service_resources_imag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_public_images_get
def test_azure_service_api_public_images_get(self): pass
[ "def test_azure_service_api_public_image_get(self):\n pass", "def test_azure_service_api_private_images_get(self):\n pass", "def test_azure_service_api_image_get(self):\n pass", "def test_azure_service_api_private_image_get(self):\n pass", "def test_vmware_service_resources_image...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_regions_get
def test_azure_service_api_regions_get(self): pass
[ "def test_vmware_service_resources_regions_get(self):\n pass", "def test_list_available_regions(self):\n subscription_client = mock.MagicMock()\n subscription_id = \"subscription ID\"\n\n result = self.subscription_service.list_available_regions(subscription_client=subscription_client,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_resource_groups_get
def test_azure_service_api_resource_groups_get(self): pass
[ "def test_azure_service_api_security_groups_get(self):\n pass", "def test_api_v3_groups_get(self):\n pass", "def _get_resource_groups(self):\n print('Getting resource groups...')\n\n return self._run_az(['group', 'list'])", "def test_azure_service_api_resource_groups_post(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_resource_groups_post
def test_azure_service_api_resource_groups_post(self): pass
[ "def test_api_v3_groups_post(self):\n pass", "def test_azure_service_api_resource_groups_get(self):\n pass", "def test_azure_service_api_vm_security_groups_put(self):\n pass", "def test_create_group(self):\n request = {'name': 'Test group'}\n rv = self.post('/group/',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_security_groups_get
def test_azure_service_api_security_groups_get(self): pass
[ "def test_vmware_service_resources_security_groups_get(self):\n pass", "def test_azure_service_api_resource_groups_get(self):\n pass", "def test_api_v3_groups_get(self):\n pass", "def test_list_security_groups(self):\n admin_resource_id = self.secgroup['id']\n with (self.ove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_snapshot_delete
def test_azure_service_api_snapshot_delete(self): pass
[ "def test_vmware_service_resources_snapshot_delete(self):\n pass", "def delete_snapshot(self, *, snapshot_id: str) -> None:", "def delete_snapshot(self, snapshot, share_server):", "def test_azure_service_api_volume_delete(self):\n pass", "def delete_snapshot(request, storage):\n\n self = re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_snapshots_get
def test_azure_service_api_snapshots_get(self): pass
[ "def test_azure_service_api_snapshots_post(self):\n pass", "def test_vmware_service_resources_snapshots_get(self):\n pass", "def testRetrieveListOfSnapshots(self, _mock_CreateService) -> None:\n test_state = state.DFTimewolfState(config.Config)\n processor = gcp_crt.GCPCloudResourceTree(test...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_snapshots_post
def test_azure_service_api_snapshots_post(self): pass
[ "def test_vmware_service_resources_snapshots_post(self):\n pass", "def test_azure_service_api_snapshots_get(self):\n pass", "def test_azure_service_api_snapshot_delete(self):\n pass", "def test_manage_snapshot_route(self, mock_service_get,\n mock_create_s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_validate_subscription_post
def test_azure_service_api_validate_subscription_post(self): pass
[ "def test_vmware_service_resources_validate_subscription_post(self):\n pass", "def test_subscribe_account_using_post(self):\n pass", "def perform_validation(subscription):\n logger.info(f'Performing subscription validation for: {subscription[\"subscriptionName\"]}')\n check_missing_data(subs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_command_put
def test_azure_service_api_vm_command_put(self): pass
[ "def test_vmware_service_resources_vm_command_put(self):\n pass", "def test_azure_service_api_vm_tag_put(self):\n pass", "def test_vmware_service_resources_vm_tag_put(self):\n pass", "def test_azure_service_api_vm_workshift_put(self):\n pass", "def test_azure_service_api_vm_patch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_delete
def test_azure_service_api_vm_delete(self): pass
[ "def test_vmware_service_resources_vm_delete(self):\n pass", "def test_azure_service_api_volume_delete(self):\n pass", "def test_azure_service_api_snapshot_delete(self):\n pass", "def test_azure_service_api_vm_floating_ip_delete(self):\n pass", "def test_azure_service_api_vm_get(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_details_get
def test_azure_service_api_vm_details_get(self): pass
[ "def test_azure_service_api_vm_get(self):\n pass", "def test_vmware_service_resources_vm_details_get(self):\n pass", "def test_azure_service_api_vm_management_get(self):\n pass", "def test_azure_service_api_vms_get(self):\n pass", "def test_vmware_service_resources_vm_get(self):\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_floating_ip_delete
def test_azure_service_api_vm_floating_ip_delete(self): pass
[ "def test_azure_service_api_vm_floating_ip_put(self):\n pass", "def test_azure_service_api_vm_delete(self):\n pass", "def ex_delete_floating_ip(self, ip):\r\n resp = self.connection.request('/os-floating-ips/%s' % ip.id,\r\n method='DELETE')\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_floating_ip_put
def test_azure_service_api_vm_floating_ip_put(self): pass
[ "def test_azure_service_api_vm_floating_ip_delete(self):\n pass", "def test_azure_service_api_vm_command_put(self):\n pass", "def _floatingip_operation(operation, vca_client, ctx):\n service_type = get_vcloud_config().get('service_type')\n # combine properties\n obj = combine_properties(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_get
def test_azure_service_api_vm_get(self): pass
[ "def test_azure_service_api_vm_details_get(self):\n pass", "def test_azure_service_api_vm_management_get(self):\n pass", "def test_azure_service_api_vms_get(self):\n pass", "def test_vmware_service_resources_vm_get(self):\n pass", "def test_vmware_service_resources_vm_details_get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_management_get
def test_azure_service_api_vm_management_get(self): pass
[ "def test_azure_service_api_vm_get(self):\n pass", "def test_azure_service_api_vm_details_get(self):\n pass", "def test_azure_service_api_vms_get(self):\n pass", "def test_vmware_service_resources_vm_details_get(self):\n pass", "def test_vmware_service_resources_vm_get(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_password_get
def test_azure_service_api_vm_password_get(self): pass
[ "def test_vmware_service_resources_vm_password_get(self):\n pass", "def test_password_field(self):\n\n rv = self.client.get('/register')\n assert 'Password' in rv.data", "def test_api_v1_users_password_put(self):\n pass", "def test_password_verifier_works(password):\n (input, re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_patch
def test_azure_service_api_vm_patch(self): pass
[ "def test_azure_service_api_vm_get(self):\n pass", "def test_azure_service_api_vm_management_get(self):\n pass", "def test_azure_service_api_vm_command_put(self):\n pass", "def test_vmware_service_resources_vm_patch(self):\n pass", "def test_azure_service_api_vm_details_get(self)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_security_groups_delete
def test_azure_service_api_vm_security_groups_delete(self): pass
[ "def test_azure_service_api_vm_security_groups_put(self):\n pass", "def test_groups_destroy_no_auth(self):\n\n response = self.client.delete(f\"/api/groups/{self.group_1.id}/\", format=\"json\")\n self.assertJSONResponse(response, 403)", "def delete_security_groups():\n print('Deleting S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_security_groups_put
def test_azure_service_api_vm_security_groups_put(self): pass
[ "def test_azure_service_api_vm_security_groups_delete(self):\n pass", "def test_azure_service_api_security_groups_get(self):\n pass", "def test_vmware_service_resources_security_groups_get(self):\n pass", "def test_api_v3_groups_enable_put(self):\n pass", "def test_api_v3_groups_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_tag_put
def test_azure_service_api_vm_tag_put(self): pass
[ "def test_vmware_service_resources_vm_tag_put(self):\n pass", "def test_azure_service_api_vm_command_put(self):\n pass", "def test_vmware_service_resources_vm_command_put(self):\n pass", "def tag_instance(request):\n log('Tagging instance with: {}', request.instance_tags)\n _azure('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_workshift_delete
def test_azure_service_api_vm_workshift_delete(self): pass
[ "def test_vmware_service_resources_vm_workshift_delete(self):\n pass", "def test_azure_service_api_vm_workshift_put(self):\n pass", "def test_azure_service_api_vm_workshift_post(self):\n pass", "def test_azure_service_api_vm_delete(self):\n pass", "def test_vmware_service_resourc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_workshift_post
def test_azure_service_api_vm_workshift_post(self): pass
[ "def test_azure_service_api_vm_workshift_put(self):\n pass", "def test_vmware_service_resources_vm_workshifts_post(self):\n pass", "def test_vmware_service_resources_vm_workshift_put(self):\n pass", "def test_azure_service_api_vm_workshift_delete(self):\n pass", "def test_azure_s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vm_workshift_put
def test_azure_service_api_vm_workshift_put(self): pass
[ "def test_vmware_service_resources_vm_workshift_put(self):\n pass", "def test_azure_service_api_vm_workshift_post(self):\n pass", "def test_azure_service_api_vm_workshift_delete(self):\n pass", "def test_vmware_service_resources_vm_workshifts_post(self):\n pass", "def test_azure_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vms_get
def test_azure_service_api_vms_get(self): pass
[ "def test_azure_service_api_vm_get(self):\n pass", "def test_azure_service_api_vm_management_get(self):\n pass", "def test_azure_service_api_vm_details_get(self):\n pass", "def test_vmware_service_resources_vms_get(self):\n pass", "def test_azure_service_api_vms_post(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_vms_post
def test_azure_service_api_vms_post(self): pass
[ "def test_vmware_service_resources_vms_post(self):\n pass", "def test_azure_service_api_vms_get(self):\n pass", "def test_azure_service_api_vm_command_put(self):\n pass", "def test_azure_service_api_vm_workshift_post(self):\n pass", "def test_azure_service_api_vm_get(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volume_attachment_delete
def test_azure_service_api_volume_attachment_delete(self): pass
[ "def test_vmware_service_resources_volume_attachment_delete(self):\n pass", "def test_azure_service_api_volume_delete(self):\n pass", "def test_azure_service_api_volume_attachment_put(self):\n pass", "def test_delete_attachments_key(self):\n pass", "def delete(self):\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volume_attachment_put
def test_azure_service_api_volume_attachment_put(self): pass
[ "def test_azure_service_api_volume_attachment_delete(self):\n pass", "def test_azure_service_api_volume_patch(self):\n pass", "def test_put_attachments_key(self):\n pass", "def test_vmware_service_resources_volume_attachment_delete(self):\n pass", "def test_azure_service_api_volu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volume_delete
def test_azure_service_api_volume_delete(self): pass
[ "def test_azure_service_api_volume_attachment_delete(self):\n pass", "def test_delete_volume(self):\n self._driver.create_volume(self.TEST_VOLUME)\n self._driver.delete_volume(self.TEST_VOLUME)\n self.assertFalse(os.path.isfile(self.TEST_VOLPATH))", "def test_vmware_service_resources...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volume_get
def test_azure_service_api_volume_get(self): pass
[ "def test_azure_service_api_volumes_get(self):\n pass", "def test_azure_service_api_volume_types_get(self):\n pass", "def test_azure_service_api_volume_patch(self):\n pass", "def test_azure_service_api_volume_delete(self):\n pass", "def test_vmware_service_resources_volumes_get(s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volume_patch
def test_azure_service_api_volume_patch(self): pass
[ "def test_azure_service_api_volume_get(self):\n pass", "def test_azure_service_api_volume_attachment_put(self):\n pass", "def test_azure_service_api_volumes_get(self):\n pass", "def test_azure_service_api_volume_delete(self):\n pass", "def test_vmware_service_resources_volume_pat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volume_types_get
def test_azure_service_api_volume_types_get(self): pass
[ "def test_vmware_service_resources_volume_types_get(self):\n pass", "def test_azure_service_api_volume_get(self):\n pass", "def test_azure_service_api_volumes_get(self):\n pass", "def test_azure_service_api_volume_patch(self):\n pass", "def test_manage_volume_volume_type_by_uuid(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volumes_get
def test_azure_service_api_volumes_get(self): pass
[ "def test_azure_service_api_volume_get(self):\n pass", "def test_vmware_service_resources_volumes_get(self):\n pass", "def test_azure_service_api_volumes_post(self):\n pass", "def test_azure_service_api_volume_types_get(self):\n pass", "def test_azure_service_api_volume_patch(sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for azure_service_api_volumes_post
def test_azure_service_api_volumes_post(self): pass
[ "def test_vmware_service_resources_volumes_post(self):\n pass", "def test_azure_service_api_volumes_get(self):\n pass", "def test_azure_service_api_volume_get(self):\n pass", "def test_azure_service_api_volume_patch(self):\n pass", "def test_azure_service_api_volume_delete(self):...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exponential flare function adopted for TES time line f(t) = c 2. A / (exp((t0 t) / tr) + exp((t t0) / td)) +
def expflare(t, **kwargs): if np.isscalar(t): t = np.array([t]) elif type(t) == list: t = np.array(t) rise_exp = (kwargs['t0'] - t) / kwargs['tr'] decay_exp = (t - kwargs['t0']) / kwargs['td'] exp_rise = np.exp(rise_exp) exp_decay = np.exp(decay_exp) result = kwargs['c'] -...
[ "def exponential( t, tau ):\n\n\treturn np.exp( -1.0*t/tau )", "def _exponential_curve(self, p, t):\n\n A = p[0]\n C = p[1]\n tau = p[2]\n\n return (A + C) * np.exp(-t/tau) + C", "def _f_decay_of_t(t):\n\n return 0.689*np.exp(-1.6*t) + 0.0303*np.exp(-0.2783*t)", "def f(self,t,y)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the "xi" parameter of tes function if xi < 0 then tr is rise time and td is decay time otherwise tr and td have switched places sind tes function is symmetrix in tr and td
def calc_xi(td, tr): return np.power(td / tr, td / (tr - td)) - np.power(td / tr, tr / (tr - td))
[ "def tesresponse(t,**kwargs):\n if np.isscalar(t):\n t = np.array([t])\n elif type(t) == list:\n t = np.array(t)\n\n xi = calc_xi(td=kwargs['td'], tr=kwargs['tr'])\n\n m = t > kwargs['t0']\n\n rise_exp = -(t - kwargs['t0']) / kwargs['tr']\n decay_exp = -(t - kwargs['t0']) / kwargs['t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TES response function in small signal limit, See Christoph Weinsheimer's PhD thesis, Chapter 10 I(t) = c A / xi (exp((t t0) / tr) exp((t t0) / td)) for t > t0 and c otherwise xi = (td / tr)^(td / (tr td)) (td / tr)^(tr / (tr td))
def tesresponse(t,**kwargs): if np.isscalar(t): t = np.array([t]) elif type(t) == list: t = np.array(t) xi = calc_xi(td=kwargs['td'], tr=kwargs['tr']) m = t > kwargs['t0'] rise_exp = -(t - kwargs['t0']) / kwargs['tr'] decay_exp = -(t - kwargs['t0']) / kwargs['td'] exp_ris...
[ "def calc_xi(td, tr):\n return np.power(td / tr, td / (tr - td)) - np.power(td / tr, tr / (tr - td))", "def exp_vt(A, T):\n return np.exp(A / kb_eV / T)", "def find_ti_x(teq, param):\n Kr = param[\"Kr\"]\n a = param[\"a\"]\n xf = param[\"xf\"]\n xo = param['xo']\n tf = param['tf']\n ntst...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjust mutation step size based on current acceptance ratio. Arguments
def _adjust_mutation_scale(self, acceptance_ratio: float, target_acceptance_ratio: float = 0.2, deviation_margin: float = 1e-2) -> None: diff = acceptance_ratio - target_acceptance_ratio adjust_sign = np.sign(di...
[ "def _sample_step_size(self):\n step_size = np.random.choice(self.step_sizes, size=self.chains_num, p=self.step_probabilities)\n step_size = self._adjust_step_size(step_size)\n\n # apply step size seek during burn in\n if self.seek_step_sizes and not self._burned_in():\n lower...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply a two times upsample on x and return the result.
def upsample(x): # TODO: Use `tf.layers.conv2d_transpose` return tf.layers.conv2d_transpose(x,3,(2,2),(2,2))
[ "def upsample(layer):\n\treturn UpSampling2D(size=(2,2))(layer)", "def upsample2d(x, f, up=2, padding=0, flip_filter=False, gain=1, impl='cuda'):\n upx, upy = _parse_scaling(up)\n padx0, padx1, pady0, pady1 = _parse_padding(padding)\n fw, fh = _get_filter_size(f)\n p = [\n padx0 + (fw + upx - 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a configuration value from the SiteConfiguration table, returning `default` if the value is not in the table. This value is memoized if it is retreived from the database, making repeated calls cheap. Memoization can be bypassed by passing `memoized=False` as a parameter.
def get(key, default=None, memoized=True): if memoized and key in memo: return memo[key] db_row = SiteConfiguration.query.filter(SiteConfiguration.key == key).one_or_none() if db_row is None: return default memo[key] = db_row.value return memo[key]
[ "def get_config_value(key, defaultvalue):\n configs = DBConnection().get_configs()\n document = configs.distinct(key)\n try:\n config_value = document[0]\n if config_value is None:\n raise Exception('Config value not found')\n except:\n print(\"Config '\" + key + \"' not ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a configuration value in the SiteConfiguration table.
def set(key, value): db_row = SiteConfiguration.query.filter_by(key=key).one_or_none() if db_row is None: db_row = SiteConfiguration(key, value) db.session.add(db_row) else: db_row.value = value db.session.commit() memo[key] = value
[ "def set(self, key, value):\n self.config[key] = value\n self.saveConfig()", "def set_config(self, key, value):\n self.update_config({key: value})", "def set(ctx, setting, value):\n ctx.obj.config.set(setting, value)\n ctx.obj.config.save()", "def set_config(self, value):\n try:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a configuration value from the SiteConfiguration table.
def unset(key): if key in memo: del memo[key] (db .session .query(SiteConfiguration) .filter(key == key) .delete()) db.session.commit()
[ "def delUserConfigOption( self, name ):\n Any.requireIsTextNonEmpty( name )\n\n try:\n del self._userSettings[ name ]\n self._allSettings[ name ] = self.getNormalValue( name )\n\n logging.debug( 'deleted config option: %s', name )\n\n except KeyError:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a JSONserializable version of the value of the `SiteConfiguration` object `cfg`, applying any transformation reversed by from_frontend_value.
def to_frontend_value(cfg): if cfg.key == CACHE_TIMEOUT: return cfg.value.total_seconds() elif cfg.key == INCLUDE_FACULTY: return cfg.value elif cfg.key == INCLUDE_RESIDENTS: return cfg.value else: return None
[ "def json(self):\n return json.dumps(self.conf, indent=4, separators=(',', ': ')) + '\\n'", "def get_configuration_dict(self):\n return self.json", "def DumpExpandedConfigToString(self):\n return PrettyJsonDict(self)", "def get_academic_backend_config_dict():\n return get_academic_backend_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a `SiteConfiguration` object value for the relevant `key` and JSONserializable `value`, applying any transformation reversed by to_frontend_value.
def from_frontend_value(key, value): if key == CACHE_TIMEOUT: from datetime import timedelta return timedelta(seconds=value) elif key == INCLUDE_FACULTY: return value elif key == INCLUDE_RESIDENTS: return value else: raise ValueError('No such config key!')
[ "def to_frontend_value(cfg):\n if cfg.key == CACHE_TIMEOUT:\n return cfg.value.total_seconds()\n elif cfg.key == INCLUDE_FACULTY:\n return cfg.value\n elif cfg.key == INCLUDE_RESIDENTS:\n return cfg.value\n else:\n return None", "def get_for_site_id(\n self,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the closedform of the base_glm_all model hessian by evaluating its terms grouped by observations. Has three subfunctions which built the specific blocks of the hessian and one subfunction which concatenates the blocks into a full hessian.
def hessian_analytic( self, model ) -> tf.Tensor: def _aa_byobs_batched(model): """ Compute the mean model diagonal block of the closed form hessian of base_glm_all model by observation across features for a batch of observations. ...
[ "def gen_hess_fun(cpdag, ref_cpdag, num_sample=1, exact=True, total_x = 1, is_tree=False):\n n = cpdag.shape[0]\n def hess_fun(intervention_set, x, e):\n \"\"\"\n estimates the hessian for gred\n \"\"\"\n #sample the intervention given x\n \n dags = mec_size.uniform_s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create the keyword associated to the position of the elements within the document vectors
def _get_vector_keyword_index(self, document_list): vocabulary_list = self.parser.tokenise_and_remove_stop_words(document_list) unique_vocabulary_list = self._remove_duplicates(vocabulary_list) vector_index={} offset=0 #Associate a position with the keywords which maps to the dimension on the vector used t...
[ "def getVectorKeywordIndex(self, documentList):\n\n #Mapped documents into a single word string\t\n vocabularyString = \" \".join(documentList)\n\n vocabularyList = self.parser.tokenise(vocabularyString)\n #Remove common words which have no search value\n vocabularyList = self.par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert query string into a term vector
def _build_query_vector(self, term_list): query = self._make_vector(" ".join(term_list)) return query
[ "def get_terms_from_request(request):\n terms = []\n raw_terms = request.args.get(\"terms\", \"\").split(\",\")\n\n # Sanitize terms, and add non-empty elements to the list\n for term in raw_terms:\n term = term.strip().lower()\n if not term == \"\":\n terms.append(term)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove duplicates from a list
def _remove_duplicates(self, list): return set((item for item in list))
[ "def _dup_remover(list_a):\r\n\r\n return list(set(list_a))", "def remove_duplicate(l):\n l = list(set(l))\n return l", "def remove_dups(lst):\n\n seen = set()\n result = []\n for i in lst:\n if i not in seen:\n seen.add(i)\n result.append(i)\n return result...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build a tree in a dfs manner. records list of elements that we are working on a current level node_builder(records, curr_depth, child_id) procedure that builds content of a node based on a subset of records children_splitter(records, curr_depth, child_id) how to split the elements amongst the children max_depth when th...
def tree_dfs_builder(records, node_builder, children_splitter, max_depth, curr_depth, child_id, continue_deepening): PRINTER("[tree_dfs_builder]: depth: "+str(curr_depth)+" child_id: "+str(child_id)) PRINTER("[tree_dfs_builder]: creating a root node...") node = Node() node.content = node_builder(re...
[ "def _build_tree_dynamic(self):\n node_id = 0\n fractions = dice_fractions(self.fixed_k)\n\n c = Components(self.proc_affinity_matrix)\n #Build the bottom level\n components, comp_mat = c.get_components(fractions.next(), \n self.proc_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if entity_class is given, returns an entity of the given class. also checks for the entity level if lvl is given. if no arguments are given, the topmost entity of the entity stack is returned.
def entity(self, entity_class=None, lvl=None): if entity_class: for entity in self._entity_stack: if isinstance(entity, entity_class): if lvl is None or entity.lvl == lvl: return entity else: return self._entity_stack[-1...
[ "def holds_entity(self, entity_class, lvl=None):\n return any(\n isinstance(entity, entity_class) and\n (lvl is None or entity.lvl == lvl)\n for entity in self._entity_stack\n )", "def get_request_entity(self, *args, **kwargs):\n request_entity_class = self.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return true if the tile holds an entity of the given class. also checks for the entity level if lvl is given.
def holds_entity(self, entity_class, lvl=None): return any( isinstance(entity, entity_class) and (lvl is None or entity.lvl == lvl) for entity in self._entity_stack )
[ "def entity(self, entity_class=None, lvl=None):\n if entity_class:\n for entity in self._entity_stack:\n if isinstance(entity, entity_class):\n if lvl is None or entity.lvl == lvl:\n return entity\n else:\n return self._ent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if tile holds no entity, false otherwise. use this method to check whether the tile holds any entities before calling entity() to avoid exceptions.
def empty(self): return not self._entity_stack
[ "def has_no_entities(self):\n return not any(self._entities)", "def is_empty(self):\n return len(self.tiles) == 0", "def empty(self):\n return self.tower is None", "def isEmpty(self, tile):\r\n if self.board[tile] == EMPTY:\r\n return True\r\n\r\n return False", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pushes given entity on entity stack
def push_entity(self, entity): self._entity_stack.append(entity)
[ "def add(self, entity):\n self.entities.add(entity)", "def stack_push(self, thing):\n # increment sp\n sp = self.regs.sp + self.arch.stack_change\n self.regs.sp = sp\n return self.memory.store(sp, thing, endness=self.arch.memory_endness, size=self.arch.bytes)", "def add_entity...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pops given entity from entity stack
def pop_entity(self, entity): self._entity_stack.remove(entity)
[ "def stash_pop(self):", "def push_entity(self, entity):\n self._entity_stack.append(entity)", "def call_popped(self, call, head):\n pass", "def remove_entity(self, x, y):\n tile = map.tiles[x][y]\n entity = tile.entity\n \n if entity is None:\n raise LogicE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a 2D matrix from only the full rows in the spreadsheet.
def get_matrix_full_rows(self): full_row_matrix = [] full_row_matrix.append(self.header) for row in self.matrix: is_full = 1 for token in row: if token == "": is_full = 0 if is_full: full_row_matrix.append...
[ "def _get_matrix(self):\n for row in self.active_sheet.rows:\n row_container = []\n for cell in row:\n row_container.append(cell.value)\n self.matrix.append(tuple(row_container))", "def two_d_array(rows_num, cols_num):\n\n matrix = []\n\n for _ in range...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print the matrix in tab delimited format
def pprint(self, matrix): for i in range(0, len(matrix)): row = "" for j in range(0, len(matrix[i])): row += matrix[i][j]+"\t" row = row.rstrip("\t") print(row)
[ "def printMatrix(self, rowHeaders, colHeaders, matrix):\n print('\\t' + '\\t'.join(colHeaders))\n for header, row in zip(rowHeaders, matrix):\n print('%s \\t %s' % (header, '\\t'.join(str(round(i,3)) for i in row)))", "def print_matrix(matrix):\n\tprint ''\n\ts = ' ' if len(matrix) < 10...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a number of individuals (i.e. a population).
def population(count, length): return [ individual(length) for x in xrange(count) ]
[ "def create_population(num):\r\n return [create_chromosome() for x in range(0, num)]", "def create_population(self):\n global maxid\n self.population= []\n #.....0th individual is the initial guess if there is\n ind= Individual(0,self.ngene,self.murate,self.func,self.args)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scan subnet Return a list of host Object with all host scanned at the subred
def scan_net(sub_net): sub_net = str(sub_net) list_host = [] str_nmap = subprocess.run(["nmap", "-sP", sub_net],capture_output=True) str_nmap = str_nmap.stdout.decode("utf-8") arr_host = str_nmap.split("Nmap scan report for") del arr_host[0] active_hosts = map(filter_address, arr_host) f...
[ "def scan(self, subnets):\n Node.idGenerator = 0\n dal = DAL.DAL()\n engine = ReasoningEngine.ReasoningEngine()\n nodes = []\n rules = []\n vulens = []\n nm = nmap.PortScanner()\n logging.info('Start Scanning Network Details ...'.format())\n # nm.scan(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates dhcp6ServerSessions resource on the server.
def update(self, Name=None): # type: (str) -> Dhcp6ServerSessions return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))
[ "def enable_IPV6_grub_level(self):\n for server in self.servers:\n shell = RemoteMachineShellConnection(server)\n shell.execute_command(\"sed -i 's/ipv6.disable=1/ipv6.disable=0/' /etc/default/grub\")\n shell.execute_command(\"grub2-mkconfig -o /boot/grub2/grub.cfg\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds and retrieves dhcp6ServerSessions resources from the server. All named parameters are evaluated on the server using regex. The named parameters can be used to selectively retrieve dhcp6ServerSessions resources from the server. To retrieve an exact match ensure the parameter value starts with ^ and ends with $ By ...
def find(self, Count=None, DescriptiveName=None, Name=None): # type: (int, str, str) -> Dhcp6ServerSessions return self._select(self._map_locals(self._SDM_ATT_MAP, locals()))
[ "def discover(timeout=1, include_invisible=False):\r\n\r\n # pylint: disable=invalid-name\r\n PLAYER_SEARCH = dedent(b\"\"\"\\\r\n M-SEARCH * HTTP/1.1\r\n HOST: 239.255.255.250:reservedSSDPport\r\n MAN: \"ssdp:discover\"\r\n MX: 1\r\n ST: urn:schemas-upnp-org:device:ZonePlay...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This decodes a 2char substring
def _decode_substr(self, input:str)->int: first = self._get_value(input[:1]) second = self._get_value(input) print(f"Decoding substring {input} into {first} and {second}") return int(str.isalpha(first)) + int(str.isalpha(second))
[ "def decode(self, bytes):\n\t\tif bytes[0] == 0x0c:\n\t\t\tlength = bytes[1];\n\t\t\treturn bytes[2:length + 2].decode(\"UTF-8\");\n\t\telse:\n\t\t\traise Exception(\"Not an UTF8 string\");", "def decode(self, bytes):\n\t\tif bytes[0] == 0x17 or bytes[0] == 0x13:\n\t\t\tlength = bytes[1];\n\t\t\treturn bytes[2:le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shuffle data and targets
def _shuffle_data(self): indices = np.arange(self.num_objs) np.random.shuffle(indices) self.data = self.data[indices, :] self.target = self.target[indices]
[ "def _random_shuffle(self):\n\n assert self._inputs is not None, 'inputs have not been parsed yet!'\n assert self._targets is not None, 'targets have not been parsed yet!'\n assert len(self._inputs) == len(self._targets), \\\n 'inputs size does not equal to targets size!'\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the design matrix and target vector from the raw data
def _make_design_matrix(self, target_col, exclude_cols): # Check type of exclude_cols if not hasattr(exclude_cols, '__iter__'): raise ValueError('exclude_cols must be a list of column names, or ' 'an empty list') # We always want to exclude the target col...
[ "def _make_design_matrix(self, target_col, feature_col,\n id_name1, id_name2, feature_id='wavel'):\n\n # Figure out how many unique objects there are\n col1 = self.raw_data[id_name1]\n col2 = self.raw_data[id_name2]\n first_obj = col1[(col1 == col1[0]) * (col2 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the design matrix from the raw data
def _make_design_matrix(self, target_col, feature_col, id_name1, id_name2, feature_id='wavel'): # Figure out how many unique objects there are col1 = self.raw_data[id_name1] col2 = self.raw_data[id_name2] first_obj = col1[(col1 == col1[0]) * (col2 == col2[0])...
[ "def _make_design_matrix(self, target_col, exclude_cols):\n # Check type of exclude_cols\n if not hasattr(exclude_cols, '__iter__'):\n raise ValueError('exclude_cols must be a list of column names, or '\n 'an empty list')\n # We always want to exclude the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function calculates the position of a center of a car with respect to the center of a lane
def vehicle_position(image, output): # Calculate vehicle center xMax = image.shape[1] # yMax = image.shape[0] lineLeft = output['left_fitx'][-1] lineRight = output['right_fitx'][-1] car_position = xm_per_pix*(xMax/2 - (lineRight + lineLeft)/2) if car_position >= 0: vehicleposition = ...
[ "def lane_center_offset(left_base_m, right_base_m):\n return (1280/2*XM_PER_PIX) - (left_base_m + right_base_m) / 2", "def find_center(self):\n r = self.cluster.r_lambda * np.sqrt(np.random.random(size=1))\n phi = 2. * np.pi * np.random.random(size=1)\n\n x = r * np.cos(phi) / (self.cluste...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }