Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

CLUES Python utils - Utils and General classes that spin off from CLUES

Project Description

# CLUES Python Utils
This is a set of util functions and classes for python that were initially created in the CLUES project, but are of general purpose and can be used in other projects, such as VMCA.

These utilities include a mechanism to easily load configuration files, to connect to OpenNebula, to generate objects from a XML document, etc.

## Examples

### eventloop module

It is possible to create a eventloop in which the events are automatically called as they happen in the time. This is a simple example of an event loop with periodical events and one eventual alarm.

def function(param):
print param

import cpyutils.eventloop
cpyutils.eventloop.get_eventloop().add_periodical_event(1, 0,"period-check",function, ["sisisi"])

This eventloop has also the possibility of running in real time or in simmulated time (the internal time of the event loop advances as a time machine to the next event).

### config module

Using this piece of code you will have the initialized values of these variables in the ```myconfig``` object, or the values in the configuration file (more complex constructions are available).

import cpyutils.config
cpyutils.config.set_paths([ './etc/', '/etc/' ])
myconfig = cpyutils.config.Configuration(
"DEBUG_LEVEL": "error",
"LOG_FILE": None,
### parameters module

It offers an easy mechanism to parse a commandline and to generate the help for a CLI. The next code will be a version for the ```ls``` command line utility.

ap = CmdLineParser("ls", "List directory contents", [
Flag("-a", "--all", desc = "do not ignore entries starting with ."),
Flag("-A", "--almost-all", desc = "do not list implied . and .."),
Flag("--author", desc = "with -l, print the author of each file"),
Flag("-b", "--escape", desc = "print C-style escapes for nongraphic characters"),
Parameter("--block-size", desc = "scale sizes by SIZE before printing them. E.g., '--block-size=M' prints sizes in units of 1,048,576 bytes. See SIZE format."),
Argument("FILE", "the files that want to be listed", count = -1)

print ap

# Installing

Installing cpyutils package is as easy as executing (as root):

``` $ python install --record installed-files.txt```

This way you will have the installed-files.txt file to be able to uninstall this package in case that you don't need it anymore. To uninstall this package, you can execute (as root):

``` $ cat installed-files.txt | xargs rm -rf```

Release History

History Node


History Node


History Node


History Node


History Node


History Node


History Node


This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(40.4 kB) Copy SHA256 Hash SHA256
Source Dec 15, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting