VSC Python iRODSClient
latest
  • VSCiRODSSession
  • BulkManager (session.bulk)
  • PathManager (session.path)
  • SearchManager (session.search)
VSC Python iRODSClient
  • Docs »
  • SearchManager (session.search)
  • Edit on GitHub

SearchManager (session.search)¶

class vsc_irods.manager.search_manager.SearchManager(session)[source]¶

A class for easier searching in the iRODS file system

glob(*args, debug=False)[source]¶

As iglob(), but returns a list instead of an iterator, similar to the glob.iglob builtin.

Arguments:

args: one or more str

The search patterns

debug: bool (default: False)

Set to True for debugging info

iglob(pattern, debug=False)[source]¶

Returns an iterator of iRODS collection and data object paths which match the given pattern, similar to the glob.iglob builtin.

Note

Currently only ‘*’ is expanded. The other special characters ‘?’ and ‘[]’ are not (yet) taken into account.

Examples:

>>> session.glob('m*/ch4.xyz')
    ['molecules_database/ch4.xyz']
>>> session.glob('./*/*')
    ['./molecule_database/a.out', './foo/bar.so']
>>> session.glob('~/foo/c*.xyz')
    ['~/foo/ch4.xyz', '~/foo/co2.xyz']

Arguments:

pattern: str

The search pattern

debug: bool (default: False)

Set to True for debugging info

walk(collection, mindepth=0, maxdepth=- 1, return_objects=False, debug=False)[source]¶

Top-down collection tree generator, yielding 3-tuples of (collection, [list of subcollections], [list of data objects]).

Only those tuples are returned for which the subcollections and data objects are within the selected depth range.

Arguments:

collection: str or iRODSCollection instance

The root of the collection tree in which to search

mindepth: int (default: 0)

Minimal depth with respect to the root collections

maxdepth: int (default: -1)

Maximal depth with respect to the root collections

return_objects: bool (default: True)

Whether to return path strings or the corresponding objects (iRODSCollection and iRODSDataObject instances)

debug: bool (default: False)

Set to True for debugging info

find(irods_path='.', pattern='*', use_wholename=False, types='d,f', mindepth=0, maxdepth=- 1, collection_avu=[], object_avu=[], debug=False)[source]¶

Returns a list of iRODS collection and data object paths which match the given pattern, similar to the UNIX find command.

Examples:

>>> session.find('.', pattern='*mol*/*.xyz', types='f',
>>>              object_avu=('=,kind', 'like,%organic'))
    ['data/molecules/c6h6.xyz', './data/molecules/ch3cooh.xyz']
>>> session.find('~/data*', pattern='molecules', types='d')
    ['~/data/molecules']

Arguments:

irods_path: str (default: ‘.’)

Glob pattern of the roots of the iRODS collection trees in which to search

pattern: str (default: ‘*’)

The search pattern

use_wholename: bool (default: False)

Whether it is the whole (absolute) path name that has to match the pattern, or only the basename of the collection or data object.

types: str (default: ‘d,f’)

Comma-separated list of one or more of the following characters to select the type of results to include:

  • ‘d’ for directories (i.e. collections)

  • ‘f’ for files (i.e. data objects)

mindepth: int (default: 0)

Minimal depth with respect to the root collections

maxdepth: int (default: -1)

Maximal depth with respect to the root collections

collection_avu: tuple or list of tuples (default: [])

One or several attribute[-value[-unit]] patterns to be used in filtering collections.

object_avu: tuple or list of tuples (default: [])

One or several attribute[-value[-unit]] patterns to be used in filtering data objects.

debug: bool (default: False)

Set to True for debugging info

Previous

© Copyright 2020, VSC Revision 091f4479.

Built with Sphinx using a theme provided by Read the Docs.