utils Package

utils Package

Utilities for the other methods.

class nicos.utils.HardwareStub(dev)

Bases: object

An object that denies all attribute access, used to prevent accidental hardware access in simulation mode.

class nicos.utils.NicosConfigParser(defaults=None, dict_type=<type 'dict'>)

Bases: ConfigParser.SafeConfigParser

Bases: SafeConfigParser

optionxform(key)
class nicos.utils.Repeater(obj)

Bases: object

next()
nicos.utils.bitDescription(bits, *descriptions)

Return a description of a bit-wise value.

nicos.utils.closeSocket(sock)

Do our best to close a socket.

nicos.utils.colorcode(name)
nicos.utils.colorize(name, text)
nicos.utils.daemonize()

Daemonize the current process.

nicos.utils.disableDirectory(startdir)

Traverse a directory tree and remove access rights.

nicos.utils.enableDirectory(startdir)

Traverse a directory tree and grant access rights.

nicos.utils.ensureDirectory(dirname)

Make sure a directory exists.

nicos.utils.expandTemplate(template, keywords, field_re=<_sre.SRE_Pattern object at 0x83f9e38>)

Simple template field replacement engine.

nicos.utils.formatDocstring(s, indentation='')

Format a docstring into lines for display on the console.

nicos.utils.formatDuration(secs)
nicos.utils.formatExtendedFrame(frame)
nicos.utils.formatExtendedStack(level=1)
nicos.utils.formatExtendedTraceback(etype, value, tb)
nicos.utils.getVersions(obj)

Return SVN Revision info for all modules where one of the object’s class and base classes are in.

class nicos.utils.lazy_property(func)

Bases: object

A property that calculates its value only once.

nicos.utils.nocolor()
nicos.utils.printTable(headers, items, printfunc)

Print tabular information nicely formatted.

nicos.utils.readConfig()
nicos.utils.readFile(filename)
nicos.utils.readFileCounter(counterpath)
nicos.utils.removePidfile(appname)
nicos.utils.runAsync(func)
nicos.utils.setuser()

Do not daemonize, but at least set the current user and group correctly to the configured values if started as root.

nicos.utils.updateFileCounter(counterpath, value)
nicos.utils.whyExited(status)
nicos.utils.writeFile(filename, lines)
nicos.utils.writePidfile(appname)

comparestrings Module

nicos.utils.comparestrings.compare(s1, s2)
nicos.utils.comparestrings.test()

fitting Module

Utilities for function fitting.

class nicos.utils.fitting.Fit(model, parnames=None, parstart=None, xmin=None, xmax=None, allow_leastsq=True, ifixb=None)

Bases: object

par(name, start)
result(name, method, x, y, dy, parvalues, parerrors)
run(name, x, y, dy)
class nicos.utils.fitting.FitResult(**kwds)

Bases: object

loggers Module

Logging utilities specific to NICOS.

class nicos.utils.loggers.ColoredConsoleHandler

Bases: logging.StreamHandler

Bases: StreamHandler

A handler class that writes colorized records to standard output.

emit(record)
class nicos.utils.loggers.ELogHandler

Bases: logging.Handler

Bases: Handler

emit(record, entries=('name', 'created', 'levelno', 'message', 'exc_text', 'filename'))
filter(record)
class nicos.utils.loggers.NicosConsoleFormatter(fmt=None, datefmt=None, colorize=None)

Bases: logging.Formatter

Bases: Formatter

A lightweight formatter for the interactive console, with optional colored output.

format(record)
formatException(exc_info)
formatTime(record, datefmt=None)
class nicos.utils.loggers.NicosLogfileFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

Bases: Formatter

The standard Formatter does not support milliseconds with an explicit datestamp format. It also doesn’t show the full traceback for exceptions.

formatException(ei)
formatTime(record, datefmt=None)
class nicos.utils.loggers.NicosLogfileHandler(directory, filenameprefix='nicos', filenamesuffix=None, dayfmt='%Y-%m-%d')

Bases: logging.handlers.BaseRotatingHandler

Bases: BaseRotatingHandler

Logs to log files with a date stamp appended, and rollover on midnight.

changeDirectory(directory)
doRollover()
emit(record)
enable(enabled)
filter(record)
class nicos.utils.loggers.NicosLogger(name, level=0)

Bases: logging.Logger

Bases: Logger

Nicos logger class with special method behavior.

action(msg)
debug(*msgs, **kwds)
error(*msgs, **kwds)
exception(*msgs, **kwds)
info(*msgs, **kwds)
warning(*msgs, **kwds)
nicos.utils.loggers.initLoggers()

proposaldb Module

FRM-II proposal DB utilities.

class nicos.utils.proposaldb.ProposalDB(credentials)

Bases: object

nicos.utils.proposaldb.queryCycle(credentials)

Query the FRM-II proposal database for the current cycle.

nicos.utils.proposaldb.queryProposal(credentials, pnumber)

Query the FRM-II proposal database for information about the given proposal number.

proxy Module

A general nicos proxy superclass.

class nicos.utils.proxy.NicosProxy(obj)

Bases: object

General proxy class to add special behaviour to classes. See http://code.activestate.com/recipes/252151-generalized-delegates-and-proxies/

nicos.utils.proxy.ProxyFactory(obj, names, proxyclass=<class 'nicos.utils.proxy.NicosProxy'>)

Factory function for Proxies that can delegate magic names.

nicos.utils.proxy.getter(attrib)

Table Of Contents

Previous topic

tas Package

Next topic

web Package