language
stringclasses
2 values
func_code_string
stringlengths
63
466k
python
def get_available_languages(self, obj): """ Returns available languages for current object. """ return obj.available_languages if obj is not None else self.model.objects.none()
python
def from_jwe(self, msg, keys): """ Decrypt an encrypted JWT and load the JSON object that was the body of the JWT into this object. :param msg: An encrypted JWT :param keys: Possibly usable keys. :type keys: list or KeyJar instance :return: The decrypted message....
python
def _show_list_message(resolved_config): """ Show the message for when a user has passed in --list. """ # Show what's available. supported_programs = util.get_list_of_all_supported_commands( resolved_config ) msg_line_1 = 'Legend: ' msg_line_2 = ( ' ' + util.FL...
java
private static ValueMap getPagePropertiesNullSafe(Page page) { if (page != null) { return page.getProperties(); } else { return ValueMap.EMPTY; } }
java
@Override public TableCellEditor getCellEditor(int row, int column) { if (column == 0) { return null; } Item item = getSheetModel().getPropertySheetElement(row); if (!item.isProperty()) { return null; } TableCellEditor result = nul...
java
private static SecretKey cek(byte[] cekSecured, String keyWrapAlgo, EncryptionMaterials materials, Provider securityProvider, ContentCryptoScheme contentCryptoScheme, AWSKMS kms) { if (isKMSKeyWrapped(keyWrapAlgo)) return cekByKMS(cek...
python
def connect_host(self, host, volume, **kwargs): """Create a connection between a host and a volume. :param host: Name of host to connect to volume. :type host: str :param volume: Name of volume to connect to host. :type volume: str :param \*\*kwargs: See the REST API Gui...
python
def _prepare_translations(self): """Load in translations if they are set, and add the default locale as well. """ if config.TRANSLATIONS in self.paths: LOGGER.info('Loading translations from %s', self.paths[config.TRANSLATIONS]) from torna...
python
def read_calib_file(filepath): """Read in a calibration file and parse into a dictionary.""" data = {} with open(filepath, 'r') as f: for line in f.readlines(): key, value = line.split(':', 1) # The only non-float values in these files are dates, which # we don't...
java
protected static String replaceStaticString(String key) { String replacementString = ""; try { InetAddress addr = InetAddress.getLocalHost(); String lkey = key.toLowerCase(); if(lkey.equals("localhost")) { replacementString = addr.getHostName(); } else if(lkey.equals("ip")...
java
protected void init(Map<String, String> pConfig) { Map<String, String> finalCfg = getDefaultConfig(pConfig); finalCfg.putAll(pConfig); prepareDetectorOptions(finalCfg); addJolokiaId(finalCfg); jolokiaConfig = new Configuration(); jolokiaConfig.updateGlobalConfiguration(...
java
public static long hash(byte[] digest, int index) { long f = ((long) (digest[3 + index * 4] & 0xFF) << 24) | ((long) (digest[2 + index * 4] & 0xFF) << 16) | ((long) (digest[1 + index * 4] & 0xFF) << 8) | (digest[index * 4] & 0xFF); return f & 0xFFFFFFFFL; }
python
def _build_generator_list(network): """Builds DataFrames with all generators in MV and LV grids Returns ------- :pandas:`pandas.DataFrame<dataframe>` A DataFrame with id of and reference to MV generators :pandas:`pandas.DataFrame<dataframe>` A DataFrame with id of and refere...
python
def without(self, *keys): """ Get all items except for those with the specified keys. :param keys: The keys to remove :type keys: tuple :rtype: Collection """ items = copy(self.items) keys = reversed(sorted(keys)) for key in keys: d...
python
def all_leaves(self, graph=None): """ Return a list of all leaves (nodes with no downstreams) """ if graph is None: graph = self.graph return [key for key in graph if not graph[key]]
java
@Override public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException { try { TGetOperationStatusReq req = new TGetOperationStatusReq(opHandle.toTOperationHandle()); TGetOperationStatusResp resp = cliService.GetOperationStatus(req); // Checks the status of the RPC...
python
def replacePatterns(self, vector, layer = None): """ Replaces patterned inputs or targets with activation vectors. """ if not self.patterned: return vector if type(vector) == str: return self.replacePatterns(self.lookupPattern(vector, layer), layer) elif type(...
java
public static <T> List<T> removeTypes(final List<T> list, final List<Class<? extends T>> filter) { final Iterator it = list.iterator(); while (it.hasNext()) { final Class type = it.next().getClass(); if (filter.contains(type)) { it.remove(); } ...
java
public Email getEmail(CmsObject cms, I_CmsNewsletterRecipient recipient) throws CmsException { StringBuffer htmlMsg = new StringBuffer(1024); StringBuffer txtMsg = new StringBuffer(1024); Iterator<I_CmsNewsletterContent> contents = m_contents.iterator(); while (contents.hasNext()) { ...
python
def read_temperature(self): """Gets the compensated temperature in degrees celsius.""" UT = self.read_raw_temp() # Datasheet value for debugging: #UT = 27898 # Calculations below are taken straight from section 3.5 of the datasheet. X1 = ((UT - self.cal_AC6) * self.cal_AC...
java
private void forwardElimination(double scales[]) throws MatrixException { // Loop once per pivot row 0..nRows-1. for (int rPivot = 0; rPivot < nRows - 1; ++rPivot) { double largestScaledElmt = 0; int rLargest = 0; // Starting from the pivot row...
java
protected Label buildTitleLabel() { // create default title - even shown when no data is available title = new LabelBuilder().name(titleText).buildCaptionLabel(); title.setImmediate(true); title.setContentMode(ContentMode.HTML); return title; }
java
@Override public DescribeInstancePatchStatesForPatchGroupResult describeInstancePatchStatesForPatchGroup(DescribeInstancePatchStatesForPatchGroupRequest request) { request = beforeClientExecution(request); return executeDescribeInstancePatchStatesForPatchGroup(request); }
python
def is_permitted_collective(self, identifiers, permission_s, logical_operator): """ :type identifiers: SimpleIdentifierCollection :param permission_s: a collection of 1..N permissions :type permission_s: List of Permission object(s) or String(s) :param logical_operator: indica...
java
public String buildSelectCopyFileMode(String htmlAttributes) { List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_PREF_COPY_AS_SIBLING_0)); options.add(key(Messages.GUI_COPY_AS_NEW_0)); List<String> values = new ArrayList<String>(2); values.add(CmsReso...
java
@GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{gavc}") public Response get(@PathParam("gavc") final String gavc){ if(LOG.isInfoEnabled()) { LOG.info(String.format("Got a get artifact request [%s]", gavc)); } final ArtifactView view = new Artif...
python
def std_byte(self): """Copy byte from 8-bit representation.""" try: return self.std_name[self.pos] except IndexError: self.failed = 1 return ord('?')
java
private Variable[] getLocallyDeclaredVariables() { Collection<Variable> vars = mDeclared.values(); return vars.toArray(new Variable[vars.size()]); }
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); unendedZLIBs.clear(); super.visitCode(obj); for (SourceLineAnnotation sa : unendedZLIBs.values()) { bugReporter.reportBug(new BugInstance(this, BugType.IOI_UNENDED_ZLIB_OBJECT.name(), NORMAL_PR...
java
public GridBagLayoutBuilder append(Component component, int colSpan, int rowSpan, boolean expandX, boolean expandY) { return append(component, colSpan, rowSpan, expandX, expandY, defaultInsets); }
java
public SqlBuilder insert(Entity entity, DialectName dialectName) { // 验证 validateEntity(entity); if (null != wrapper) { // 包装表名 // entity = wrapper.wrap(entity); entity.setTableName(wrapper.wrap(entity.getTableName())); } final boolean isOracle = ObjectUtil.equal(dialectName, DialectName....
python
def save(self, file, *attributes, **options): """ Saves the selected field *attributes* for each :class:`Field` *nested* in the `Container` to an ``.ini`` *file*. :param str file: name and location of the ``.ini`` *file*. :param str attributes: selected :class:`Field` attributes. ...
python
def query_items(self, jid, *, node=None, require_fresh=False, timeout=None): """ Query the items of the specified entity. :param jid: The entity to query. :type jid: :class:`aioxmpp.JID` :param node: The node to query. :type node: :class:`str` or :dat...
java
boolean isAssignableKey(Method getter) { synchronized (autoGeneratedKeyGetterCache) { if ( !autoGeneratedKeyGetterCache.containsKey(getter) ) { autoGeneratedKeyGetterCache.put( getter, ReflectionUtils.getterOrFieldHasAnnotation(getter, ...
python
def setupimgh5(f: Union[Path, h5py.File], Nframetotal: int, Nrow: int, Ncol: int, dtype=np.uint16, writemode='r+', key='/rawimg', cmdlog: str=None): """ f: HDF5 handle (or filename) h: HDF5 dataset handle """ if isinstance(f, (str, Path)): # assume new HDF5 file wante...
python
def serialize(exc): """ Serialize `self.exc` into a data dictionary representing it. """ return { 'exc_type': type(exc).__name__, 'exc_path': get_module_path(type(exc)), 'exc_args': list(map(safe_for_serialization, exc.args)), 'value': safe_for_serialization(exc), }
python
async def sinter(self, keys, *args): """ Return the intersection of sets specified by ``keys`` Cluster impl: Querry all keys, intersection and return result """ k = list_or_args(keys, args) res = await self.smembers(k[0]) for arg in k[1:]: ...
java
public static Hours hoursIn(ReadableInterval interval) { if (interval == null) { return Hours.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.hours()); return Hours.hours(amount); }
python
def extract(self, topic: str, parseNumbers=True) -> list: """ Extract items of given topic and return as list of objects. The topic is a string like TradeConfirm, ChangeInDividendAccrual, Order, etc. """ cls = type(topic, (DynamicObject,), {}) results = [cls(**no...
java
@SuppressWarnings("unchecked") private void addPrivateFieldsAccessors(ClassNode node) { Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS); if (accessedFields==null) return; Map<String, MethodNode> privateConstantAccessors = (Map<String, Met...
python
def connect(self, path="", headers=None, query=None, timeout=0, **kwargs): """ make the actual connection to the websocket :param headers: dict, key/val pairs of any headers to add to connection, if you would like to override headers just pass in an empty value :param query:...
python
def eval(self, code, *args): """**DEPRECATED**: Evaluate a JavaScript expression in MongoDB. :Parameters: - `code`: string representation of JavaScript code to be evaluated - `args` (optional): additional positional arguments are passed to the `code` being ev...
java
public ServiceFuture<SummarizeResultsInner> summarizeForPolicyDefinitionAsync(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions, final ServiceCallback<SummarizeResultsInner> serviceCallback) { return ServiceFuture.fromResponse(summarizeForPolicyDefinitionWithServiceResponseAsync(subs...
java
@Override public InputStream getInputStream() throws IOException { try { InputStream result = entry.adapt(InputStream.class); if (result == null) { throw new IOException("The entry did not supply an input stream: " + entry); } return result; ...
java
@Override public InputStream downloadToStream(SFSession connection, String command, int parallelism, String remoteStorageLocation, String stageFilePath, String stageRegion) throws SnowflakeSQLException { int retryCount = 0; do {...
python
def _set_community(self, v, load=False): """ Setter method for community, mapped from YANG variable /routing_system/route_map/content/set/community (container) If this variable is read-only (config: false) in the source YANG file, then _set_community is considered as a private method. Backends looki...
java
private static double getLength(BoundingBox boundingBox) { double width = boundingBox.getMaxLongitude() - boundingBox.getMinLongitude(); double height = boundingBox.getMaxLatitude() - boundingBox.getMinLatitude(); double length = Math.min(width, height); return length; }
java
public GetMediaInfoOfFileResponse getMediaInfoOfFile(String bucket, String key) { GetMediaInfoOfFileRequest request = new GetMediaInfoOfFileRequest(); request.setBucket(bucket); request.setKey(key); return getMediaInfoOfFile(request); }
java
void setup(final ExecutableFlow flow) throws ExecutorManagerException { final ProjectFileHandler projectFileHandler = null; File tempDir = null; try { final ProjectDirectoryMetadata project = new ProjectDirectoryMetadata( flow.getProjectId(), flow.getVersion()); final long f...
java
private static ReflectionException handleException(String methodName, InvocationTargetException e) { LOGGER.error("Couldn't invoke method " + methodName, e); return new ReflectionException(e); }
python
def once(self, message, *args, **kws): """Show a message only once, determined by position in source or identifer. This will not work in IPython or Jupyter notebooks if no identifier is specified, since then the determined position in source contains the execution number of the input (cell), which chan...
python
def _genBgTerm_fromSNPs(self,vTot=0.5,vCommon=0.1,pCausal=0.5,plot=False): """ generate """ if self.X is None: print('Reading in all SNPs. This is slow.') rv = plink_reader.readBED(self.bfile,useMAFencoding=True) X = rv['snps'] else: X = self.X...
python
def discount_bootstrap(rewards_buffer, dones_buffer, final_values, discount_factor, number_of_steps): """ Calculate state values bootstrapping off the following state values """ true_value_buffer = torch.zeros_like(rewards_buffer) # discount/bootstrap off value fn current_value = final_values for ...
python
def get_url_feed(self, package=None, timeout=None): """ Get a live file feed with the latest files submitted to VirusTotal. Allows you to retrieve a live feed of reports on absolutely all URLs scanned by VirusTotal. This API requires you to stay relatively synced with the live submissions as on...
python
def get_for_targets(self, targets): """Gets the classpath products for the given targets. Products are returned in order, respecting target excludes. :param targets: The targets to lookup classpath products for. :returns: The ordered (conf, path) tuples, with paths being either classfile directories o...
python
def flushOutBoxes(self) -> None: """ Clear the outBoxes and transmit batched messages to remotes. """ removedRemotes = [] for rid, msgs in self.outBoxes.items(): try: dest = self.remotes[rid].name except KeyError: removedRem...
java
public static double sabrHaganLognormalBlackVolatilityApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double strike, double maturity) { if(alpha <= 0) { throw new IllegalArgumentException("&alpha; must be greater than 0."); } if(rho > 1 || rho < -1) { ...
java
@Override public SExpIR caseABooleanConstExp(ABooleanConstExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); boolean value = node.getValue().getValue(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ABoolLiteralExpIR boolLitCg = new ABoolLiteralExpIR();...
python
def delete(self): """ delete the jenkins job, if it exists """ if self.jenkins_host.has_job(self.name): LOGGER.info("deleting {0}...".format(self.name)) self.jenkins_host.delete_job(self.name)
java
private FieldPosition[] getNegativeSuffixFieldPositions() { if (negativeSuffixFieldPositions == null) { if (negSuffixPattern != null) { negativeSuffixFieldPositions = expandAffix(negSuffixPattern); } else { negativeSuffixFieldPositions = EmptyFieldPosition...
python
def set_cell(self, i, j, value): """Set a cell's value, with a series of safety checks :param i: The row number :type i: int :param j: The column number :type j: int :param value: The value to set :type value: int :raises: :py:class:`dlxsudoku.exceptions....
java
public boolean compareAndSet(int i, int expect, int update) { while (true) { try { updateLock.lock(); try { return store.get().compareAndSet(i, expect, update); } finally { updateLock.unlock(); } ...
python
def align_two_alignments(aln1_fp, aln2_fp, moltype, params=None): """Returns an Alignment object from two existing Alignments. Parameters ---------- aln1_fp : string file path of 1st alignment aln2_fp : string file path of 2nd alignment params : dict of parameters to pass in to ...
java
public Binder insert(int index, Class<?>[] types, Object... values) { return new Binder(this, new Insert(index, types, values)); }
java
public synchronized Map<String, MLArray> read(InputStream stream, MatFileFilter filter) throws IOException { this.filter = filter; data.clear(); ByteBuffer buf = null; final ByteArrayOutputStream2 baos = new ByteArrayOutputStream2(); copy(stream, baos); buf = ByteB...
java
Triangle nextNeighbor(Vector3 p, Triangle prevTriangle) { Triangle neighbor = null; if (a.equals(p)) { neighbor = canext; } if (b.equals(p)) { neighbor = abnext; } if (c.equals(p)) { neighbor = bcnext; } if(prevTriangle == null) { return neighbor; } // Udi Schneider: Added a condit...
python
def initialized(name, **kwargs): r''' Defines a new VM with specified arguments, but does not start it. :param name: the Salt_id node name you wish your VM to have. Each machine must be initialized individually using this function or the "vagrant.running" function, or the vagrant.init execution mo...
java
public static CharStream zip(final char[] a, final char[] b, final CharBiFunction<Character> zipFunction) { return Stream.zip(a, b, zipFunction).mapToChar(ToCharFunction.UNBOX); }
java
public static String makeShellPath(File file, boolean makeCanonicalPath) throws IOException { if (makeCanonicalPath) { return makeShellPath(file.getCanonicalPath()); } else { return makeShellPath(file.toString()); } }
python
def _add_study(self,study): """ Adds a study to QuantFigure.studies Parameters: study : dict {'kind':study_kind, 'params':study_parameters, 'display':display_parameters} """ str='{study} {name}({period})' if study['params'].get('str',None)==None else study['params']['str'] study['params'][...
java
public Object invokeGetterMethodOnTarget( String javaPropertyName, Object target ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { String[] methodNamesArray = findMethodNa...
java
public static String getResourceLocation(String resourceId) { Resource resource = getResource(resourceId); return resource.getDataLocation(); }
python
def from_mapping(self, *mapping, **kwargs): """Updates the config like :meth:`update` ignoring items with non-upper keys. """ mappings = [] if len(mapping) == 1: if hasattr(mapping[0], 'items'): mappings.append(mapping[0].items()) e...
java
public static void insertValue(HashMap m, String var, String val, String path, boolean eventAppendMode) { if (m == null || var == null) { return; } if (path == null) { var = AcePathfinder.INSTANCE.getAlias(var); path = AcePathfinder.INSTANCE.getPath(var); } if (pa...
python
def run(self, repo: str, branch: str, task: Task, git_repo: Repo, repo_path: Path): """ Starts up a VM, builds an docker image and gets it to the VM, runs the script over SSH, returns result. Stops the VM if ``keep_vm_running`` is not set. """ from fabric import api from fabr...
java
@Override public boolean write(T record) throws IOException { // check whether we need a new memory segment for the sort index if (this.currentSortBufferOffset > this.lastEntryOffset) { if (memoryAvailable()) { this.currentSortBufferSegment = nextMemorySegment(); this.sortBuffer.add(this.currentSortBuff...
java
private PagedLater<T> createRequest(String pagedUrl) { // Parse the url to create a new GraphRequest<Paged<T>>. URLParser parser = new URLParser(pagedUrl); // Need to remove the access token, that gets added back later and isn't // relevant for grouping. parser.getParams().remove("access_token"); ret...
java
public static float[] makeNormalCoordSys(float[] normals, int offset) { float[] m = new float[9]; m[6] = normals[offset]; m[7] = normals[offset + 1]; m[8] = normals[offset + 2]; // Calculate a vector that is guaranteed to be orthogonal to the normal, non- // zero, and a...
python
def travis_after(ini, envlist): """Wait for all jobs to finish, then exit successfully.""" # after-all disabled for pull requests if os.environ.get('TRAVIS_PULL_REQUEST', 'false') != 'false': return if not after_config_matches(ini, envlist): return # This is not the one that needs to w...
java
protected int normalizeIndex(int index) throws SQLException { if (index < 0) { int columnCount = getResultSet().getMetaData().getColumnCount(); do { index += columnCount; } while (index < 0); } return index + 1; }
java
public void setWindowMinFullHeight(int minHeight) { Window window = CmsVaadinUtils.getWindow(this); if (window == null) { return; } window.setHeight("90%"); setHeight("100%"); setContentMinHeight(minHeight); window.center(); }
java
public static int countIgnoreCase(final String source, final String target) { if (isEmpty(source) || isEmpty(target)) { return 0; } return count(source.toLowerCase(), target.toLowerCase()); }
java
public List<StorageAccount> createStorageAccountsFrom(Element accounts) { List<StorageAccount> accts = new ArrayList<StorageAccount>(); try { Iterator<?> accountList = accounts.getChildren().iterator(); while (accountList.hasNext()) { Element accountXml = (Element...
java
private void validateFunctionJsDoc(Node n, JSDocInfo info) { if (info == null) { return; } if (info.containsFunctionDeclaration() && !info.hasType() && !isJSDocOnFunctionNode(n, info)) { // This JSDoc should be attached to a FUNCTION node, or an assignment // with a function as the RHS, e...
python
def compile(self, source, dest, is_two_file=True, post=None, lang=None): """Compile the docstring into HTML and save as dest.""" makedirs(os.path.dirname(dest)) with io.open(dest, "w+", encoding="utf8") as out_file: with io.open(source, "r", encoding="utf8") as in_file: ...
python
def iterator(plugins, context): """An iterator for plug-in and instance pairs""" test = pyblish.logic.registered_test() state = { "nextOrder": None, "ordersWithError": set() } for plugin in plugins: state["nextOrder"] = plugin.order message = test(**state) i...
python
def recv_packet(self, timeout=None): ''' Receive packets from any device on which one is available. Blocks until it receives a packet, unless a timeout value >=0 is given. Raises Shutdown exception when device(s) are shut down (i.e., on a SIGINT to the process). Raises NoPacke...
java
protected Boolean doVerifySign(final Map<String, ?> data) { String actualSign = String.valueOf(data.get(WepayField.SIGN)); Map<String, String> signingMap = filterSignParams(data); String expectSign = doSign(signingMap); return expectSign.equals(actualSign); }
java
@Override public Vector<Integer> getAlertList() throws DatabaseException { try { try (PreparedStatement psReadScan = getConnection().prepareStatement("SELECT " + ALERTID + " FROM " + TABLE_NAME)) { Vector<Integer> v = new Vector<>(); try (ResultSet rs = psReadScan.executeQuery()) { ...
java
protected void reportPrimaryCleared(DatanodeID node) { if (node != null && shouldUpdateNodes()) { if (outStandingReports.remove(node)) { LOG.info("Failover: Outstanding reports: " + outStandingReports.size()); } } }
java
@Override public String htmlStart(String helpUrl) { String stylesheet = null; if (isPopup()) { stylesheet = "popup.css"; } StringBuffer result = new StringBuffer(super.pageHtmlStyle(HTML_START, null, stylesheet)); if (getSettings().isViewExplorer()) { ...
java
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWid...
java
protected final boolean isValidSize (int width, int height) { if (width < 0 || height < 0) { log.warning("Attempt to add invalid dirty region?!", "size", (width + "x" + height), new Exception()); return false; } else if (width == 0 || height == 0) { ...
java
public DSet newDSet() { if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, cannot create a DSet with a null database."); } return (DSet) DSetFactory.singleton.createCollectionOrMap(getCurrentPBKey()); }
java
public static <T> void putAt(List<T> self, int idx, T value) { int size = self.size(); idx = normaliseIndex(idx, size); if (idx < size) { self.set(idx, value); } else { while (size < idx) { self.add(size++, null); } self.add...
python
def body_block_title_label_caption(tag_content, title_value, label_value, caption_content, set_caption=True, prefer_title=False, prefer_label=False): """set the title, label and caption values in a consistent way set_caption: insert a "caption" field prefer_title: when on...
java
private void doCreate(final FileStatusEntry entry) { for (final PathAlterationListener listener : listeners.values()) { if (entry.isDirectory()) { listener.onDirectoryCreate(entry.getPath()); } else { listener.onFileCreate(entry.getPath()); } } final FileStatusEntry[] chil...
java
public void clean(final FileSystemDatasetVersion versionToDelete, final Set<Path> possiblyEmptyDirectories) throws IOException { log.info("Deleting dataset version " + versionToDelete); Set<Path> pathsToDelete = versionToDelete.getPaths(); log.info("Deleting paths: " + Arrays.toString(pathsToDelete.toArray...
python
def print_filters(): """Prints all filters available with their description.""" for filter_name in VALID_FILTERS: filter_func = getattr(filters, 'filter_{0}'.format(filter_name)) description = filter_func.__doc__ if description: description = re.sub(r'\n\s+', ' ', description...
python
def match_route(self, reqpath): """Match a request with parameter to it's corresponding route""" route_dicts = [routes for _, routes in self.api.http.routes.items()][0] routes = [route for route, _ in route_dicts.items()] if reqpath not in routes: for route in routes: # repl...