language
stringclasses
2 values
func_code_string
stringlengths
63
466k
java
public void emit(ComponentInfo componentInfo, EmitInfo info) { if (this.sessions.size() == 0) { return; } Date nowTime = new Date(); DateFormat format = new SimpleDateFormat(DATE_PATTERN); String nowTimeStr = format.format(nowTime); Map<String, O...
python
def _ensure_format(rule, attribute, res_dict): """Verifies that attribute in res_dict is properly formatted. Since, in the .ini-files, lists are specified as ':' separated text and UUID values can be plain integers we need to transform any such values into proper format. Empty strings are converted to ...
java
public Observable<ServiceResponse<List<IntentsSuggestionExample>>> getIntentSuggestionsWithServiceResponseAsync(UUID appId, String versionId, UUID intentId, GetIntentSuggestionsOptionalParameter getIntentSuggestionsOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentE...
python
def find_section(self, charindex): """Returns a value indicating whether the specified character index is owned by the current object.""" #All objects instances of decorable also inherit from CodeElement, #so we should have no problem accessing the start and end attributes. resul...
java
public ApiResponse<ApiSuccessResponse> searchContactsWithHttpInfo(LuceneSearchData luceneSearchData) throws ApiException { com.squareup.okhttp.Call call = searchContactsValidateBeforeCall(luceneSearchData, null, null); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); re...
java
public String[] values(String name) { final HttpHeader header = getHeader(name); return header == null ? null : header.values(); }
java
public void mTokens() throws RecognitionException { // InternalXtype.g:1:8: ( T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | RULE_ID | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER ) ...
python
def is_secretly_root(lib): """ Detect an edge case where ROOT Minuit2 is detected as standalone because $ROOTSYS/lib is in LD_LIBRARY_PATH, and suggest appropriate countermeasures. """ from distutils import ccompiler libdir = os.path.dirname(lib) cc = ccompiler.new_compiler() for roo...
java
public static CellStyle cloneCellStyle(Cell cell, CellStyle cellStyle) { return cloneCellStyle(cell.getSheet().getWorkbook(), cellStyle); }
java
public static String getStackTrace(Throwable throwable) { String stackTraceValue = null; if (throwable != null) { StringWriter writer = new StringWriter(); throwable.printStackTrace(new PrintWriter(writer)); stackTraceValue = writer.toString(); } return stackTraceValue; }
java
public void marshall(TagListEntry tagListEntry, ProtocolMarshaller protocolMarshaller) { if (tagListEntry == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tagListEntry.getKey(), KEY_BINDING); ...
python
def write_to_file(self, filename, filetype=None): """Write the relaxation to a file. :param filename: The name of the file to write to. The type can be autodetected from the extension: .dat-s for SDPA, .task for mosek, .csv for human readable format, or...
python
def send(self, task, result, expire=60): """ Sends the result back to the producer. This should be called if only you want to return the result in async manner. :arg task: ::class:`~retask.task.Task` object :arg result: Result data to be send back. Should be in JSON serializable...
python
def subdomains_init(blockstack_opts, working_dir, atlas_state): """ Set up subdomain state Returns a SubdomainIndex object that has been successfully connected to Atlas """ if not is_subdomains_enabled(blockstack_opts): return None subdomain_state = SubdomainIndex(blockstack_opts['subdo...
java
private void determineValueType(Object value){ if (value instanceof Integer){ this.valueEncoder.valueType = INTEGER; this.valueEncoder.valueBytes = ByteBuffer.allocate(4).putInt((Integer)value).array(); } else if (value instanceof Long) { this.valueEncoder.valueType = LONG; this.valueEncoder.valueByte...
python
def _new_sensor_reading(self, sensor_value): """ Call this method to signal a new sensor reading. This method handles DB storage and triggers different events. :param value: New value to be stored in the system. """ if not self._active and not self._enabled: ...
java
Map<String, JSModule> getModulesByName() { Map<String, JSModule> result = new HashMap<>(); for (JSModule m : modules) { result.put(m.getName(), m); } return result; }
java
public ListInvitationsResult withInvitations(Invitation... invitations) { if (this.invitations == null) { setInvitations(new java.util.ArrayList<Invitation>(invitations.length)); } for (Invitation ele : invitations) { this.invitations.add(ele); } return th...
python
def initialize_bitarray(self): """Initialize both bitarray. This BF contain two bit arrays instead of single one like a plain BF. bitarray is the main bit array where all the historical items are stored. It's the one used for the membership query. The second one, current_day_bitarray is...
python
def call_list(self): """For a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.""" vals = [] thing = self while thing is not None: if thing.from_kall: vals.append(thi...
java
public <E> Iterable<E> searchForAll(final Searchable<E> searchable) { try { return searchForAll(configureMatcher(searchable).asList()); } finally { MatcherHolder.unset(); } }
python
def get_real_time_locate(host_ipaddress, auth, url): """ function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a...
java
@Pure public static double distanceSquaredSegmentPoint( double sx1, double sy1, double sz1, double sx2, double sy2, double sz2, double px, double py, double pz) { double ratio = getPointProjectionFactorOnSegmentLine(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2); if (ratio <= 0.) return FunctionalPoint3D.dist...
java
public static boolean isColumnNullable (Connection conn, String table, String column) throws SQLException { ResultSet rs = getColumnMetaData(conn, table, column); try { return rs.getString("IS_NULLABLE").equals("YES"); } finally...
python
def nb_to_html(nb_path): """convert notebook to html""" exporter = html.HTMLExporter(template_file='full') output, resources = exporter.from_filename(nb_path) header = output.split('<head>', 1)[1].split('</head>',1)[0] body = output.split('<body>', 1)[1].split('</body>',1)[0] # http://imgur.com...
python
def pow2_quantize(x, sign=True, with_zero=True, n=8, m=1, quantize=True, ste_fine_grained=True, outputs=None): r"""Pow2 Quantize Args: x (Variable): An input variable. sign (bool): Indicate the signed number or the unsigned number. Default is true. with_zero (bool): Indicate using zero ...
python
def value(self): """ Returns the current value (adjusted for the time decay) :rtype: float """ with self.lock: now = time.time() dt = now - self.t0 self.t0 = now self.p = self.p * (math.pow(self.e, self.r * dt)) return ...
python
def _wikipedia_known_port_ranges(): """ Returns used port ranges according to Wikipedia page. This page contains unofficial well-known ports. """ req = urllib2.Request(WIKIPEDIA_PAGE, headers={'User-Agent' : "Magic Browser"}) page = urllib2.urlopen(req).read().decode('utf8') # just find all...
python
def configure(self, options, config): """Configures the xunit plugin.""" Plugin.configure(self, options, config) self.config = config if self.enabled: self.jinja = Environment( loader=FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')), ...
python
def parse(self): """Check input and return a :class:`Migration` instance.""" if not self.parsed.get('migration'): raise ParseError(u"'migration' key is missing", YAML_EXAMPLE) self.check_dict_expected_keys( {'options', 'versions'}, self.parsed['migration'], 'migration', ...
python
def cmd_notice(self, connection, sender, target, payload): """ Sends a message """ msg_target, topic, content = self.parse_payload(payload) def callback(sender, payload): logging.info("NOTICE ACK from %s: %s", sender, payload) self.__herald.notice(msg_target...
python
def update_object(self, ref, payload, return_fields=None): """Update an Infoblox object Args: ref (str): Infoblox object reference payload (dict): Payload with data to send Returns: The object reference of the updated object Raises: I...
java
private static ReloadableType getReloadableTypeIfHasBeenReloaded(Class<?> clazz) { if (TypeRegistry.nothingReloaded) { return null; } ReloadableType rtype = getRType(clazz); if (rtype != null && rtype.hasBeenReloaded()) { return rtype; } else { return null; } }
python
def add_to_postmortem_exclusion_list(cls, pathname, bits = None): """ Adds the given filename to the exclusion list for postmortem debugging. @warning: This method requires administrative rights. @see: L{get_postmortem_exclusion_list} @type pathname: str @param pathna...
python
def recipients(messenger, addresses): """Structures recipients data. :param str|unicode, MessageBase messenger: MessengerBase heir :param list[str|unicode]|str|unicode addresses: recipients addresses or Django User model heir instances (NOTE: if supported by a messenger) :return: list of Recip...
java
public int compareTo(LogPosition o) { final int val = fileName.compareTo(o.fileName); if (val == 0) { return (int) (position - o.position); } return val; }
python
def fromInputs(self, inputs): """ Extract the inputs associated with the child forms of this parameter from the given dictionary and coerce them using C{self.coercer}. @type inputs: C{dict} mapping C{unicode} to C{list} of C{unicode} @param inputs: The contents of a form post, i...
java
public void load(final Runnable afterLoad) { CmsRpcAction<CmsAliasInitialFetchResult> action = new CmsRpcAction<CmsAliasInitialFetchResult>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() ...
java
@Override public void startService() { Utils.require(OLAPService.instance().getState().isInitialized(), "OLAPMonoService requires the OLAPService"); OLAPService.instance().waitForFullService(); }
java
public void occurs(int minOccurs, int maxOccurs) throws SAXException{ if(minOccurs!= 1) xml.addAttribute("minOccurs", String.valueOf(minOccurs)); if(maxOccurs!=1) xml.addAttribute("maxOccurs", maxOccurs==-1 ? "unbounded" : String.valueOf(maxOccurs)); }
python
def get_index_html (urls): """ Construct artificial index.html from given URLs. @param urls: URL strings @type urls: iterator of string """ lines = ["<html>", "<body>"] for entry in urls: name = cgi.escape(entry) try: url = cgi.escape(urllib.quote(entry)) ...
python
def catch_timeout(f): """ A decorator to handle read timeouts from Twitter. """ def new_f(self, *args, **kwargs): try: return f(self, *args, **kwargs) except (requests.exceptions.ReadTimeout, requests.packages.urllib3.exceptions.ReadTimeoutError) as e: ...
java
public static CommerceTaxMethod fetchByGroupId_Last(long groupId, OrderByComparator<CommerceTaxMethod> orderByComparator) { return getPersistence().fetchByGroupId_Last(groupId, orderByComparator); }
python
def offline(path): ''' Mark a cache storage device as offline. The storage is identified by a path which must match exactly a path specified in storage.config. This removes the storage from the cache and redirects requests that would have used this storage to other storage. This has exactly the same...
python
def _from_safe_path_param_name(safe_parameter): """Takes a safe regex group name and converts it back to the original value. Only alphanumeric characters and underscore are allowed in variable name tokens, and numeric are not allowed as the first character. The safe_parameter is a base32 representatio...
java
@Override public void shutdown() { LOG.info("Shutting down ..."); shouldShutdown = true; if (tserver != null) { tserver.stop(); } started = false; }
python
def alarm_set(self, time, wake_with_radio=False): """ set the alarm clock :param str time: time of the alarm (format: %H:%M:%S) :param bool wake_with_radio: if True, radio will be used for the alarm instead of beep sound """ # TODO: c...
java
public List<CmsResource> getTopMovedFolders(CmsObject cms) throws CmsException { List<CmsResource> movedFolders = getMovedFolders(cms); List<CmsResource> result = getTopFolders(movedFolders); return result; }
java
@Override public IndentedPrintWriter printf(String format, Object... args) { super.format(format, args); return this; }
python
def sg_summary_audio(tensor, sample_rate=16000, prefix=None, name=None): r"""Register `tensor` to summary report as audio Args: tensor: A `Tensor` to log as audio sample_rate : An int. Sample rate to report. Default is 16000. prefix: A `string`. A prefix to display in the tensor board web UI....
java
public void setYUnits(Integer newYUnits) { Integer oldYUnits = yUnits; yUnits = newYUnits; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.IID__YUNITS, oldYUnits, yUnits)); }
java
@XmlElementDecl(namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/", name = "removeACEs", scope = CheckIn.class) public JAXBElement<CmisAccessControlListType> createCheckInRemoveACEs( CmisAccessControlListType value) { return new JAXBElement<CmisAccessControlListType>( _CreateDocumentRemove...
python
def _stop_trial(self, trial, error=False, error_msg=None, stop_logger=True): """Stops this trial. Stops this trial, releasing all allocating resources. If stopping the trial fails, the run will be marked as terminated in error, but no exception will be thrown. ...
python
def powernode_data(self, name:str) -> Powernode: """Return a Powernode object describing the given powernode""" self.assert_powernode(name) contained_nodes = frozenset(self.nodes_in(name)) return Powernode( size=len(contained_nodes), contained=frozenset(self.all_i...
java
public static BoundGoro bindWith(final Context context, final BoundGoro.OnUnexpectedDisconnection handler) { if (context == null) { throw new IllegalArgumentException("Context cannot be null"); } if (handler == null) { throw new IllegalArgumentException("Disconnection handler cannot be null"); ...
python
def _get_logging_id(self): """Get logging identifier.""" return "{}.{}/{}".format( self._request.viewset_class.__module__, self._request.viewset_class.__name__, self._request.viewset_method, )
python
def _process_keystroke_commands(self, inp): """Process keystrokes that issue commands (side effects).""" if inp in (u'1', u'2'): # chose 1 or 2-character wide if int(inp) != self.screen.wide: self.screen.wide = int(inp) self.on_resize(None, None) ...
java
public StringParam setContains(boolean theContains) { myContains = theContains; if (myContains) { setExact(false); setMissing(null); } return this; }
java
@Override public List<IScan> getScansByRtLower(double rt) { Map.Entry<Double, List<IScan>> lowerEntry = getRt2scan().lowerEntry(rt); if (lowerEntry == null) { return null; } List<IScan> scans = lowerEntry.getValue(); if (scans != null) { return scans; } return null; }
java
private int calcLastPageSkip(int total, int skip, int limit) { if (skip > total - limit) { return skip; } if (total % limit > 0) { return total - total % limit; } return total - limit; }
java
private <T> T executeHttpCallWithRetry(HttpCall<T> call, int runCount) { try { return call.execute(); } catch (PackageManagerHttpActionException ex) { // retry again if configured so... if (runCount < props.getRetryCount()) { log.info("ERROR: " + ex.getMessage()); log.debug...
java
public static List<String> findParamsInQuery(String query, boolean changeToLower) { List<String> result = new ArrayList<>(); Matcher matcher = PARAM_PATTERN.matcher(query); while (matcher.find()) { if (matcher.group("PARAM") != null) { String param; if (changeToLower) { param = matcher.group("PA...
python
def sys_pipes_forever(encoding=_default_encoding): """Redirect all C output to sys.stdout/err This is not a context manager; it turns on C-forwarding permanently. """ global _mighty_wurlitzer if _mighty_wurlitzer is None: _mighty_wurlitzer = sys_pipes(encoding) _mighty_wurlitzer.__e...
java
public JFeatureSpec<T> cross(final String x1, final String x2, final BiFunction<Double, Double, Double> f) { Function2<Object, Object, Object> g = JavaOps.crossFn(f); return wrap(self.cross(Tuple2.apply(x1, x2), g)); }
python
def _add_cpu_percent(self, cur_read): """Compute cpu percent basing on the provided utilisation """ for executor_id, cur_data in cur_read.items(): stats = cur_data['statistics'] cpus_limit = stats.get('cpus_limit') cpus_utilisation = stats.get('cpus_utilisatio...
java
public void scanConfigurableBeans(String... basePackages) throws BeanRuleException { if (basePackages == null || basePackages.length == 0) { return; } log.info("Auto component scanning on packages [" + StringUtils.joinCommaDelimitedList(basePackages) + "]"); for (String bas...
python
def buy_open(id_or_ins, amount, price=None, style=None): """ 买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
java
public boolean remove (ObjectInfo info) { int opos = indexOf(info); if (opos >= 0) { remove(opos); return true; } else { return false; } }
java
public static int expectHCOLON(final Buffer buffer) throws SipParseException { final int consumed = expectHCOLONStreamFriendly(buffer); if (consumed == -1) { // -1 means we ran out of bytes in the stream but in those // cases where we are not really dealing with a stream we ...
python
def generate_json_docs(module, pretty_print=False, user=None): """Return a JSON string format of a Pale module's documentation. This string can either be printed out, written to a file, or piped to some other tool. This method is a shorthand for calling `generate_doc_dict` and passing it into a js...
python
def export(self, class_name, method_name, export_data=False, export_dir='.', export_filename='data.json', export_append_checksum=False, **kwargs): """ Port a trained estimator to the syntax of a chosen programming language. Parameters ---------- :pa...
java
public static @CheckForNull BugCollectionAndInstance findBugCollectionAndInstanceForMarker(IMarker marker) { IResource resource = marker.getResource(); IProject project = resource.getProject(); if (project == null) { // Also shouldn't happen. FindbugsPlugin.getDefaul...
java
public Stream<YearQuarter> quartersUntil(YearQuarter endExclusive) { if (endExclusive.isBefore(this)) { throw new IllegalArgumentException(endExclusive + " < " + this); } long intervalLength = until(endExclusive, QUARTER_YEARS); return LongStream.range(0,intervalLength).mapTo...
python
def _make_from_epo(cls, trg_comp, qr_comp, trg_chrom_sizes, qr_chrom_sizes): """crate a chain of collinear rings from the given components. The target of the chain will always be on the forward strand. This is done to avoid confusion when mapping psl files. So, if trg_comp.strand=-, qr...
python
def min(self): """ Return the minimum element (or element-based computation). """ if(self._clean.isDict()): return self._wrap(list()) return self._wrap(min(self.obj))
python
def asarray_ndim(a, *ndims, **kwargs): """Ensure numpy array. Parameters ---------- a : array_like *ndims : int, optional Allowed values for number of dimensions. **kwargs Passed through to :func:`numpy.array`. Returns ------- a : numpy.ndarray """ allow_no...
java
private void acceptNewState( double fx_candidate ) { DMatrixRMaj tmp = x; x = x_next; x_next = tmp; fx = fx_candidate; mode = Mode.COMPUTE_DERIVATIVES; }
python
def _crop_data(self): """ Crop the ``data`` and ``mask`` to have an integer number of background meshes of size ``box_size`` in both dimensions. The data are cropped on the top and/or right edges (this is the best option for the "zoom" interpolator). Returns ---...
java
public static Object shiftSignedRight(Object arg1, Object arg2) throws NoSuchMethodException { int code1 = typeCode(arg1); int code2 = typeCode(arg2); if (code1 <= INT) { int val1 = unboxCharOrInt(arg1, code1); if (code2 <= INT) { int val2 = unboxCharOrInt...
python
def unique(self, *args): """ Returns all unique values as a DataFrame. This is executing: SELECT DISTINCT <name_of_the_column_1> , <name_of_the_column_2> , <name_of_the_column_3> ... F...
python
def get_headerReference(self, type_): """Return headerReference element of *type_* or None if not present.""" matching_headerReferences = self.xpath( "./w:headerReference[@w:type='%s']" % WD_HEADER_FOOTER.to_xml(type_) ) if len(matching_headerReferences) == 0: ret...
python
def _load_neighbors(self) -> None: """ Loads all neighbors of the node from the local database and from the external data source if needed. """ if not self.are_neighbors_cached: self._load_neighbors_from_external_source() db: GraphDatabaseInterface ...
java
public @Nullable Scriptable jsFunction_firstHeader(String name) { Header h = req.getFirstHeader(name); return h == null ? null : makeJsHeader(Context.getCurrentContext(), h); }
java
public void removeNode(N node) { Pair<HashSet<N>, HashSet<N>> p = nodes.remove(node); if(p == null) return; //Outgoing edges we can ignore removint he node drops them. We need to avoid dangling incoming edges to this node we have removed HashSet<N> incomingNodes = p.getIn...
java
private static <M extends Model> URL convertFxmlUrl(final M model, final String fxmlPath) { URL fxmlUrl = null; // Replace all '.' separator by path separator '/' if (model != null) { // Try to load the resource from the same path as the model class fxmlUrl = model.g...
java
private int[] findText(String str, String key, PluralFormat pluralFormatKey, int startingAt) { RbnfLenientScanner scanner = formatter.getLenientScanner(); if (pluralFormatKey != null) { FieldPosition position = new FieldPosition(NumberFormat.INTEGER_FIELD); position.setBeginIndex...
java
protected List<String> getNameCache(Class cls, String pkgname) { return m_CacheNames.get(cls.getName() + "-" + pkgname); }
python
def destroy_work_item(self, id, project=None): """DestroyWorkItem. Destroys the specified work item permanently from the Recycle Bin. This action can not be undone. :param int id: ID of the work item to be destroyed permanently :param str project: Project ID or project name """ ...
python
def member_status(): ''' Get cluster member status .. versionchanged:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' riak.member_status ''' ret = {'membership': {}, 'summary': {'Valid': 0, 'Leaving': 0, 'Exiting': 0, ...
java
private Vector2i getCellOf(Point3D coordinate) { int xCell = (int) ((coordinate.x - indexRegion.minX()) / x_size); int yCell = (int) ((coordinate.y - indexRegion.minY()) / y_size); return new Vector2i(xCell, yCell); }
python
def get_estimates_without_scope_in_month(self, customer): """ It is expected that valid row for each month contains at least one price estimate for customer, service setting, service, service project link, project and resource. Otherwise all price estimates in the row should be d...
java
@Override public void run() { try { InjectionHandler.processEvent(InjectionEvent.DIRECTORY_SCANNER_NOT_STARTED); if (!shouldRun) { //shutdown has been activated LOG.warn("this cycle terminating immediately because 'shouldRun' has been deactivated"); return; } Integ...
java
public static String expiresAtAsRFC1123(long expiresAt) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(expiresAt); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.UK); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); String r...
python
def _free_sequence(tmp1, tmp2=False): ''' Outputs a FREEMEM sequence for 1 or 2 ops ''' if not tmp1 and not tmp2: return [] output = [] if tmp1 and tmp2: output.append('pop de') output.append('ex (sp), hl') output.append('push de') output.append('call __MEM_F...
java
public void add(final WComponent component, final Serializable... constraints) { add(component); if (constraints != null && constraints.length > 0) { PanelModel model = getOrCreateComponentModel(); if (model.layoutConstraints == null) { model.layoutConstraints = new HashMap<>(); } model.layoutCon...
python
def fit( self, durations, event_observed=None, timeline=None, entry=None, label="KM_estimate", left_censorship=False, alpha=None, ci_labels=None, weights=None, ): # pylint: disable=too-many-arguments,too-many-locals """ ...
java
public Map<String, Map<String, Map<String, Map<String, ?>>>> addValidationConstraint(String type, String field, Constraint c) { if (StringUtils.isBlank(type) || StringUtils.isBlank(field) || c == null) { return Collections.emptyMap(); } return getEntity(invokePut(Utils.formatMessage("_constraints/{0}/{1}/{2...
java
public Boolean isInputFormat(ProvFormat format) { ProvFormatType t = provTypeMap.get(format); return (t.equals(ProvFormatType.INPUT) || t.equals(ProvFormatType.INPUTOUTPUT)); }
python
async def rename_mailbox(self, before_name: str, after_name: str, selected: SelectedMailbox = None) \ -> Optional[SelectedMailbox]: """Renames the mailbox owned by the user. See Also: `RFC 3501 6.3.5. <https://tools.ietf.org/html/rfc3501#...
python
def _get_foundation(self, i): """Return a :class:`Foundation` for some deck, creating it if needed. """ if i >= len(self._foundations) or self._foundations[i] is None: oldfound = list(self._foundations) extend = i - len(oldfound) + 1 if extend > 0: ...