libtbx.utils
index
/net/chevy/raid1/nat/src/cctbx_project/libtbx/utils.py

 
Modules
       
atexit
bz2
glob
gzip
hashlib
math
posixpath
os
libtbx.queuing_system_utils.pbs_utils
re
libtbx.queuing_system_utils.sge_utils
shutil
sys
time
traceback
warnings

 
Classes
       
__builtin__.object
detect_binary_file
download_progress
download_target
indentor
buffered_indentor
input_with_prompt
multi_out
null_out
progress_displayed_as_fraction
progress_bar
raise_if_output
time_log
timer_base
user_plus_sys_time
wall_clock_time
tmp_dir_wrapper
Keep
host_and_user
import_python_object
show_times

 
class Keep
    

 
class buffered_indentor(indentor)
    
Method resolution order:
buffered_indentor
indentor
__builtin__.object

Methods defined here:
__init__(self, file_object=None, indent='', parent=None)
write(self, block)
write_buffer(self)

Methods inherited from indentor:
shift_right(self, indent=' ')

Data descriptors inherited from indentor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class detect_binary_file(__builtin__.object)
     Methods defined here:
__init__(self, monitor_initial=None, max_fraction_non_ascii=None)
is_binary_file(self, block)

Static methods defined here:
from_initial_block(file_name, monitor_initial=None, max_fraction_non_ascii=None)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class download_progress(__builtin__.object)
    Simple proxy for displaying download status - here with methods for
writing to the console, but can be subclassed and used for graphical display.
 
  Methods defined here:
__init__(self, log=None, n_kb_total=None)
complete(self)
increment(self, n_kb)
percent_finished(self)
run_continuously(self)
Placeholder for cases where the download is not being run asynchronously.
set_total_size(self, n_kb_total)
show_progress(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class download_target(__builtin__.object)
    Flexible callable object for retrieving a file from a URL, with optional
HTTPS authentication.  Designed to be runnable in a separate thread with
graphical progress update.
 
Note that in some circumstances SSL support may be missing from the socket
module, in which case we use 'curl' to download securely.  (This will not
work on Windows, obviously.)
 
  Methods defined here:
__call__(self, log=None, progress_meter=None)
__init__(self, url, file_name, use_curl=None, user=None, password=None, base_url=None)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class host_and_user
     Methods defined here:
__init__(self)
get_host_name(self)
get_user_name(self)
show(self, out=None, prefix='')

 
class import_python_object
     Methods defined here:
__init__(self, import_path, error_prefix, target_must_be, where_str)

 
class indentor(__builtin__.object)
     Methods defined here:
__init__(self, file_object=None, indent='', parent=None)
shift_right(self, indent=' ')
write(self, block)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class input_with_prompt(__builtin__.object)
     Methods defined here:
__del__(self)
__init__(self, prompt, tracebacklimit=0)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class multi_out(__builtin__.object)
    Multiplexing output stream, e.g. for simultaneously printing to stdout
and a logfile.
 
  Methods defined here:
__init__(self)
close(self)
flush(self)
isatty(self)
register(self, label, file_object, atexit_send_to=None)
Adds an output stream to the list.
replace_stringio(self, old_label, new_label, new_file_object, new_atexit_send_to=None)
write(self, str)
writelines(self, sequence)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class null_out(__builtin__.object)
    Pseudo-filehandle for suppressing printed output.
 
  Methods defined here:
close(self)
flush(self)
isatty(self)
write(self, str)
writelines(self, sequence)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class progress_bar(progress_displayed_as_fraction)
    
Method resolution order:
progress_bar
progress_displayed_as_fraction
__builtin__.object

Methods defined here:
advance(self)

Methods inherited from progress_displayed_as_fraction:
__init__(self, n)
done(self)

Data descriptors inherited from progress_displayed_as_fraction:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class progress_displayed_as_fraction(__builtin__.object)
     Methods defined here:
__init__(self, n)
advance(self)
done(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class raise_if_output(__builtin__.object)
    example use: sys.stdout = raise_if_output()
 
  Methods defined here:
close(self)
flush(self)
isatty(self)
write(self, str)
writelines(self, sequence)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class show_times
     Methods defined here:
__call__(self)
__init__(self, time_start=None, out=None)

 
class time_log(__builtin__.object)
     Methods defined here:
__init__(self, label, use_wall_clock=False)
average(self)
log(self)
log_elapsed(self, local_label)
report(self)
start(self)
stop(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
legend = 'time_log: label: n accumulation delta average'

 
class timer_base(__builtin__.object)
     Methods defined here:
__init__(self)
delta(self)
elapsed(self)
show_delta(self, prefix='', out=None)
show_elapsed(self, prefix='', out=None)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class tmp_dir_wrapper(__builtin__.object)
    Convenience methods for running in a (presumably empty) temporary directory
and copying all files to another directory.  Can be used whether or not the
temporary directory is actually defined; if None, no action will be taken.
Otherwise, both tmp_dir and dest_dir (default is current directory) must be
existing paths.
 
  Methods defined here:
__init__(self, tmp_dir, dest_dir=None, out=<open file '<stdout>', mode 'w'>)
transfer_files(self, out=<open file '<stdout>', mode 'w'>)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class user_plus_sys_time(timer_base)
    
Method resolution order:
user_plus_sys_time
timer_base
__builtin__.object

Methods defined here:
get(self)

Methods inherited from timer_base:
__init__(self)
delta(self)
elapsed(self)
show_delta(self, prefix='', out=None)
show_elapsed(self, prefix='', out=None)

Data descriptors inherited from timer_base:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class wall_clock_time(timer_base)
    motivation: when running multithreaded code, user_plus_sys_time
would report the cumulated times for all threads: not very useful
to analyse the scaling with the number of threads! Wall clock time, although
it is less reliable is the only solution in that case
 
 
Method resolution order:
wall_clock_time
timer_base
__builtin__.object

Methods defined here:
get(self)

Methods inherited from timer_base:
__init__(self)
delta(self)
elapsed(self)
show_delta(self, prefix='', out=None)
show_elapsed(self, prefix='', out=None)

Data descriptors inherited from timer_base:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
allow_delete_directory(target_dir)
Check for specified reserved directories which are standard on many systems;
these should never be deleted as part of any program.
base36_encode(integer, width=None)
base36_timestamp(seconds_since_epoch=None, multiplier=1000, width=10)
bz2_open(file_name, mode)
check_if_output_directory_exists(file_name=None, dir_name=None)
concatenate_python_script(out, file_name)
Insert a Python script into an existing file, removing any __future__
import to prevent syntax errors.  (This could be dangerous in most contexts
but is required for some of our Coot-related scripts to work.)
copy_file(source, target, compress=None)
count_max(assert_less_than)
create_run_directory(prefix, default_directory_number=None)
Create a program output directory using sequential numbering, picking the
highest run ID.  In other words, if the prefix is 'Refine' and the current
directory contains subdirectories named Refine_2 and Refine_9, the new
directory will be Refine_10.
date_and_time()
detect_multiprocessing_problem()
escape_sh_double_quoted(s)
the result is supposed to be double-quoted when passed to sh
file_size(file_name)
find_files(dir_name, pattern='*', files_only=True)
flat_list(nested_list)
format_cpu_times(show_micro_seconds_per_tick=True)
format_exception()
format_float_with_standard_uncertainty(value, standard_uncertainty)
format_timestamp = format_timestamp_12_hour(unix_time, short=False, replace_with='unknown')
format_timestamp_12_hour(unix_time, short=False, replace_with='unknown')
format_timestamp_24_hour(unix_time, short=False, replace_with='unknown')
frange(start, stop=None, step=None)
get_build_tag(path=None)
get_memory_from_string(mem_str)
get_svn_revision(path=None)
getcwd_or_default(default=None)
getcwd_safe()
getenv_bool(variable_name, default=False)
greek_time(secs)
gzip_open(file_name, mode)
hashlib_md5 = openssl_md5(...)
Returns a md5 hash object; optionally initialized with a string
human_readable_time(time_in_seconds)
human_readable_time_as_seconds(time_units, time_unit)
if_none(value, default)
install_urllib_http_proxy(server, port=80, user=None, password=None)
n_dim_index_from_one_dim(i1d, sizes)
number_from_string(string)
plural_s(n, suffix='s')
product(seq)
random_hex_code(number_of_digits)
remove_files(pattern=None, paths=None, ensure_success=True)
samples(start, stop=None, step=None, tolerance=1e-06)
search_for(pattern, mode, re_flags=0, lines=None, file_name=None)
select_matching(key, choices, default=None)
sequence_index_dict(seq, must_be_unique=True)
show_development_warning(out=<open file '<stdout>', mode 'w'>)
show_exception_info_if_full_testing(prefix='EXCEPTION_INFO: ')
show_times_at_exit(time_start=None, out=None)
show_total_time(out=None, show_micro_seconds_per_bytecode_instruction=True)
show_wall_clock_time(seconds, out=None)
sorry_excepthook(type, value, traceback)
sort_files_by_mtime(file_names=None, dir_name=None, reverse=False)
tupleize(x)
urlopen(*args, **kwds)
Substitute for urllib2.urlopen, with automatic HTTP proxy configuration
if specific environment variables are defined.
warn_if_unexpected_md5_hexdigest(path, expected_md5_hexdigests, hints=[], out=None)
write_this_is_auto_generated(f, file_name_generator)
xfrange(start, stop=None, step=None, tolerance=None)
A float range generator.
xlen(seq)
xsamples(start, stop=None, step=None, tolerance=1e-06)

 
Data
        disable_tracebacklimit = False
division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
libtbx_urllib_proxy = None
windows_device_names = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', ...]