query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
Set gradient on density color. This function determines the density of the data and adds a transparency column. If samples are in dense areas, transparency values are towards 1 (visible), whereas isn nonedense areas, the transparency values are towards 0 (not visible).
def gradient_on_density_color(X, c_rgb, labels, opaque_type='per_class', showfig=False, verbose='info'): # Set the logger set_logger(verbose=verbose) if labels is None: labels = np.repeat(0, X.shape[0]) from scipy.stats import gaussian_kde uilabels = np.unique(labels) # Add the transparency col...
[ "def get_density_cmap():\n # Add completely white color to Reds colormap in Matplotlib\n list_colors = plt.cm.datad['Reds']\n list_colors = list(list_colors)\n list_colors.insert(0, (1, 1, 1))\n list_colors.insert(0, (1, 1, 1))\n lscm = matplotlib.colors.LinearSegmentedColormap.from_list(\"my_Reds...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert old verbosity to the new one.
def convert_verbose_to_new(verbose): # In case the new verbosity is used, convert to the old one. if verbose is None: verbose=0 if not isinstance(verbose, str) and verbose<10: status_map = { 'None': 'silent', 0: 'silent', 6: 'silent', 1: 'critical', ...
[ "def verbosity(v):\n assert v in [0,1,2] # debug, warn, info\n GLOBAL['VERBOSITY'] = v", "def test_increase_verbosity(self):\n # Start from a known state.\n set_level(logging.INFO)\n assert get_level() == logging.INFO\n # INFO -> VERBOSE.\n increase_verbosity()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return size of folder at path.
def folder_size(path): return sum(getsize(f) for f in os.listdir('.') if isfile(f))
[ "def _size(self, path):\n try:\n stat = self.stat(path)\n except os.error:\n return 0 \n \n if not stat['read'] or self._is_hidden(stat):\n return 0\n \n if stat['mime'] != 'directory':\n return stat['size']\n \n su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print out debugging information string string to be printed (in)
def debug(string): if verbose: print string return
[ "def debuggingInfo(self, debugStr=\"DEBUG: \"*30):\n print debugStr", "def debug(string):\n if conf.DEBUG:\n outputs.print_debug(string)", "def output_debug_info(self):", "def debug():", "def debug_print(text):\r\n if settings.debug:\r\n print (text)", "def debug_print(text):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do a NetInf PUBLISH for one file file_name is the file to do now
def pubone(file_name,alg,host): hash_alg=alg scheme="ni" rform="json" ext="{ \"meta\": { \"pubdirs\" : \"yep\" } }" # record start time of this stime=time.time() # Create NIdigester for use with form encoder and StreamingHTTP ni_digester = NIdigester() # Install the template URL b...
[ "def publish(self, filename):\n # 1) Encrypt file\n # 2) Publish to remote cloud server\n # 3) Wait for the result\n # 4) Store results in files located inside RAM folder", "def publish_file(directory, file_name, file_type):\n\n folder = create_folder(os.path.join(output_folder,file...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Command line program to perform a NetInf 'publish' operation using http convergence layer. Uses NIproc global instance of NI operations class
def py_nipubdir(): # Options parsing and verification stuff usage = "%%prog -d <pathname of content directory> -n <FQDN of netinf node> [-a <hash alg>] [-m NN] [-c count]" parser = OptionParser(usage) parser.add_option("-d", "--dir", dest="dir_name", type="string", ...
[ "def main():\n\n obj = PowerStoreNfsExport()\n obj.perform_module_operation()", "def _run_neural_network(self):\n\t\tprogram = ['mpiexec','-np',self._np,'python','./scripts/runClosedLoopNn.py',self._eesFreq,self._eesAmp,self._nnStructFile,self._species,self._totSimulationTime,self._perturbationParams]\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate cached and grouped activity items for personal and universal news. Args
def build_activity(self, user_id): activity_ids = self.raw_activity_links_collection.get_activity_ids_for_user(user_id) friend_ids = self.friends_collection.getFriends(user_id, limit=None) personal_items = self.raw_activity_items_collection.get_activity_items(activity_ids) universal_ve...
[ "def activities_to_jsonfeed(activities, actor=None, title=None, feed_url=None,\n home_page_url=None):\n try:\n iter(activities)\n except TypeError:\n raise TypeError('activities must be iterable')\n\n if isinstance(activities, (dict, str)):\n raise TypeError('activities may not...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This initializes the C fitting library.
def initializeC(self, image): super(CPupilFit, self).initializeC(image) self.mfit = self.clib.pfitInitialize(self.pupil_fn.getCPointer(), self.rqe, self.scmos_cal, self...
[ "def initialize_calib_prep():\n instance = CalibPrep('nircam')\n instance.verbose = False\n # instance.inputs = ascii.read('test_calib_input_table.txt')\n instance.inputs = 'nothing'\n instance.search_dir = jwst_reffiles.__path__\n instance.output_dir = '/dummy/output/dir/'\n return instance", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pass new peaks to the C library.
def newPeaks(self, peaks, peaks_type): c_peaks = self.formatPeaks(peaks, peaks_type) self.clib.pfitNewPeaks(self.mfit, c_peaks, ctypes.c_char_p(peaks_type.encode()), c_peaks.shape[0])
[ "def changePeaks(self):\n # Change the number of peaks\n if self.minpeaks is not None and self.maxpeaks is not None:\n npeaks = len(self.peaks_function)\n u = self.random.random()\n r = self.maxpeaks - self.minpeaks\n if u < 0.5:\n # Remove n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that addEventListener gets flagged appropriately.
def test_addEventListener(): err = _do_test_raw(""" x.addEventListener("click", function() {}, true); x.addEventListener("click", function() {}, true, false); """) assert not err.failed() assert not err.notices err = _do_test_raw(""" x.addEventListener("click", function() {}, true, tru...
[ "def test_mouseevents():\n\n err = _do_test_raw(\"window.addEventListener('mousemove', func);\")\n assert err.warnings", "def test_add_listener(self):\n self.wrapper.add_listener(self._assert_in_reactor_thread)\n event = object()\n internal_listener, = self.client.listeners\n int...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that createElement calls are filtered properly
def test_createElement(): assert not _do_test_raw(""" var x = "foo"; x.createElement(); x.createElement("foo"); """).failed() assert _do_test_raw(""" var x = "foo"; x.createElement("script"); """).failed() assert _do_test_raw(""" var x = "foo"; x.createElement(bar); ...
[ "def testCreatesCreator(self):\n for element in self.root_element.children:\n if element.tag == 'creator':\n self.assertNotEqual(len(element.content), 0)", "def test_create_tag(self):\n pass", "def testCreatesType(self):\n for element in self.root_element.children:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that createElementNS calls are filtered properly
def test_createElementNS(): assert not _do_test_raw(""" var x = "foo"; x.createElementNS(); x.createElementNS("foo"); x.createElementNS("foo", "bar"); """).failed() assert _do_test_raw(""" var x = "foo"; x.createElementNS("foo", "script"); """).failed() assert _do_test_raw...
[ "def test_createElement():\n\n assert not _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement();\n x.createElement(\"foo\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement(\"script\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that warnings on SQL methods are emitted properly
def test_sql_methods(): err = _do_test_raw(""" x.executeSimpleSQL("foo " + y); """) assert err.warnings[0]['id'][-1] == 'executeSimpleSQL_dynamic' err = _do_test_raw(""" x.createStatement("foo " + y); """) assert err.warnings[0]['id'][-1] == 'executeSimpleSQL_dynamic' err ...
[ "def trap_warnings():\n import warnings, MySQLdb\n warnings.filterwarnings('error', category=MySQLdb.Warning)", "def test_build_sql_impossible():\n columns = {\"a\": String(), \"b\": Float()}\n\n with pytest.raises(ImpossibleFilterError):\n build_sql(columns, {\"a\": Impossible()}, [])", "def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that setAttribute calls are blocked successfully
def test_setAttribute(): assert not _do_test_raw(""" var x = "foo"; x.setAttribute(); x.setAttribute("foo"); x.setAttribute("foo", "bar"); """).failed() assert _do_test_raw(""" var x = "foo"; x.setAttribute("onfoo", "bar"); """).failed()
[ "def testSetAttributeAction(self):\n\t action = SetAttributeAction('x', 'y', ('key',), 'z')\n\t self.failUnless(action.field == 'y')\n\t self.failUnless(action.value == 'z')", "def test_set_attribute(self, attr1, value1):\n self.assertTrue(self.client.set_attribute(self.app_name, attr1, value1))\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that insertAdjacentHTML works the same as innerHTML.
def test_insertAdjacentHTML(): assert not _do_test_raw(""" var x = foo(); x.insertAdjacentHTML("foo bar", "<div></div>"); """).failed() assert _do_test_raw(""" var x = foo(); x.insertAdjacentHTML("foo bar", "<div onclick=\\"foo\\"></div>"); """).failed() # Test without declaration...
[ "def test_createElement():\n\n assert not _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement();\n x.createElement(\"foo\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement(\"script\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that `nsIFile.launch()` is flagged.
def test_nsIFile_launch(): assert _do_test_raw('foo.launch()').failed()
[ "def test_fail_launch_file(self):\n args = self.args.copy()\n # Pass a string instead of a list\n args[\"traj_file\"] = \"nofile.xtc\"\n with pytest.raises(FileNotFoundError) as err:\n UI.launch(**args)\n assert \"nofile.xtc does not exist.\" in str(err.value)", "def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that `.openDialog("")` throws doesn't throw an error for chrome/local URIs.
def test_openDialog_pass(self): self.run_script(""" foo.openDialog("foo") foo.openDialog("chrome://foo/bar") """) self.assert_silent()
[ "def test_openDialog(self):\n\n def test_uri(self, uri):\n self.setUp()\n self.setup_err()\n self.run_script('foo.openDialog(\"%s\")' % uri)\n self.assert_failed(with_warnings=True)\n\n uris = ['http://foo/bar/',\n 'https://foo/bar/',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that `.openDialog(bar)` throws doesn't throw an error where `bar` is a dirty object.
def test_openDialog_flag_var(self): self.run_script(""" foo.openDialog(bar) """) self.assert_notices()
[ "def test_openDialog_pass(self):\n self.run_script(\"\"\"\n foo.openDialog(\"foo\")\n foo.openDialog(\"chrome://foo/bar\")\n \"\"\")\n self.assert_silent()", "def test_open_project_fails(self):\n with patch('cauldron.steptest.support.open_project') as open_project:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that `.openDialog("")` throws an error where is a nonchrome, nonrelative URL.
def test_openDialog(self): def test_uri(self, uri): self.setUp() self.setup_err() self.run_script('foo.openDialog("%s")' % uri) self.assert_failed(with_warnings=True) uris = ['http://foo/bar/', 'https://foo/bar/', 'ftp://f...
[ "def test_openDialog_pass(self):\n self.run_script(\"\"\"\n foo.openDialog(\"foo\")\n foo.openDialog(\"chrome://foo/bar\")\n \"\"\")\n self.assert_silent()", "def OpenErrorDlg(parent, fname, err):\n argmap = dict(filename=fname, errormsg=err)\n dlg = wx.MessageDialog(paren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
select name from mydb.item_item where ingredients not like '%multimedia%' and ingredients not like '%provision%'
def test_excludeIngredientQuery(self) -> None: ingredient0 = 'multimedia' ingredient1 = 'provision' result = self.entries.exclude(Q(ingredients__icontains=ingredient0) | Q(ingredients__icontains=ingredient1)) self.assertEqual(988, len(result)) queries = (Q(ingredients__icontains...
[ "def search_nutrition(ingredient_name):\n\n nutrients_df = pd.read_sql(f'select * from {NUTRIENTS_TABLE_NAME}', conn)\n mask_values_with_ingredient = nutrients_df['description'].apply(lambda el: ingredient_name in el)\n df = nutrients_df[mask_values_with_ingredient]\n dict_values = df[mask_values_with_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
select name from mydb.item_item where ingredients like '%multimedia%' and ingredients like '%provision%'
def test_includeIngredientQuery(self) -> None: ingredient0 = 'multimedia' ingredient1 = 'provision' result = self.entries.filter(Q(ingredients__icontains=ingredient0) & Q(ingredients__icontains=ingredient1)) self.assertEqual(1, len(result))
[ "def search_nutrition(ingredient_name):\n\n nutrients_df = pd.read_sql(f'select * from {NUTRIENTS_TABLE_NAME}', conn)\n mask_values_with_ingredient = nutrients_df['description'].apply(lambda el: ingredient_name in el)\n df = nutrients_df[mask_values_with_ingredient]\n dict_values = df[mask_values_with_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes the configuration for a group.
def _process_group(self, **config_kwargs) -> RobotGroupConfig: return RobotGroupConfig(self.sim_scene, **config_kwargs)
[ "def process_config(self):\n pass", "def _process_group(self, **config_kwargs) -> DynamixelGroupConfig:\n config = DynamixelGroupConfig(self.sim_scene, **config_kwargs)\n\n if config.is_active:\n self._combined_motor_ids.update(config.motor_ids)\n\n return config", "def lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the initial states for the given groups.
def get_initial_state( self, groups: Union[str, Sequence[str]], ) -> Union[RobotState, Sequence[RobotState]]: if isinstance(groups, str): configs = [self.get_config(groups)] else: configs = [self.get_config(name) for name in groups] states = []...
[ "def initial_states(self):\n return self._initial_states", "def initial_states(self):\n return list(self.iter_initial_states())", "def _get_group_states(\n self, configs: Sequence[RobotGroupConfig]) -> Sequence[RobotState]:\n states = []\n for config in configs:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the states for the given group configurations.
def _get_group_states( self, configs: Sequence[RobotGroupConfig]) -> Sequence[RobotState]: states = [] for config in configs: state = RobotState() # Return a blank state if this is a hardware-only group. if config.qpos_indices is None: stat...
[ "def _get_group_states(\n self,\n configs: Sequence[DynamixelGroupConfig],\n ) -> Sequence[DynamixelRobotState]:\n # Make one call to the hardware to get all of the positions/velocities,\n # and extract each individual groups' subset from them.\n all_qpos, all_qvel, all...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies observation noise to the given state.
def _apply_observation_noise(self, state: RobotState, config: RobotGroupConfig): if config.sim_observation_noise is None or self.random_state is None: return # Define the noise calculation. def noise(value_range: np.ndarray): amplitude = ...
[ "def add_noise(self):\n self.noise = torch.normal(0.5, .2, self.state.shape).double()\n self.noise *= torch.sqrt(2 *\n self.vars['T']*torch.tensor(self.vars['dt']))", "def apply_noise(self, input):\n mask = np.random.binomial(1, 1-self.noise_prob, len(input)) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Denormalizes the given action.
def _denormalize_action(self, action: np.ndarray, config: RobotGroupConfig) -> np.ndarray: if config.denormalize_center.shape != action.shape: raise ValueError( 'Action shape ({}) does not match actuator shape: ({})'.format( action.shap...
[ "def normalize_action(action, action_space_struct):\n\n def map_(a, s):\n if isinstance(s, gym.spaces.Box) and (\n s.dtype == np.float32 or s.dtype == np.float64\n ):\n # Normalize values to be exactly between -1.0 and 1.0.\n a = ((a - s.low) * 2.0) / (s.high - s.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This validates the post request as a whole and not just a field. During read, the validator practically skips. During post, each orderline unit is validated. If an orderline has more units than available product units, the order is not accepted.
def validate(self, attrs): exception_body = [] for orderline in attrs.get('orderlines', []): product = orderline['product'] # If orderline has less units than available, all good. if orderline['units'] <= product.units: continue # else er...
[ "def validate_order_item(self, request):\n raise NotImplementedError()", "def validate(self, data):\n if data.get('pieces') is not None and data.get('pieces') < 1 \\\n or data.get('unitary_purchase_price') is not None and data.get('unitary_purchase_price') < 0:\n raise seri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Actual updation of an order to confirmed/cancellation/delivery status happens here. There are only two valid transitions acceptable 1. From accepted to confirmed. 2. From confirmed to cancelled/delivered.
def update(self, instance, validated_data): # If an order is cancelled or delivered, it cannot be modified. if instance.status == CANCELLED or instance.status == DELIVERED: raise exceptions.PermissionDenied('This order cannot be modified.') # If an order is already confirmed but UI...
[ "def confirm(self):\n for item in self.item_set.filter(~Q(statuses__status=sts_const.CONFIRMED)):\n item.change_status(sts_const.CONFIRMED)\n\n signals.order_confirm.send(instance=self, now=timezone.now())", "def test_update_order(self):\n response = self.api_test_client.put('{}/or...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SearchResourceShareInvitationReqBody The model defined in huaweicloud sdk
def __init__(self, resource_share_ids=None, resource_share_invitation_ids=None, status=None, limit=None, marker=None): self._resource_share_ids = None self._resource_share_invitation_ids = None self._status = None self._limit = None self._marker = None ...
[ "def search_invoices(self,\n body):\n\n return super().new_api_call_builder.request(\n RequestBuilder().server('default')\n .path('/v2/invoices/search')\n .http_method(HttpMethodEnum.POST)\n .header_param(Parameter()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the resource_share_ids of this SearchResourceShareInvitationReqBody. 资源共享实例的ID列表。
def resource_share_ids(self): return self._resource_share_ids
[ "def resource_share_invitation_ids(self):\n return self._resource_share_invitation_ids", "def resource_share_invitation_ids(self, resource_share_invitation_ids):\n self._resource_share_invitation_ids = resource_share_invitation_ids", "def resource_share_ids(self, resource_share_ids):\n self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the resource_share_ids of this SearchResourceShareInvitationReqBody. 资源共享实例的ID列表。
def resource_share_ids(self, resource_share_ids): self._resource_share_ids = resource_share_ids
[ "def resource_share_invitation_ids(self, resource_share_invitation_ids):\n self._resource_share_invitation_ids = resource_share_invitation_ids", "def resource_share_invitation_ids(self):\n return self._resource_share_invitation_ids", "def resource_share_ids(self):\n return self._resource_sh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the resource_share_invitation_ids of this SearchResourceShareInvitationReqBody. 资源共享邀请的ID列表。
def resource_share_invitation_ids(self): return self._resource_share_invitation_ids
[ "def resource_share_invitation_ids(self, resource_share_invitation_ids):\n self._resource_share_invitation_ids = resource_share_invitation_ids", "def resource_share_ids(self):\n return self._resource_share_ids", "def resource_share_ids(self, resource_share_ids):\n self._resource_share_ids =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the resource_share_invitation_ids of this SearchResourceShareInvitationReqBody. 资源共享邀请的ID列表。
def resource_share_invitation_ids(self, resource_share_invitation_ids): self._resource_share_invitation_ids = resource_share_invitation_ids
[ "def resource_share_invitation_ids(self):\n return self._resource_share_invitation_ids", "def resource_share_ids(self, resource_share_ids):\n self._resource_share_ids = resource_share_ids", "def resource_ids(self, resource_ids):\n self._resource_ids = resource_ids", "def resource_share_id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create lr scheduler based on config. note that lr_scheduler must accept a optimizer that has been restored.
def build(optimizer_config, optimizer, total_step): optimizer_type = optimizer_config.WhichOneof('optimizer') if optimizer_type == 'rms_prop_optimizer': config = optimizer_config.rms_prop_optimizer lr_scheduler = _create_learning_rate_scheduler( config.learning_rate, optimizer, total_step=total_step)...
[ "def create_scheduler(config, optimizer, data):\n if 'lr' in config.keys():\n raise KeyError('Illegal keyword \"lr\" used in config. Use keyword \"constant_lr\" instead.')\n\n configured_scheduler = config.get('lr_scheduler')\n\n if configured_scheduler is None or configured_scheduler == 'cyclic':\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a osd "action."
def _action(self, action, osd, info=None, **kwargs): body = {action: info} self.run_hooks('modify_body_for_action', body, **kwargs) url = '/osds/%s/action' % base.getid(osd) return self.api.client.post(url, body=body)
[ "def device_action(self, client, action):\r\n client.deviceAction(action)", "def perform_actual_action(self, action):\n self.game.perform_action(action)", "def pause(args):\n for local_id in get_local_osd_ids():\n cmd = [\n 'ceph',\n '--id', 'osd-upgrade',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The SubstanceEnzyme graph representing the collective metabolic network, occuring in any organism of the clade. This includes each and every enzyme of every organism of this clade.
def collectiveMetabolismEnzymes(self, excludeMultifunctionalEnzymes = defaultExcludeMultifunctionalEnzymes) -> SubstanceEnzymeGraph: graph = self.group.collectiveEnzymeGraph(noMultifunctional = excludeMultifunctionalEnzymes, keepOnHeap = True) graph.name = 'Collective metabolism enzymes ' + ' '.join(sel...
[ "def get_graph_karateclub():\n all_members = set(range(34))\n club1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 19, 21}\n # club2 = all_members - club1\n\n G = eg.Graph(name=\"Zachary's Karate Club\")\n for node in all_members:\n G.add_node(node+1)\n\n zacharydat = \"\"\"\\\n0 1 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The SubstanceEC graph representing the common metabolic network, shared among all organisms of the clade. This includes only EC numbers which occur in at least `majorityPercentageCoreMetabolism` % of all organisms of this clade.
def coreMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, excludeMultifunctionalEnzymes = defaultExcludeMultifunctionalEnzymes) -> SubstanceEcGraph: graph = self.group.majorityEcGraph(majorityPercentage = majorityPercentageCoreMetabolism, noMultifunctional = excludeMul...
[ "def conservedMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEcGraph:\n parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism)\n childCoreMetabolism = self.childClade.coreMetabolism(majorityPercentageCoreMetabo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The number of organisms (leaf taxons) in this clade. Returns int The number of organisms (leaf taxons) in this clade.
def organismsCount(self) -> int: return self.group.organismsCount
[ "def leaf_count(self) -> int:\n if self.children is None:\n return 1\n return sum([child.leaf_count() for child in self.children])", "def leaf_count(self) -> int:\n if self.children == []:\n return 1\n else:\n return sum([x.leaf_count() for x in self.ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The substanceEnzyme graph of all gene duplicated enzymes of the core metabolism.
def geneDuplicatedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, colour = False) -> SubstanceEnzymeGraph: enzymeGraph = self.coreMetabolismEnzymes(majorityPercentageCoreMetabolism) geneDuplicationModel = SimpleGeneDup...
[ "def addedMetabolismGeneDuplicatedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph:\n parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism)\n childCoreMetabolism = self.childClade.coreMetabolism(majorit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All gene duplicated enzymes of the core metabolism, pointing to all their duplicates.
def geneDuplicatedEnzymesDict(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Dict[Enzyme, Set[GeneID]]: enzymeGraph = self.coreMetabolismEnzymes(majorityPercentageCoreMetabolism) geneDuplicationModel = SimpleGeneDuplication geneIDs...
[ "def geneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]:\n \n \n enzymes = self.coreMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes()\n geneDuplicationModel = SimpleGeneDuplication\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All gene duplicated enzymes of the core metabolism, paired with each of their duplicates. If enzyme A is a duplicate of enzyme B and vice versa, this does not return duplicates, but returns only one pair, with the "smaller" enzyme as the first value. An enzyme is "smaller" if its gene ID string is "smaller".
def geneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]: enzymes = self.coreMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes() geneDuplicationModel = SimpleGeneDuplication ...
[ "def divergedMetabolismGeneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]:\n # get diverged metabolism\n divergedMetabolismEnzymes = self.divergedMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The substanceEC graph of EC numbers belonging to function changes of neofunctionalised enzymes of the core metabolism. Only EC numbers which could have actually taken part in a function change are reported. This is because enzymes can have multiple EC numbers, while only some might be eligible for a function change. Fo...
def neofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False, eValue = defaultEValue, considerOnlyECs = None) -> SubstanceEcGraph: # get neofunctionalisations ...
[ "def redundantECsForContributingNeofunctionalisation(self, \n majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, \n majorityPercentageNeofunctionalisation = defaultMajorityPercentag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get neofunctionalisation events of all enzymes in the core metabolism.
def neofunctionalisations(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, eValue = defaultEValue, considerOnlyECs = None) -> Set[Neofunctionalisation]: # get neofunctionalisations return self._neofunctionalisedEnzymes(majorityPercentageCoreMetabolism, eValue, co...
[ "def neofunctionalisationsForFunctionChange(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, eValue = defaultEValue, considerOnlyECs = None) -> Dict[FunctionChange, Set[Neofunctionalisation]]:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get neofunctionalisation events of all enzymes in the core metabolism, grouped by each possible function change event.
def neofunctionalisationsForFunctionChange(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, eValue = defaultEValue, considerOnlyECs = None) -> Dict[FunctionChange, Set[Neofunctionalisation]]: ...
[ "def neofunctionalisations(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, eValue = defaultEValue, considerOnlyECs = None) -> Set[Neofunctionalisation]:\n # get neofunctionalisations \n return self._neofunctionalisedEnzymes(majorityPercentageCoreMetabolism, eVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get neofunctionalisation events of all enzymes in the core metabolism, which contribute to redundancy, pointing to the EC numbers their function changes' EC numbers provides redundancy for.
def redundantECsForContributingNeofunctionalisation(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofun...
[ "def neofunctionalisationsForFunctionChange(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, eValue = defaultEValue, considerOnlyECs = None) -> Dict[FunctionChange, Set[Neofunctionalisation]]:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All names/paths in NCBI taxonomy used to create the parent clade.
def parentNCBInames(self): return self.parentClade.ncbiNames
[ "def get_taxon_from_parents( self, parent_name ):\n global get_taxonomy_toc, BADTAXA_TOC\n TAXONOMY_TOC = get_taxonomy_toc()\n assert parent_name in TAXONOMY_TOC, \"%s does not exist in the current taxonomy\" % parent_name\n parent_id = Taxonomy.objects.get( name = parent_name ).id\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All names/paths in NCBI taxonomy used to create the child clade.
def childNCBInames(self): return self.childClade.ncbiNames
[ "def _parse_taxonomy(self):\n name_dict = {x['nodeName']: x for x in self._taxonomy}\n parents = set()\n for x in self._taxonomy:\n parents.add(x['parentName'])\n\n # leaf nodes are those without any child\n leaf_nodes = [name_dict[x] for x\n in lis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEC graph of the conserved core metabolism.
def conservedMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEcGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPercentageCoreMetabolism) ...
[ "def coreMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, excludeMultifunctionalEnzymes = defaultExcludeMultifunctionalEnzymes) -> SubstanceEcGraph:\n graph = self.group.majorityEcGraph(majorityPercentage = majorityPercentageCoreMetabolism, noMultifunctional = excl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEC graph of the added core metabolism.
def addedMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEcGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPercentageCoreMetabolism) ...
[ "def coreMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, excludeMultifunctionalEnzymes = defaultExcludeMultifunctionalEnzymes) -> SubstanceEcGraph:\n graph = self.group.majorityEcGraph(majorityPercentage = majorityPercentageCoreMetabolism, noMultifunctional = excl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEC graph of the unified core metabolisms. The lost metabolism of the parent is coloured in blue, the conserved metabolism of both in red, and the added metabolism of the child in pink. The colouring is realised by adding a 'colour' attribute to each edge. Nodes are not coloured.
def unifiedMetabolism(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, colour = False) -> SubstanceEcGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPercentageCor...
[ "def unifiedMetabolismNeofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False) -> SubstanceEcGraph: \n parentNeofunctionalised = self.parentClade.neofun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEnzyme graph derived from the unified core metabolisms. The lost metabolism of the parent is coloured in blue, the conserved metabolism of both in red, and the added metabolism of the child in pink. The colouring is realised by adding a 'colour' attribute to each edge. Nodes are not coloured.
def unifiedMetabolismEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, colour = False) -> SubstanceEnzymeGraph: parentGraph = self.parentClade.coreMetabolismEnzymes(majorityPercentageCoreMetabolism) childGraph = self.childClade.coreMetabolismEnzymes(majorityPercen...
[ "def tree_2coloring(dist_mx):\n\n class coloured_storage():\n def __init__(self):\n self.red = []\n self.black = []\n self._current = False\n\n def next_colour(self):\n self._current = not self._current\n if self._current:\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEnzyme graph of geneduplicated enzymes, derived from the added core metabolism. First, the added core metabolism is calculated. Then, the enzymes associated with the added EC numbers are extracted from the child's enzyme metabolism.
def addedMetabolismGeneDuplicatedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPercen...
[ "def addedMetabolismNeofunctionalisedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph:\n parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism)\n childCoreMetabolism = self.childClade.coreMetabolism(majo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEnzyme graph of geneduplicated enzymes, derived from the lost core metabolism. First, the lost core metabolism is calculated. Then, the enzymes associated with the added EC numbers are extracted from the parent's enzyme metabolism.
def lostMetabolismGeneDuplicatedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPercent...
[ "def addedMetabolismGeneDuplicatedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph:\n parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism)\n childCoreMetabolism = self.childClade.coreMetabolism(majorit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pairs of geneduplicated enzymes, derived from the conserved core metabolism. First, the conserved core metabolism is calculated. Then, the enzymes associated with the conserved EC numbers are extracted from the collective parent's and child's metabolism individually. Then, for parent and child, the geneduplicated enzym...
def conservedMetabolismGeneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Tuple[Set[Tuple[Enzyme, Enzyme]]]: # get conserved metabolism conservedMetabolismEnzymes = self.conservedMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes() ...
[ "def divergedMetabolismGeneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]:\n # get diverged metabolism\n divergedMetabolismEnzymes = self.divergedMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pairs of geneduplicated enzymes, derived from the diverged core metabolism. First, the diverged core metabolism is calculated. Then, the enzymes associated with the added EC numbers are extracted from the collective parent's and child's metabolism individually. Then, for parent and child, the geneduplicated enzyme pair...
def divergedMetabolismGeneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]: # get diverged metabolism divergedMetabolismEnzymes = self.divergedMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes() ...
[ "def unifiedMetabolismGeneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]: \n parentGeneDuplicated = self.parentClade.geneDuplicatedEnzymePairs(majorityPercentageCoreMetabolism)\n childGeneDuplicated = self.ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pairs of geneduplicated enzymes, derived from the unified core metabolisms.
def unifiedMetabolismGeneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]: parentGeneDuplicated = self.parentClade.geneDuplicatedEnzymePairs(majorityPercentageCoreMetabolism) childGeneDuplicated = self.childClad...
[ "def geneDuplicatedEnzymePairs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> Set[Tuple[Enzyme, Enzyme]]:\n \n \n enzymes = self.coreMetabolismEnzymes(majorityPercentageCoreMetabolism).getEnzymes()\n geneDuplicationModel = SimpleGeneDuplication\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEnzyme graph of neofunctionalised enzymes, derived from the added core metabolism.
def addedMetabolismNeofunctionalisedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPer...
[ "def collectiveMetabolismEnzymes(self, excludeMultifunctionalEnzymes = defaultExcludeMultifunctionalEnzymes) -> SubstanceEnzymeGraph:\n graph = self.group.collectiveEnzymeGraph(noMultifunctional = excludeMultifunctionalEnzymes, keepOnHeap = True)\n graph.name = 'Collective metabolism enzymes ' + ' '.j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEnzyme graph of neofunctionalised enzymes, derived from the lost core metabolism.
def lostMetabolismNeofunctionalisedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism) childCoreMetabolism = self.childClade.coreMetabolism(majorityPerc...
[ "def addedMetabolismNeofunctionalisedEnzymes(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism) -> SubstanceEnzymeGraph:\n parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMetabolism)\n childCoreMetabolism = self.childClade.coreMetabolism(majo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEC graph of "neofunctionalised" EC numbers, derived from the added core metabolism.
def addedMetabolismNeofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation) -> SubstanceEcGraph: parentCoreMetabolism = self.parentClade.coreMetabolism(majorityPercentageCoreMeta...
[ "def unifiedMetabolismNeofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False) -> SubstanceEcGraph: \n parentNeofunctionalised = self.parentClade.neofun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Two SubstanceEC graphs of "neofunctionalised" EC numbers, derived from the diverged core metabolism.
def divergedMetabolismNeofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False): divergedMetabolism = self.divergedMetabolism(majorityPercentageCoreMetabolism, col...
[ "def unifiedMetabolismNeofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False) -> SubstanceEcGraph: \n parentNeofunctionalised = self.parentClade.neofun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SubstanceEC graph of "neofunctionalised" EC numbers, derived from the unified core metabolisms.
def unifiedMetabolismNeofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False) -> SubstanceEcGraph: parentNeofunctionalised = self.parentClade.neofunctiona...
[ "def neofunctionalisedECs(self, majorityPercentageCoreMetabolism = defaultMajorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation = defaultMajorityPercentageNeofunctionalisation, colour = False, eValue = defaultEValue, considerOnlyECs = None) -> SubstanceEcGraph:\n # get neofunctionalisation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Two clades in NCBI taxonomy, 'child' is assumed younger and must be nested somewhere inside 'parent'.
def __init__(self, parent, child, excludeUnclassified = defaultExcludeUnclassified): # read first NCBI name from Clade object, if necessary if isinstance(parent, Clade): parentNCBIname = parent.ncbiNames[0] elif not isinstance(parent, str): # must be iterable, else fail ...
[ "def children(self, taxon, taxonomy):\n\n c = set()\n for taxon_id, taxa in taxonomy.items():\n if taxon in taxa:\n\n if taxon.startswith('s__'):\n c.add(taxon_id)\n else:\n taxon_index = taxa.index(taxon)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compare the current scene references versions with metadata and update as needed
def sceneRefCheck(silent=False): uptodate = True logger.debug('init sceneChecking...') currentProject = database.getCurrentProject() projName = pm.fileInfo.get('projectName') if currentProject != projName: logger.error('This file is from a project different from the current project') ...
[ "def test_fix_reference_namespace_is_working_properly_with_refs_updated_in_a_previous_scene_deeper(\n create_test_data, create_pymel, create_maya_env\n):\n data = create_test_data\n pm = create_pymel\n maya_env = create_maya_env\n # create deep reference\n data[\"asset2_model_main_v002\"].is_publi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read a .plist file from filepath. Return the unpacked root object (which usually is a dictionary).
def readPlist(filepath): plistData = NSData.dataWithContentsOfFile_(filepath) dataObject, plistFormat, error = NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_errorDescription_(plistData, NSPropertyListMutableContainers, None, None) if error: errmsg = "%s in file %s" % (error, filepath) ...
[ "def read(path: str) -> Dict:\n exc.raise_if_falsy(path=path)\n\n with open(path, 'rb') as plist_file:\n return plistlib.load(plist_file)", "def load_plist(plist_path: str) -> List[dict]:\n with open(plist_path, 'rb') as fp:\n plist = plistlib.load(fp)\n return plist", "def _read_p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print out the end status of the game when the server closes the connection.
def server_closed_connection(self): print("Game Over!") if self._winner: print("Player {} wins!".format(self._winner)) else: print("Draw!")
[ "def on_connection_end() -> None:\r\n print(\"Connection lost with G-Earth\")\r\n print()", "def end_game():\n custom_log.logger.info(\"You Lost!\")\n print_map()", "def end(self):\n winners = mafia.str_player_list(self.game.winners())\n logging.info(\"Game over! Winners: %s\" % winner...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Track a download in Piwik
def track_download_request(download_url, download_title): from indico_piwik.plugin import PiwikPlugin if not download_url: raise ValueError("download_url can't be empty") if not download_title: raise ValueError("download_title can't be empty") request = PiwikRequest(server_url=PiwikPlu...
[ "def download_created(req, download):", "def OnDownloadBegin(self):", "def OnDownloadComplete(self):", "def download_changed(req, download, old_download):", "def download_progress(self, cloud_file, size, downloaded):", "def dowload_vt():\n print get_date_time_now() + \" ==> Download VT Samples started!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
T.__new__(S, ...) > a new object with type S, a subtype of T
def __new__(S, *more): # real signature unknown; restored from __doc__ pass
[ "def __new__(S, *more): # real signature unknown; restored from __doc__\n pass", "def _factory(*args_, **kwargs_):\n return ObsType(*args_, **kwargs_)", "def New(*args, **kargs):\n obj = itkVesselTubeSpatialObject2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.N...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the test server's URL.
def get_server_url(self): return "http://{}:{}".format(live_host, self._port_value.value)
[ "def get_server_url(self):\n return \"http://localhost:%s\" % self._port_value.value", "def get_server_url(self):\r\n return self.server_url", "def server_url(self) -> str:\n return get_server_url(local_site=self.local_site)", "def server_url(self):\n # type: () -> tp.Text\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all qualities with exitsting expert knowledge.
def get_qualities_with_expert_knowledge(self) -> List[str]: return sorted(list(set([q for _, q in self.expert_knowledge])))
[ "def get_expert_knowledge_for_qualities(self, qualities: List[str]) -> List[str]:\n expert_knowledge = reduce(\n lambda res, q: res | set(p for p, _q in self.expert_knowledge if _q == q),\n qualities,\n set()\n )\n return sorted(list(expert_knowledge))", "def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all parameters with exitsting expert knowledge.
def get_parameters_with_expert_knowledge(self) -> List[str]: return sorted(list(set([p for p, _ in self.expert_knowledge])))
[ "def param_names(self) -> List[str]:", "def _get_fitted_param_names(self):\n return self._fitted_param_names", "def get_hyperparameter_names():\n params = ['mu', 'nu', 'r', 's']\n return params", "def _getAllParamNames(self):\r\n names=copy.deepcopy(self._paramNamesSoFar)\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all qualities that are affected by the given parameter.
def get_qualities_affected_by_paramter(self, parameter: str) -> List[str]: return [q for p, q in self.correlating_pq_tuples if p == parameter]
[ "def get_parameters_affecting_qualites(self, qualities: List[str]) -> List[str]:\n parameters = reduce(\n lambda res, q: res | set(self.get_parameters_affecting_quality(q)),\n qualities,\n set()\n )\n return sorted(list(parameters))", "def get_parameters_affec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all parameters are affecting the given quality.
def get_parameters_affecting_quality(self, quality: str) -> List[str]: return [p for p, q in self.correlating_pq_tuples if q == quality]
[ "def get_parameters_affecting_qualites(self, qualities: List[str]) -> List[str]:\n parameters = reduce(\n lambda res, q: res | set(self.get_parameters_affecting_quality(q)),\n qualities,\n set()\n )\n return sorted(list(parameters))", "def get_qualities_affect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all parameters are affecting the given qualities.
def get_parameters_affecting_qualites(self, qualities: List[str]) -> List[str]: parameters = reduce( lambda res, q: res | set(self.get_parameters_affecting_quality(q)), qualities, set() ) return sorted(list(parameters))
[ "def get_parameters_affecting_quality(self, quality: str) -> List[str]:\n return [p for p, q in self.correlating_pq_tuples if q == quality]", "def get_qualities_affected_by_paramter(self, parameter: str) -> List[str]:\n return [q for p, q in self.correlating_pq_tuples if p == parameter]", "def par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all parameters that are expert knowledge of the given qualities.
def get_expert_knowledge_for_qualities(self, qualities: List[str]) -> List[str]: expert_knowledge = reduce( lambda res, q: res | set(p for p, _q in self.expert_knowledge if _q == q), qualities, set() ) return sorted(list(expert_knowledge))
[ "def get_parameters_affecting_qualites(self, qualities: List[str]) -> List[str]:\n parameters = reduce(\n lambda res, q: res | set(self.get_parameters_affecting_quality(q)),\n qualities,\n set()\n )\n return sorted(list(parameters))", "def get_parameters_with_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of all qualties that are expert knowledge of the given parameter.
def get_expert_knowledge_for_parameter(self, parameter: str) -> List[str]: expert_knowledge = [q for (p, q) in self.expert_knowledge if p == parameter] return sorted(list(set(expert_knowledge)))
[ "def get_qualities_affected_by_paramter(self, parameter: str) -> List[str]:\n return [q for p, q in self.correlating_pq_tuples if p == parameter]", "def get_qualities_with_expert_knowledge(self) -> List[str]:\n return sorted(list(set([q for _, q in self.expert_knowledge])))", "def get_expert_knowl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method tests timetable records in STATE_EMBRYO state
def test_state_embryo(self): self.pipeline_real.insert_uow = then_return_uow pipeline = spy(self.pipeline_real) job_record = get_job_record(job.STATE_EMBRYO, TEST_PRESET_TIMEPERIOD, PROCESS_SITE_HOURLY) pipeline.ma...
[ "def test_preset_timeperiod_state_in_progress(self):\n when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True)\n uow_dao_mock = mock(UnitOfWorkDao)\n when(uow_dao_mock).get_one(any()).thenReturn(create_unit_of_work(PROCESS_UNIT_TEST, 0, 1, None))\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method tests timetable records in STATE_IN_PROGRESS state
def test_future_timeperiod_state_in_progress(self): when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True) uow_dao_mock = mock(UnitOfWorkDao) when(uow_dao_mock).get_one(any()).thenReturn(create_unit_of_work(PROCESS_UNIT_TEST, 0, 1, None)) self.pipeline_...
[ "def test_preset_timeperiod_state_in_progress(self):\n when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True)\n uow_dao_mock = mock(UnitOfWorkDao)\n when(uow_dao_mock).get_one(any()).thenReturn(create_unit_of_work(PROCESS_UNIT_TEST, 0, 1, None))\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method tests timetable records in STATE_IN_PROGRESS state
def test_preset_timeperiod_state_in_progress(self): when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True) uow_dao_mock = mock(UnitOfWorkDao) when(uow_dao_mock).get_one(any()).thenReturn(create_unit_of_work(PROCESS_UNIT_TEST, 0, 1, None)) self.pipeline_...
[ "def test_future_timeperiod_state_in_progress(self):\n when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True)\n uow_dao_mock = mock(UnitOfWorkDao)\n when(uow_dao_mock).get_one(any()).thenReturn(create_unit_of_work(PROCESS_UNIT_TEST, 0, 1, None))\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method tests timetable records in STATE_FINAL_RUN state
def test_processed_state_final_run(self): uow_dao_mock = mock(UnitOfWorkDao) when(uow_dao_mock).get_one(any()).thenReturn( create_unit_of_work(PROCESS_UNIT_TEST, 1, 1, None, unit_of_work.STATE_PROCESSED)) self.pipeline_real.uow_dao = uow_dao_mock pipeline = spy(self.pipeline...
[ "def IsFinal(self):\n return self.state in FINAL_TEST_RUN_STATES", "def test_future_timeperiod_state_in_progress(self):\n when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True)\n uow_dao_mock = mock(UnitOfWorkDao)\n when(uow_dao_mock).get_one(any()).thenR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method tests timetable records in STATE_SKIPPED state
def test_state_skipped(self): pipeline = spy(self.pipeline_real) job_record = get_job_record(job.STATE_SKIPPED, TEST_PRESET_TIMEPERIOD, PROCESS_SITE_HOURLY) pipeline.manage_pipeline_for_process(job_record.process_name, job_...
[ "def verify_skip(self, d_stmt, table): \n pass", "def test_search_housekeeping_schedule_skip(self):\n pass", "def _process_state_skipped(self, process_name, job_record):\n msg = 'Skipping job record %s in timeperiod %s. Apparently its most current timeperiod as of %s UTC' \\\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method tests timetable records in STATE_PROCESSED state
def test_state_processed(self): pipeline = spy(self.pipeline_real) job_record = get_job_record(job.STATE_PROCESSED, TEST_PRESET_TIMEPERIOD, PROCESS_SITE_HOURLY) pipeline.manage_pipeline_for_process(job_record.process_name, ...
[ "def test_preset_timeperiod_state_in_progress(self):\n when(self.time_table_mocked).can_finalize_job_record(any(str), any(Job)).thenReturn(True)\n uow_dao_mock = mock(UnitOfWorkDao)\n when(uow_dao_mock).get_one(any()).thenReturn(create_unit_of_work(PROCESS_UNIT_TEST, 0, 1, None))\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to create employee manager.
def create_manager(self, name, pos, dept): self.manager[dept.upper()].append( { 'name': name, 'pos': pos, 'dept': dept, 'senior': [], 'junior': [], 'trainee': [] } )
[ "def create_emp(self, name, pos, dept):\n if pos.upper() == 'MANAGER':\n self.create_manager(name, pos, dept)\n elif pos.upper() == 'SENIOR':\n self.create_senior(name, pos, dept)\n elif pos.upper() == 'JUNIOR':\n self.create_junior(name, pos, dept)\n els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to create employee senior.
def create_senior(self, name, pos, dept): self.senior[dept.upper()].append( { 'name': name, 'pos': pos, 'dept': dept, 'manager': self.manager[dept.upper()][0]['name'], 'junior': [], 'trainee': [] ...
[ "def create_emp(self, name, pos, dept):\n if pos.upper() == 'MANAGER':\n self.create_manager(name, pos, dept)\n elif pos.upper() == 'SENIOR':\n self.create_senior(name, pos, dept)\n elif pos.upper() == 'JUNIOR':\n self.create_junior(name, pos, dept)\n els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions to create employee junior.
def create_junior(self, name, pos, dept): self.junior[dept.upper()].append( { 'name': name, 'pos': pos, 'dept': dept, 'manager': self.manager[dept.upper()][0]['name'], 'senior': self.senior[dept.upper()][0]['name'], ...
[ "def create_emp(self, name, pos, dept):\n if pos.upper() == 'MANAGER':\n self.create_manager(name, pos, dept)\n elif pos.upper() == 'SENIOR':\n self.create_senior(name, pos, dept)\n elif pos.upper() == 'JUNIOR':\n self.create_junior(name, pos, dept)\n els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to create employee trainee.
def create_trainee(self, name, pos, dept): self.trainee[dept.upper()].append( { 'name': name, 'pos': pos, 'dept': dept, 'manager': self.manager[dept.upper()][0]['name'], 'senior': self.senior[dept.upper()][0]['name'], ...
[ "def create_emp(self, name, pos, dept):\n if pos.upper() == 'MANAGER':\n self.create_manager(name, pos, dept)\n elif pos.upper() == 'SENIOR':\n self.create_senior(name, pos, dept)\n elif pos.upper() == 'JUNIOR':\n self.create_junior(name, pos, dept)\n els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to create employee based on postion.
def create_emp(self, name, pos, dept): if pos.upper() == 'MANAGER': self.create_manager(name, pos, dept) elif pos.upper() == 'SENIOR': self.create_senior(name, pos, dept) elif pos.upper() == 'JUNIOR': self.create_junior(name, pos, dept) else: ...
[ "def create_employee(self,personal_identity):\r\n new_emp = Employee(*personal_identity)\r\n registration_str = new_emp.get_registration_str()\r\n\r\n return_value = self.save_object_to_DB(\"employee\",registration_str)\r\n return return_value", "def create_employee_from_applicant(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test the attrs of City when set
def test_set_attrs(self): city2 = City() city2.name = "Hawaii" self.assertEqual(city2.name, "Hawaii") city2.state_id = "<3" self.assertEqual(city2.state_id, "<3") self.assertEqual(City.name, "") self.assertEqual(City.state_id, "")
[ "def test_attributes_City(self):\n self.assertTrue('id' in self.city.__dict__)\n self.assertTrue('created_at' in self.city.__dict__)\n self.assertTrue('updated_at' in self.city.__dict__)\n self.assertTrue('name' in self.city.__dict__)", "def test_attribute_types_City(self):\n se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test the inheritance of City from BaseModel
def test_inheritance(self): city3 = City() self.assertIsInstance(city3, BaseModel) self.assertIsInstance(city3, City)
[ "def test_Class_City(self):\n self.assertTrue(issubclass(self.city.__class__, BaseModel), True)", "def test_is_subclass_City(self):\n self.assertTrue(issubclass(self.city.__class__, BaseModel), True)", "def test_is_subclass(self):\n self.assertTrue(issubclass(City, BaseModel))", "def test...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check that fifo matches expected types and perms, catch security hold were it could be replace with another file
def __checkFifo(path): pass # FIXME implement
[ "def test_is_fifo(session):\n assert session.path('index.txt').is_fifo() is False\n assert session.path('non-existent-file').is_fifo() is False", "def vsys_fifo_exists(path):\n if not os.path.exists(path):\n collectd.error('File does not exist: %s' % path)\n return False\n if not stat.S_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all the grid positions that are currently available for scoring. YB is only available after YZ has been scored other than 0 or NB, NT and GT are never available for scoring If 13 positions have been scored in the grid, no further positions can be filled
def available_positions(self): if len([x for x in self.grid.values() if x[0] != None]) < 13: return [x for x in assignable_positions if self.grid[x][1] == "---"] else: return []
[ "def filled_positions(self):\n return [x for x in assignable_positions if self.grid[x][0]]", "def available_positions(board):\r\n positions = []\r\n for i in range(board.board.num_cols()):\r\n for j in range(board.board.num_rows()):\r\n if board.board[i, j] is None:\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all the grid positions that have been filled in.
def filled_positions(self): return [x for x in assignable_positions if self.grid[x][0]]
[ "def empty_neighborhood(self):\n self.neighborhood = self.model.grid.get_neighborhood(self.pos,moore=False, radius=1)\n self.empty_positions = self.neighborhood #[c for c in self.neighborhood if self.model.grid.is_cell_filled(c)]\n\n\n return self.empty_positions", "def board_empty_positions(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns a tuple to a position in the grid, of the form (hand, score of this hand for this position)
def assign(self, hand, position): assert isinstance(hand, h.Hand) # print "POSITION:", position # print self try: assert self.grid[position][1] == "---" except AssertionError: raise FilledInError self.grid[position] = (hand, self.score(hand, positi...
[ "def place(self, x, y, player):\n my_tup = (y, x, player)\n self.x_y_token_triplets.append(my_tup)", "def mark(board, player, row, col): # Bence\n board[row][col] = player\n return board", "def set(self,row,col,value):\r\n self.puzzle[row][col] = value\r\n print(\"Entered valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Aggregate the statistics of a log dict
def aggregate_log_dict(agg_dict, new_dict) -> dict: for k in new_dict: # init new if not present if k not in agg_dict: agg_dict[k] = { 'n': 0, 'sum': 0.0, 'max': new_dict[k], 'min': new_dict[k], } # aggre...
[ "def _aggregate_log_values(self, source, dest):\n remove = []\n for key, item in source.items():\n if \"data\" not in item:\n # Assume it's a sub-group\n dest[key] = {}\n self._aggregate_log_values(item, dest[key])\n else:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ansible module to verify IP reachability using Ping RPC over NETCONF.
def main(): module = AnsibleModule( argument_spec=dict( host=dict(type='str', required=True), destination=dict(type='str', required=True), repeat_count=dict(type='int', default=5), vrf_name=dict(type='str'), min_success_rate=dict(type='int', defaul...
[ "def check_ping_from_cirros(self, vm, ip_to_ping=None):\n ip_to_ping = ip_to_ping or settings.PUBLIC_TEST_IP\n cmd = \"ping -c1 {0}\".format(ip_to_ping)\n res = self.run_on_cirros(vm, cmd)\n error_msg = (\n 'Instance has no connectivity, '\n 'exit code {exit_code},'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store the datapoint in the Database.
def store_datapoint(sql, parts): t = datetime.fromtimestamp(parts[0]) humid = parts[1] temp_c = parts[2] temp_f = parts[3] heat_c = parts[4] heat_f = parts[5] c = sql.cursor() c.execute("INSERT INTO points VALUES (?,?,?,?,?,?)", (t, humid, temp_c, temp_f, heat_c, heat_f)) sql...
[ "def _insert_datapoint(self):\n # Insert\n if db_datapoint.idx_datapoint_exists(1) is False:\n record = Datapoint(\n id_datapoint=general.encode(self.reserved),\n agent_label=general.encode(self.reserved),\n agent_source=general.encode(self.reser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the connection with the Amazon S3 server. Raises an error if conn cannot be established
def get_conn(): global S3Conn S3Conn = tinys3.Connection(plug.options['aws_access_key'], plug.options['aws_secret_key'], default_bucket=plug.options['bucket'], tls=True) # Check that the given bucket exists by doing a HEAD request try: ...
[ "def get_s3_connection(self):\n return connection.S3Connection(\n config.get('nereid_s3', 'access_key'),\n config.get('nereid_s3', 'secret_key')\n )", "def _connect_s3(self):\n s3_conn = boto.connect_s3(aws_access_key_id=self.a_key,\n aws...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the float timestamp based on the date format timestamp stored by Amazon. Prefixes the given filename with Onitu's root.
def get_file_timestamp(filename): plug.logger.debug(u"Getting timestamp of {}", filename) metadata = S3Conn.head_object(u(filename)) timestamp = metadata.headers['last-modified'] # convert timestamp to timestruct... timestamp = time.strptime(timestamp, HEAD_TIMESTAMP_FMT) # ...timestruct to floa...
[ "def timestamp(filename):\n t = re.split('[-.]',filename)[1]\n t = time.strptime(t,\"%Y%m%d%H%M%S\")\n # TODO: How to take care of timezone?\n return time.strftime(\"%Y-%m-%dT%H:%M:%S%z\",t)", "def getTimestamp(filename):\n\ttxt = re.search(r'IMERG.(\\d+)-S\\d+-E(\\d+)',filename)\n\ttimestring = txt....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Caches a multipart upload. Checks that the cache isn't growing past MAX_CACHE_SIZE and that it isn't in the cache yet.
def add_to_cache(multipart_upload): if len(cache) < MAX_CACHE_SIZE: if multipart_upload.uploadId not in cache: cache[multipart_upload.uploadId] = multipart_upload
[ "def remove_from_cache(multipart_upload):\n if multipart_upload.uploadId in cache:\n del cache[multipart_upload.uploadId]", "def cache_alteration_files():\n\n for upload_file in request.files:\n file_name = request.files[upload_file].filename\n if file_name != '':\n session['...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the given MultipartUpload from the cache, if in it.
def remove_from_cache(multipart_upload): if multipart_upload.uploadId in cache: del cache[multipart_upload.uploadId]
[ "def remove_file_from_cache(self, md5_hash):\n self.used_space -= len(self.storage[md5_hash])\n self.storage.pop(md5_hash)\n self.remove_from_usage_queue(md5_hash)", "def add_to_cache(multipart_upload):\n if len(cache) < MAX_CACHE_SIZE:\n if multipart_upload.uploadId not in cache:\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the multipart upload we have the ID of in metadata. As Amazon allows several multipart uploads at the same time for the same file, the ID is the only unique, reliable descriptor.
def get_multipart_upload(metadata): multipart_upload = None metadata_mp_id = None filename = metadata.path if filename.startswith(u"/"): filename = filename[1:] plug.logger.debug(u"Getting multipart upload of {}", filename) # Retrieve the stored multipart upload ID try: metad...
[ "def initiate_multipart_upload(self):\n request = self.s3.create_request(\"OBJECT_POST\", uri = self.uri, headers = self.headers_baseline, extra = \"?uploads\")\n response = self.s3.send_request(request)\n data = response[\"data\"]\n self.upload_id = getTextFromXml(data, \"UploadId\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }