Package x2go :: Module utils
[frames] | no frames]

Module utils

source code

Python X2go helper functions, constants etc.

Functions
 
is_in_nx3packmethods(method)
Test if a given compression method is valid for NX3 Proxy.
source code
 
find_session_line_in_x2golistsessions(session_name, x2go_stdout)
Return the X2go session meta information as returned by the x2golistsessions server command for session session_name.
source code
 
slugify(value)
Normalizes string, converts to lowercase, removes non-alpha characters, converts spaces to hyphens and replaces round brackets by pointed brackets.
source code
 
session_names_by_timestamp(session_infos)
Sorts session profile names by their timestamp (as used in the file format's section name).
source code
 
touch_file(filename, mode='a')
Imitates the behaviour of the GNU/touch command.
source code
list
unique(seq)
Imitates the behaviour of the GNU/uniq command.
source code
 
known_encodings()
Render a list of all-known-to-Python character encodings (including all known aliases)
source code
 
patiently_remove_file(dirname, filename)
Try to remove a file, wait for unlocking, remove it once removing is possible...
source code
str
detect_unused_port(bind_address='', preferred_port=None)
Detect an unused IP socket.
source code
str
get_encoding()
Detect systems default character encoding.
source code
bool
is_abs_path(path)
Test if a given path is an absolute path name.
source code
dict
xkb_rules_names()
Wrapper for: xprop -root _XKB_RULES_NAMES
source code
 
local_color_depth()
Detect the current local screen's color depth.
source code
bool
is_color_depth_ok(depth_session, depth_local)
Test if color depth of this session is compatible with the local screen's color depth.
source code
Variables
  __NAME__ = 'x2goutils-pylib'
  __package__ = 'x2go'
Function Details

touch_file(filename, mode='a')

source code 

Imitates the behaviour of the GNU/touch command.

Parameters:
  • filename (str) - name of the file to touch
  • mode (str) - the file mode (as used for Python file objects)

unique(seq)

source code 

Imitates the behaviour of the GNU/uniq command.

Parameters:
  • seq (list) - a list/sequence containing consecutive duplicates.
Returns: list
list that has been clean up from the consecutive duplicates

patiently_remove_file(dirname, filename)

source code 

Try to remove a file, wait for unlocking, remove it once removing is possible...

Parameters:
  • dirname (str) - directory name the file is in
  • filename (str) - name of the file to be removed

detect_unused_port(bind_address='', preferred_port=None)

source code 

Detect an unused IP socket.

Parameters:
  • bind_address (str) - IP address to bind to
  • preferred_port (str) - IP socket port that shall be tried first for availability
Returns: str
free local IP socket port that can be used for binding

get_encoding()

source code 

Detect systems default character encoding.

Returns: str
The system's local character encoding.

is_abs_path(path)

source code 

Test if a given path is an absolute path name.

Parameters:
  • path (str) - test this path for absolutism...
Returns: bool
Returns True if path is an absolute path name

xkb_rules_names()

source code 

Wrapper for: xprop -root _XKB_RULES_NAMES

Returns: dict
A Python dictionary that contains the current X11 keyboard rules.

is_color_depth_ok(depth_session, depth_local)

source code 

Test if color depth of this session is compatible with the local screen's color depth.

Parameters:
  • depth_session (int) - color depth of the session
  • depth_local (int) - color depth of local screen
Returns: bool
Does the session color depth work with the local display?