GNUmed general tools.
|
handle_uncaught_exception_console(t,
v,
tb) |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recode_file(source_file=None,
target_file=None,
source_encoding=' utf8 ' ,
target_encoding=None,
base_dir=None,
error_mode=' replace ' ) |
source code
|
|
|
unzip_archive(archive_name,
target_dir=None,
remove_archive=False) |
source code
|
|
|
|
|
gpg_decrypt_file(filename=None,
passphrase=None) |
source code
|
|
|
|
|
file2chunked_md5(filename=None,
chunk_size=524288000) |
source code
|
|
|
unicode2charset_encoder(unicode_csv_data,
encoding=' utf-8 ' ) |
source code
|
|
|
unicode_csv_reader(unicode_csv_data,
dialect=?? ,
encoding=' utf-8 ' ,
**kwargs) |
source code
|
|
|
fname_sanitize(filename)
Normalizes unicode, removes non-alpha characters, converts spaces to
underscores. |
source code
|
|
|
fname_stem(filename)
/home/user/dir/filename.ext -> filename |
source code
|
|
|
fname_stem_with_path(filename)
/home/user/dir/filename.ext -> /home/user/dir/filename |
source code
|
|
|
fname_extension(filename=None,
fallback=None)
/home/user/dir/filename.ext -> .ext '' or '.' -> fallback if
any else '' |
source code
|
|
|
|
|
|
|
get_unique_filename(prefix=None,
suffix=None,
tmp_dir=None,
include_timestamp=False)
This introduces a race condition between the file.close() and
actually using the filename. |
source code
|
|
|
mklink(physical_name,
link_name,
overwrite=False) |
source code
|
|
|
import_module_from_directory(module_path=None,
module_name=None,
always_remove_path=False)
Import a module from any location. |
source code
|
|
|
|
|
bool2subst(boolean=None,
true_return=True,
false_return=False,
none_return=None) |
source code
|
|
|
bool2str(boolean=None,
true_str=' True ' ,
false_str=' False ' ) |
source code
|
|
|
none_if(value=None,
none_equivalent=None,
strip_string=False)
Modelled after the SQL NULLIF function. |
source code
|
|
|
coalesce(initial=None,
instead=None,
template_initial=None,
template_instead=None,
none_equivalents=None,
function_initial=None)
Modelled after the SQL coalesce function. |
source code
|
|
|
|
|
|
|
input2int(initial=None,
minval=None,
maxval=None) |
source code
|
|
|
strip_prefix(text,
prefix,
remove_repeats=False,
remove_whitespace=False) |
source code
|
|
|
strip_suffix(text,
suffix,
remove_repeats=False,
remove_whitespace=False) |
source code
|
|
|
strip_leading_empty_lines(lines=None,
text=None,
eol=' \n ' ,
return_list=True) |
source code
|
|
|
strip_trailing_empty_lines(lines=None,
text=None,
eol=' \n ' ,
return_list=True) |
source code
|
|
|
strip_empty_lines(lines=None,
text=None,
eol=' \n ' ,
return_list=True) |
source code
|
|
|
list2text(lines,
initial_indent='
' ,
subsequent_indent='
' ,
eol=' \n ' ,
strip_leading_empty_lines=True,
strip_trailing_empty_lines=True,
strip_trailing_whitespace=True) |
source code
|
|
|
wrap(text=None,
width=None,
initial_indent='
' ,
subsequent_indent='
' ,
eol=' \n ' )
A word-wrap function that preserves existing line breaks
and most spaces in the text. |
source code
|
|
|
unwrap(text=None,
max_length=None,
strip_whitespace=True,
remove_empty_lines=True,
line_separator=' // ' ) |
source code
|
|
|
|
|
shorten_words_in_line(text=None,
max_length=None,
min_word_length=None,
ignore_numbers=True,
ellipsis=' \\u2026 ' ) |
source code
|
|
|
xml_escape_string(text=None)
check for special XML characters and transform them |
source code
|
|
|
tex_escape_string(text=None,
replace_known_unicode=True,
replace_eol=False,
keep_visual_eol=False)
Check for special TeX characters and transform them. |
source code
|
|
|
|
|
html_escape_string(text=None,
replace_eol=False,
keep_visual_eol=False) |
source code
|
|
|
|
|
|
|
compare_dict_likes(d1,
d2,
title1=None,
title2=None) |
source code
|
|
|
format_dict_likes_comparison(d1,
d2,
title_left=None,
title_right=None,
left_margin=0,
key_delim=' || ' ,
data_delim=' | ' ,
missing_string=' =/= ' ,
difference_indicator=' ! ' ,
ignore_diff_in_keys=None) |
source code
|
|
|
format_dict_like(d,
relevant_keys=None,
template=None,
missing_key_template=' <[%(key)s] MISSING> ' ,
left_margin=0,
tabular=False,
value_delimiters=( ' >>> ' , ' <<< ' ) ,
eol=' \n ' ) |
source code
|
|
|
normalize_dict_like(d,
required_keys,
missing_key_template=' <[%(key)s] MISSING> ' ) |
source code
|
|
|
|
|
|
|
__doc__ = """GNUmed general tools."""
|
|
u_currency_pound = ' \\u00A3 '
|
|
u_currency_sign = ' \\u00A4 '
|
|
u_currency_yen = ' \\u00A5 '
|
|
u_right_double_angle_quote = ' \\u00AB '
|
|
u_registered_trademark = ' \\u00AE '
|
|
u_plus_minus = ' \\u00B1 '
|
|
u_superscript_one = ' \\u00B9 '
|
|
u_left_double_angle_quote = ' \\u00BB '
|
|
u_one_quarter = ' \\u00BC '
|
|
u_one_half = ' \\u00BD '
|
|
u_three_quarters = ' \\u00BE '
|
|
u_multiply = ' \\u00D7 '
|
|
u_greek_ALPHA = ' \\u0391 '
|
|
u_greek_alpha = ' \\u03b1 '
|
|
u_greek_OMEGA = ' \\u03A9 '
|
|
u_greek_omega = ' \\u03c9 '
|
|
u_dagger = ' \\u2020 '
|
|
u_triangular_bullet = ' \\u2023 '
|
|
u_ellipsis = ' \\u2026 '
|
|
u_euro = ' \\u20AC '
|
|
u_numero = ' \\u2116 '
|
|
u_down_left_arrow = ' \\u21B5 '
|
|
u_left_arrow = ' \\u2190 '
|
|
u_up_arrow = ' \\u2191 '
|
|
u_arrow2right = ' \\u2192 '
|
|
u_down_arrow = ' \\u2193 '
|
|
u_left_arrow_with_tail = ' \\u21a2 '
|
|
u_arrow2right_from_bar = ' \\u21a6 '
|
|
u_arrow2right_until_vertical_bar = ' \\u21e5 '
|
|
u_sum = ' \\u2211 '
|
|
u_almost_equal_to = ' \\u2248 '
|
|
u_corresponds_to = ' \\u2258 '
|
|
u_infinity = ' \\u221E '
|
|
u_arrow2right_until_vertical_bar2 = ' \\u2b72 '
|
|
u_diameter = ' \\u2300 '
|
|
u_checkmark_crossed_out = ' \\u237B '
|
|
u_box_vert_left = ' \\u23b8 '
|
|
u_box_vert_right = ' \\u23b9 '
|
|
u_box_horiz_single = ' \\u2500 '
|
|
u_box_vert_light = ' \\u2502 '
|
|
u_box_horiz_light_3dashes = ' \\u2504 '
|
|
u_box_vert_light_4dashes = ' \\u2506 '
|
|
u_box_horiz_4dashes = ' \\u2508 '
|
|
u_box_T_right = ' \\u251c '
|
|
u_box_T_left = ' \\u2524 '
|
|
u_box_T_down = ' \\u252c '
|
|
u_box_T_up = ' \\u2534 '
|
|
u_box_plus = ' \\u253c '
|
|
u_box_top_double = ' \\u2550 '
|
|
u_box_top_left_double_single = ' \\u2552 '
|
|
u_box_top_right_double_single = ' \\u2555 '
|
|
u_box_top_left_arc = ' \\u256d '
|
|
u_box_top_right_arc = ' \\u256e '
|
|
u_box_bottom_right_arc = ' \\u256f '
|
|
u_box_bottom_left_arc = ' \\u2570 '
|
|
u_box_horiz_light_heavy = ' \\u257c '
|
|
u_box_horiz_heavy_light = ' \\u257e '
|
|
u_skull_and_crossbones = ' \\u2620 '
|
|
u_caduceus = ' \\u2624 '
|
|
u_frowning_face = ' \\u2639 '
|
|
u_smiling_face = ' \\u263a '
|
|
u_black_heart = ' \\u2665 '
|
|
u_female = ' \\u2640 '
|
|
u_male = ' \\u2642 '
|
|
u_male_female = ' \\u26a5 '
|
|
u_checkmark_thin = ' \\u2713 '
|
|
u_checkmark_thick = ' \\u2714 '
|
|
u_heavy_greek_cross = ' \\u271a '
|
|
u_arrow2right_thick = ' \\u2794 '
|
|
u_writing_hand = ' \\u270d '
|
|
u_pencil_1 = ' \\u270e '
|
|
u_pencil_2 = ' \\u270f '
|
|
u_pencil_3 = ' \\u2710 '
|
|
u_latin_cross = ' \\u271d '
|
|
u_arrow2right_until_black_diamond = ' \\u291e '
|
|
u_kanji_yen = ' \\u5186 '
|
|
u_replacement_character = ' \\ufffd '
|
|
u_link_symbol = ' \\u1f517 '
|
|
default_csv_reader_rest_key = ' list_of_values_of_unknown_fields '
|
|
CAPS_ALLCAPS = 2
|
|
CAPS_FIRST = 1
|
|
CAPS_FIRST_ONLY = 5
|
|
CAPS_NAMES = 4
|
|
CAPS_NONE = 0
|
|
CAPS_WORDS = 3
|
|
__package__ = ' Gnumed.pycommon '
|