[X2Go-Commits] [x2gobroker] 07/10: x2gobroker: Convert __doc__ strings from Epydoc syntax to sphinxy syntax.
git-admin at x2go.org
git-admin at x2go.org
Fri Sep 7 11:02:36 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2gobroker.
commit a24f1679d6e35f8d04591eea1a6c04b253f8ca0b
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Sep 7 09:59:54 2018 +0200
x2gobroker: Convert __doc__ strings from Epydoc syntax to sphinxy syntax.
---
x2gobroker/_paramiko.py | 32 +--
x2gobroker/agent.py | 272 +++++++++++-----------
x2gobroker/authmechs/testsuite_authmech.py | 2 +-
x2gobroker/brokers/base_broker.py | 358 ++++++++++++++---------------
x2gobroker/brokers/inifile_broker.py | 10 +-
x2gobroker/brokers/zeroconf_broker.py | 2 +-
x2gobroker/config.py | 92 ++++----
x2gobroker/loadchecker.py | 28 +--
x2gobroker/loggers.py | 10 +-
x2gobroker/uccsjson.py | 104 ++++-----
x2gobroker/utils.py | 46 ++--
11 files changed, 476 insertions(+), 480 deletions(-)
diff --git a/x2gobroker/_paramiko.py b/x2gobroker/_paramiko.py
index 4a7c2fa..631eabe 100644
--- a/x2gobroker/_paramiko.py
+++ b/x2gobroker/_paramiko.py
@@ -47,10 +47,10 @@ def _SSHClient_save_host_keys(self, filename):
L{load_host_keys} (plus any added directly) will be saved -- not any
host keys loaded with L{load_system_host_keys}.
- @param filename: the filename to save to
- @type filename: str
+ :param filename: the filename to save to
+ :type filename: ``str``
- @raise IOError: if the file could not be written
+ :raises IOError: if the file could not be written
"""
# update local host keys from file (in case other SSH clients
@@ -74,16 +74,16 @@ def _HostKeys_load(self, filename):
Read a file of known SSH host keys, in the format used by openssh.
This type of file unfortunately doesn't exist on Windows, but on
posix, it will usually be stored in
- C{os.path.expanduser("~/.ssh/known_hosts")}.
+ ``os.path.expanduser("~/.ssh/known_hosts")``.
If this method is called multiple times, the host keys are merged,
- not cleared. So multiple calls to C{load} will just call L{add},
+ not cleared. So multiple calls to ``load`` will just call L{add},
replacing any existing entries and adding new ones.
- @param filename: name of the file to read host keys from
- @type filename: str
+ :param filename: name of the file to read host keys from
+ :type filename: str
- @raise IOError: if there was an error reading the file
+ :raises IOError: if there was an error reading the file
"""
f = open(filename, 'r')
@@ -105,14 +105,14 @@ def _HostKeys_load(self, filename):
def _HostKeys_add(self, hostname, keytype, key, hash_hostname=True):
"""\
Add a host key entry to the table. Any existing entry for a
- C{(hostname, keytype)} pair will be replaced.
-
- @param hostname: the hostname (or IP) to add
- @type hostname: str
- @param keytype: key type (C{"ssh-rsa"} or C{"ssh-dss"})
- @type keytype: str
- @param key: the key to add
- @type key: L{PKey}
+ ``(<hostname>, <keytype>)`` pair will be replaced.
+
+ :param hostname: the hostname (or IP) to add
+ :type hostname: str
+ :param keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
+ :type keytype: str
+ :param key: the key to add
+ :type key: :class:`PKey`
"""
for e in self._entries:
diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py
index 58b350c..8d31d16 100644
--- a/x2gobroker/agent.py
+++ b/x2gobroker/agent.py
@@ -88,18 +88,18 @@ def call_broker_agent(username, task, cmdline_args=[], remote_agent=None, logger
"""\
Launch X2Go Broker Agent and process its output.
- @param username: run the broker agent for this user
- @type username: C{unicode}
- @param task: task name to execute via the broker agent (listsessions, getservers, etc.)
- @type task: C{unicode}
- @param cmdline_args: additional command line parameters for the broker agent
- @type cmdline_args: C{list}
- @param remote_agent: if not C{None} call a remote broker agent via SSH
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
-
- @raise X2GoBrokerAgentException: if the call to the remote broker agents fails.
+ :param username: run the broker agent for this user
+ :type username: ``str``
+ :param task: task name to execute via the broker agent (listsessions, getservers, etc.)
+ :type task: ``str``
+ :param cmdline_args: additional command line parameters for the broker agent
+ :type cmdline_args: ``list``
+ :param remote_agent: if not ``None`` call a remote broker agent via SSH
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
+
+ :raises X2GoBrokerAgentException: if the call to the remote broker agents fails.
"""
if remote_agent in ('LOCAL', None):
@@ -113,16 +113,16 @@ def _call_local_broker_agent(username, task, cmdline_args=[], logger=None):
"""\
Launch X2Go Broker Agent locally and process its output.
- @param username: run the broker agent for this user
- @type username: C{unicode}
- @param task: task name to execute via the broker agent (listsessions, getservers, etc.)
- @type task: C{unicode}
- @param cmdline_args: additional command line parameters for the broker agent
- @type cmdline_args: C{list}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the broker agent for this user
+ :type username: ``str``
+ :param task: task name to execute via the broker agent (listsessions, getservers, etc.)
+ :type task: ``str``
+ :param cmdline_args: additional command line parameters for the broker agent
+ :type cmdline_args: ``list``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @raise X2GoBrokerAgentException: if the call to the remote broker agents fails.
+ :raises X2GoBrokerAgentException: if the call to the remote broker agents fails.
"""
if logger is None:
@@ -177,18 +177,18 @@ def _call_remote_broker_agent(username, task, cmdline_args=[], remote_agent=None
"""\
Launch remote X2Go Broker Agent via SSH and process its output.
- @param username: run the broker agent for this user
- @type username: C{unicode}
- @param task: task name to execute via the broker agent (listsessions, getservers, etc.)
- @type task: C{unicode}
- @param cmdline_args: additional command line parameters for the broker agent
- @type cmdline_args: C{list}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the broker agent for this user
+ :type username: ``str``
+ :param task: task name to execute via the broker agent (listsessions, getservers, etc.)
+ :type task: ``str``
+ :param cmdline_args: additional command line parameters for the broker agent
+ :type cmdline_args: ``list``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @raise X2GoBrokerAgentException: if the call to the remote broker agents fails.
+ :raises X2GoBrokerAgentException: if the call to the remote broker agents fails.
"""
if logger is None:
@@ -272,13 +272,13 @@ def ping(remote_agent=None, logger=None, **kwargs):
"""\
Ping X2Go Broker Agent.
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: C{True} if broker agent responds
- @rtype: C{bool}
+ :returns: ``True`` if broker agent responds
+ :rtype: ``bool``
"""
if logger is None:
@@ -298,16 +298,16 @@ def list_sessions(username, remote_agent=None, logger=None, **kwargs):
"""\
Query X2Go Broker Agent for a session list for a given username.
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, <list-of-sessions>), a tuple with the <success> flag as first item
- and a session C{list} as second item
- @rtype: C{tuple}
+ :returns: (<success>, <list-of-sessions>), a tuple with the <success> flag as first item
+ and a session ``list`` as second item
+ :rtype: ``tuple``
"""
if logger is None:
@@ -321,15 +321,15 @@ def suspend_session(username, session_name, remote_agent=None, logger=None, **kw
"""\
Trigger a session suspensions via the X2Go Broker Agent.
- @param username: suspend the session on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: suspend the session on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, ), a tuple with the <success> flag as first item
- @rtype: C{tuple}
+ :returns: (<success>, ), a tuple with the <success> flag as first item
+ :rtype: ``tuple``
"""
if logger is None:
@@ -343,15 +343,15 @@ def terminate_session(username, session_name, remote_agent=None, logger=None, **
"""\
Trigger a session termination via the X2Go Broker Agent.
- @param username: terminate the session on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: terminate the session on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, ), a tuple with the <success> flag as first item
- @rtype: C{tuple}
+ :returns: (<success>, ), a tuple with the <success> flag as first item
+ :rtype: ``tuple``
"""
if logger is None:
@@ -366,15 +366,15 @@ def has_sessions(username, remote_agent=None, logger=None, **kwargs):
Query X2Go Broker Agent to detect running/suspended sessions on
the remote X2Go Server (farm).
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, <has-running-sessions>, <has-suspended-session>), a tuple of two Boolean values
- @rtype: C{tuple}
+ :returns: (<success>, <has-running-sessions>, <has-suspended-session>), a tuple of two Boolean values
+ :rtype: ``tuple``
"""
if logger is None:
@@ -395,16 +395,16 @@ def find_busy_servers(username, remote_agent=None, logger=None, **kwargs):
The result is independent from the username given.
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, <server-usage>), a tuple with the <success> flag as first item
+ :returns: (<success>, <server-usage>), a tuple with the <success> flag as first item
and a dict reflecting the relative server usage
- @rtype: C{tuple}
+ :rtype: ``tuple``
"""
if logger is None:
@@ -430,14 +430,14 @@ def check_load(remote_agent=None, logger=None, **kwargs):
Query X2Go Broker Agent for a summary of system load specific
parameters.
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, <load-factor>), a tuple with the <success> flag as first item
+ :returns: (<success>, <load-factor>), a tuple with the <success> flag as first item
and the queried server's load factor as second item
- @rtype: C{tuple}
+ :rtype: ``tuple``
"""
if logger is None:
@@ -481,19 +481,19 @@ def add_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/aut
"""\
Add a public key hash to the user's authorized_keys file.
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param pubkey_hash: the public key hash as found in SSH authorized_keys files
- @type pubkey_hash: C{unicode}
- @param authorized_keys_file: the full path to the remote X2Go server's authorized_keys file
- @type authorized_keys_file: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param pubkey_hash: the public key hash as found in SSH authorized_keys files
+ :type pubkey_hash: ``str``
+ :param authorized_keys_file: the full path to the remote X2Go server's authorized_keys file
+ :type authorized_keys_file: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, ), a tuple with the <success> flag as first item
- @rtype: C{tuple}
+ :returns: (<success>, ), a tuple with the <success> flag as first item
+ :rtype: ``tuple``
"""
if logger is None:
@@ -507,19 +507,19 @@ def delete_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/
"""\
Remove a public key hash from the user's authorized_keys file.
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param pubkey_hash: the public key hash as found in SSH authorized_keys files
- @type pubkey_hash: C{unicode}
- @param authorized_keys_file: the full path to the remote X2Go server's authorized_keys file
- @type authorized_keys_file: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param pubkey_hash: the public key hash as found in SSH authorized_keys files
+ :type pubkey_hash: ``str``
+ :param authorized_keys_file: the full path to the remote X2Go server's authorized_keys file
+ :type authorized_keys_file: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, ), a tuple with the <success> flag as first item
- @rtype: C{tuple}
+ :returns: (<success>, ), a tuple with the <success> flag as first item
+ :rtype: ``tuple``
"""
if logger is None:
@@ -546,16 +546,16 @@ def get_servers(username, remote_agent=None, logger=None, **kwargs):
The result is independent from the username given.
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, <server-list>), a tuple with the <success> flag as first item
+ :returns: (<success>, <server-list>), a tuple with the <success> flag as first item
and the list of used X2Go Servers as second item
- @rtype: C{tuple}
+ :rtype: ``tuple``
"""
if logger is None:
@@ -582,16 +582,16 @@ def tasks_available(username, remote_agent=None, logger=None, **kwargs):
Depending on the remove broker agent's version, the result of this
query can vary tremendously from X2Go Server to X2Go Server.
- @param username: run the query on behalf of this username
- @type username: C{unicode}
- @param remote_agent: information about the remote agent that is to be called
- @type remote_agent: C{dict}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
+ :param username: run the query on behalf of this username
+ :type username: ``str``
+ :param remote_agent: information about the remote agent that is to be called
+ :type remote_agent: ``dict``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
- @return: (<success>, <server-list>), a tuple with the <success> flag as first item
+ :returns: (<success>, <server-list>), a tuple with the <success> flag as first item
and a list of available broker agent tasks as second item
- @rtype: C{tuple}
+ :rtype: ``tuple``
"""
if logger is None:
@@ -605,17 +605,17 @@ def genkeypair(local_username, client_address, key_type='RSA', logger=None):
"""\
Generate an SSH pub/priv key pair without writing the private key to file.
- @param local_username: the key is for this user
- @type local_username: C{unicode}
- @param client_address: the key is only valid for this client
- @type client_address: C{unicode}
- @param key_type: either of: RSA, DSA
- @type key_type: C{unicode}
- @param logger: logger instance to report log messages to
- @type logger: C{obj}
-
- @return: two-item tuple: (<pubkey>, <privkey>)
- @rtype: C{tuple}
+ :param local_username: the key is for this user
+ :type local_username: ``str``
+ :param client_address: the key is only valid for this client
+ :type client_address: ``str``
+ :param key_type: either of: RSA, DSA
+ :type key_type: ``str``
+ :param logger: logger instance to report log messages to
+ :type logger: :class:`logging.<Some>Logger`
+
+ :returns: two-item tuple: (<pubkey>, <privkey>)
+ :rtype: ``tuple``
"""
key = None
diff --git a/x2gobroker/authmechs/testsuite_authmech.py b/x2gobroker/authmechs/testsuite_authmech.py
index 7063e81..b3ad222 100644
--- a/x2gobroker/authmechs/testsuite_authmech.py
+++ b/x2gobroker/authmechs/testsuite_authmech.py
@@ -21,7 +21,7 @@ class X2GoBrokerAuthMech(object):
def authenticate(self, username, password, **kwargs):
- # return C{True} for user test with password sweet... (used by the unit tests)
+ # return ``True`` for user test with password sweet... (used by the unit tests)
if username == 'test' and password == 'sweet':
return True
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 75611fe..97cf132 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -19,7 +19,7 @@
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
"""\
-L{x2gobroker.brokers.base_broker.X2GoBroker} class - base skeleton for X2GoBroker implementations
+:class:`x2gobroker.brokers.base_broker.X2GoBroker` class - base skeleton for X2GoBroker implementations
"""
__NAME__ = 'x2gobroker-pylib'
@@ -47,14 +47,14 @@ from x2gobroker.defaults import X2GOBROKER_DAEMON_USER as _X2GOBROKER_DAEMON_USE
class X2GoBroker(object):
"""\
- L{x2gobroker.brokers.base_broker.X2GoBroker} is an abstract class for X2Go broker implementations.
+ :class:`x2gobroker.brokers.base_broker.X2GoBroker` is an abstract class for X2Go broker implementations.
This class needs to be inherited from a concrete broker class.
Currently available broker classes are::
- L{zeroconf.X2GoBroker} (working)
- L{inifile.X2GoBroker} (working)
- L{ldap.X2GoBroker} (in prep)
+ :class:`zeroconf.X2GoBroker <x2gobroker.brokers.zeroconf.X2GoBroker>` (working)
+ :class:`inifile.X2GoBroker <x2gobroker.brokers.inifile.X2GoBroker>` (working)
+ :class:`ldap.X2GoBroker <x2gobroker.brokers.ldap.X2GoBroker>` (in prep)
"""
@@ -67,10 +67,10 @@ class X2GoBroker(object):
Initialize a new X2GoBroker instance to control X2Go session through an
X2Go Client with an intermediate session broker.
- @param config_file: path to the X2Go Session Broker configuration file (x2gobroker.conf)
- @type config_file: C{unicode}
- @param config_defaults: Default settings for the broker's global configuration parameters.
- @type config_defaults: C{dict}
+ :param config_file: path to the X2Go Session Broker configuration file (x2gobroker.conf)
+ :type config_file: ``str``
+ :param config_defaults: Default settings for the broker's global configuration parameters.
+ :type config_defaults: ``dict``
"""
self.config_file = config_file
@@ -84,7 +84,7 @@ class X2GoBroker(object):
def __del__(self):
"""\
- Cleanup on destruction of an L{x2gobroker.brokers.base_broker.X2GoBroker} instance.
+ Cleanup on destruction of an :class:`X2GoBroker <x2gobroker.brokers.base_broker.X2GoBroker>` instance.
"""
pass
@@ -100,8 +100,8 @@ class X2GoBroker(object):
"""\
Accessor for self.backend_name property.
- @return: the backend name
- @rtype: C{unicode}
+ :returns: the backend name
+ :rtype: ``str``
"""
return self.backend_name
@@ -124,8 +124,8 @@ class X2GoBroker(object):
"""\
Set the client IP address.
- @param address: the client IP
- @type address: C{unicode}
+ :param address: the client IP
+ :type address: ``str``
"""
if netaddr.valid_ipv6(address):
@@ -141,8 +141,8 @@ class X2GoBroker(object):
"""\
Get the client IP address (if set).
- @return: the client IP (either IPv4 or IPv6)
- @rtype: C{unicode}
+ :returns: the client IP (either IPv4 or IPv6)
+ :rtype: ``str``
"""
if self._client_address:
@@ -154,8 +154,8 @@ class X2GoBroker(object):
"""\
Get the client IP address type of the client address (if set).
- @return: the client address type (4: IPv4, 6: IPv6)
- @rtype: C{int}
+ :returns: the client address type (4: IPv4, 6: IPv6)
+ :rtype: ``int``
"""
return self._client_address.version
@@ -164,8 +164,8 @@ class X2GoBroker(object):
"""\
Get the global section of the configuration file.
- @return: all global configuration parameters
- @rtype: C{dict}
+ :returns: all global configuration parameters
+ :rtype: ``dict``
"""
return self.config.get_section('global')
@@ -175,11 +175,11 @@ class X2GoBroker(object):
Get the configuration setting for an option in the global section of the
configuration file.
- @param option: option name in the global configuration section
- @type option: C{unicode}
+ :param option: option name in the global configuration section
+ :type option: ``str``
- @return: the value for the given global C{option}
- @rtype: C{bool}, C{unicode}, C{int} or C{list}
+ :returns: the value for the given global ``option``
+ :rtype: ``bool``, ``str``, ``int`` or ``list``
"""
return self.config.get_value('global', option)
@@ -190,8 +190,8 @@ class X2GoBroker(object):
have to use on their first connection attempt (if the global
config option "require-cookie" has been set).
- @return: the pre-set authentication cookie UUID hash
- @rtype: C{unicode}
+ :returns: the pre-set authentication cookie UUID hash
+ :rtype: ``str``
"""
unconfigured_my_cookie = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
@@ -217,24 +217,24 @@ class X2GoBroker(object):
"""\
Get the configuration section of a specific backend.
- @return: all backend configuration parameters
- @rtype: C{dict}
+ :returns: all backend configuration parameters
+ :rtype: ``dict``
"""
return self.config.get_section('broker_{backend}'.format(backend=self.backend_name))
def get_backend_value(self, backend='zeroconf', option='enable'):
"""\
- Get the configuration setting for backend C{backend} and option
- C{option}.
+ Get the configuration setting for backend ``backend`` and option
+ ``option``.
- @param backend: the name of the backend
- @type backend: C{unicode}
- @param option: option name of the backend's configuration section
- @type option: C{unicode}
+ :param backend: the name of the backend
+ :type backend: ``str``
+ :param option: option name of the backend's configuration section
+ :type option: ``str``
- @return: the value for the given C{backend} C{option}
- @rtype: C{bool}, C{unicode}, C{int} or C{list}
+ :returns: the value for the given ``backend`` ``option``
+ :rtype: ``bool``, ``str``, ``int`` or ``list``
"""
return self.config.get_value(backend, option)
@@ -243,8 +243,8 @@ class X2GoBroker(object):
"""\
Retrieve the complete list of session profile IDs.
- @return: list of profile IDs
- @rtype: C{list}
+ :returns: list of profile IDs
+ :rtype: ``list``
"""
return []
@@ -253,11 +253,11 @@ class X2GoBroker(object):
"""\
Retrieve the list of session profile IDs for a given user.
- @param username: query profile id list for this user
- @type username: C{unicode}
+ :param username: query profile id list for this user
+ :type username: ``str``
- @return: list of profile IDs
- @rtype: C{list}
+ :returns: list of profile IDs
+ :rtype: ``list``
"""
return [ id for id in self.get_profile_ids() if self.check_profile_acls(username, self.get_profile_acls(id)) ]
@@ -267,11 +267,11 @@ class X2GoBroker(object):
Get the session profile defaults, i.e. profile options that all
configured session profiles have in common.
- The defaults are hard-coded in L{x2gobroker.defaults} for class
- L{x2gobroker.brokers.base_broker.X2GoBroker}.
+ The defaults are hard-coded in :mod:`x2gobroker.defaults` for class
+ :class:`x2gobroker.brokers.base_broker.X2GoBroker`.
- @return: a dictionary containing the session profile defaults
- @rtype: C{dict}
+ :returns: a dictionary containing the session profile defaults
+ :rtype: ``dict``
"""
profile_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
@@ -283,10 +283,10 @@ class X2GoBroker(object):
def get_acl_defaults(self):
"""\
Get the ACL defaults for session profiles. The defaults are hard-coded
- in L{x2gobroker.defaults} for class L{x2gobroker.brokers.base_broker.X2GoBroker}.
+ in :mod:`x2gobroker.defaults` for class :class:`x2gobroker.brokers.base_broker.X2GoBroker`.
- @return: a dictionary containing the ACL defaults for all session profiles
- @rtype: C{dict}
+ :returns: a dictionary containing the ACL defaults for all session profiles
+ :rtype: ``dict``
"""
acl_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
@@ -299,11 +299,11 @@ class X2GoBroker(object):
"""\
Get the session profile for profile ID <profile_id>.
- @param profile_id: the ID of a profile
- @type profile_id: C{unicode}
+ :param profile_id: the ID of a profile
+ :type profile_id: ``str``
- @return: a dictionary representing the session profile for ID <profile_id>
- @rtype: C{dict}
+ :returns: a dictionary representing the session profile for ID <profile_id>
+ :rtype: ``dict``
"""
return {}
@@ -312,11 +312,11 @@ class X2GoBroker(object):
"""\
Get broker-specific session profile options from the session profile with profile ID <profile_id>.
- @param profile_id: the ID of a profile
- @type profile_id: C{unicode}
+ :param profile_id: the ID of a profile
+ :type profile_id: ``str``
- @return: a dictionary representing the session profile for ID <profile_id>
- @rtype: C{dict}
+ :returns: a dictionary representing the session profile for ID <profile_id>
+ :rtype: ``dict``
"""
return {}
@@ -325,11 +325,11 @@ class X2GoBroker(object):
"""\
Get the ACLs for session profile with profile ID <profile_id>.
- @param profile_id: the ID of a profile
- @type profile_id: C{unicode}
+ :param profile_id: the ID of a profile
+ :type profile_id: ``str``
- @return: a dictionary representing the ACLs for session profile with ID <profile_id>
- @rtype: C{dict}
+ :returns: a dictionary representing the ACLs for session profile with ID <profile_id>
+ :rtype: ``dict``
"""
return {}
@@ -339,10 +339,10 @@ class X2GoBroker(object):
Test if a given user can get through an ACL check using <acls> as a list
of allow and deny rules.
- @param username: the username of interest
- @type username: C{unicode}
- @param acls: a dictionary data structure containing ACL information (see L{defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS})
- @type acls: C{dict}
+ :param username: the username of interest
+ :type username: ``str``
+ :param acls: a dictionary data structure containing ACL information (see :envvar:`x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS`)
+ :type acls: ``dict``
"""
### extract ACLs evaluation orders
@@ -493,8 +493,8 @@ class X2GoBroker(object):
Get the name of the authentication mechanism that is configured for this
X2Go Session Broker instance.
- @return: auth-mech name
- @rtype: C{unicode}
+ :returns: auth-mech name
+ :rtype: ``str``
"""
_default_auth_mech = "pam"
@@ -514,10 +514,10 @@ class X2GoBroker(object):
"""\
Allow frontends to enforce a certain broker agent backend.
- @param mode: what agent query mode demanded
- @type mode: C{unicode}
- @return: the agent query mode we force the broker to
- @rtype: C{unicode}
+ :param mode: what agent query mode demanded
+ :type mode: ``str``
+ :returns: the agent query mode we force the broker to
+ :rtype: ``str``
"""
return None
@@ -527,8 +527,8 @@ class X2GoBroker(object):
Get the agent query mode (LOCAL or SSH, normally) that is configured for this
X2Go Session Broker instance.
- @return: agent query mode
- @rtype: C{unicode}
+ :returns: agent query mode
+ :rtype: ``str``
"""
_default_agent_query_mode = "LOCAL"
@@ -563,8 +563,8 @@ class X2GoBroker(object):
Detect if the given profile is configured to try automatic session
logons.
- @return: C{True} to denote that automatic session login should be attempted
- @rtype: C{bool}
+ :returns: ``True`` to denote that automatic session login should be attempted
+ :rtype: ``bool``
"""
_default_session_autologin = False
@@ -590,8 +590,8 @@ class X2GoBroker(object):
Detect if the given profile is configured to try portscanning on X2Go Servers
before offering an X2Go Server hostname to the client.
- @return: C{True} if X2Go Servers shall be probed before offering it to clients
- @rtype: C{bool}
+ :returns: ``True`` if X2Go Servers shall be probed before offering it to clients
+ :rtype: ``bool``
"""
_default_portscan_x2goservers = False
@@ -621,8 +621,8 @@ class X2GoBroker(object):
provide a broker-authorized-keys file in session profiles. The latter
will override the broker-wide conigured file location.
- @return: authorized_keys location on the remote server
- @rtype: C{unicode}
+ :returns: authorized_keys location on the remote server
+ :rtype: ``str``
"""
_default_authorized_keys_file = "%h/.x2go/authorized_keys"
@@ -647,8 +647,8 @@ class X2GoBroker(object):
provide a broker-authorized-keys file in session profiles. The latter
will override the broker-wide conigured file location.
- @return: authorized_keys location on the remote SSH proxy server
- @rtype: C{unicode}
+ :returns: authorized_keys location on the remote SSH proxy server
+ :rtype: ``str``
"""
_default_authorized_keys_file = "%h/.x2go/authorized_keys"
@@ -669,8 +669,8 @@ class X2GoBroker(object):
Get the name of the backend being used for retrieving user information from the
system.
- @return: user service name
- @rtype: C{unicode}
+ :returns: user service name
+ :rtype: ``str``
"""
_user_db = "libnss"
@@ -687,8 +687,8 @@ class X2GoBroker(object):
Get the name of the backend being used for retrieving group information from the
system.
- @return: group service name
- @rtype: C{unicode}
+ :returns: group service name
+ :rtype: ``str``
"""
_group_db = "libnss"
@@ -704,8 +704,8 @@ class X2GoBroker(object):
"""\
Is this broker backend configured to access an X2Go Broker LoadChecker daemon.
- @return: C{True} if there should a load checker daemon running.
- @rtype: C{bool}
+ :returns: ``True`` if there should a load checker daemon running.
+ :rtype: ``bool``
"""
_use_load_checker = False
@@ -727,11 +727,11 @@ class X2GoBroker(object):
- or on a per session profile basis?
- plus: more than one host configured for the given session profile?
- @param profile_id: choose remote agent for this profile ID
- @type profile_id: C{unicode}
+ :param profile_id: choose remote agent for this profile ID
+ :type profile_id: ``str``
- @return: C{True} if there is a load checker daemon running.
- @rtype: C{bool}
+ :returns: ``True`` if there is a load checker daemon running.
+ :rtype: ``bool``
"""
_profile_broker = self.get_profile_broker(profile_id)
@@ -769,13 +769,13 @@ class X2GoBroker(object):
def has_user(self, username):
"""\
- Test if the broker knows user C{<username>}.
+ Test if the broker knows user ``<username>``.
- @param username: test for existence of this user
- @type username: C{unicode}
+ :param username: test for existence of this user
+ :type username: ``str``
- @return: returns C{True} if a user exists
- @rtype: C{bool}
+ :returns: returns ``True`` if a user exists
+ :rtype: ``bool``
"""
if self._import_nameservice_module(service=self.get_userdb_service()):
@@ -787,8 +787,8 @@ class X2GoBroker(object):
"""\
Get list of known users.
- @return: returns list of known users
- @rtype: C{list}
+ :returns: returns list of known users
+ :rtype: ``list``
"""
if self._import_nameservice_module(service=self.get_userdb_service()):
@@ -798,13 +798,13 @@ class X2GoBroker(object):
def has_group(self, group):
"""\
- Test if the broker knows group C{<group>}.
+ Test if the broker knows group ``<group>``.
- @param group: test for existence of this group
- @type group: C{unicode}
+ :param group: test for existence of this group
+ :type group: ``str``
- @return: returns C{True} if a group exists
- @rtype: C{bool}
+ :returns: returns ``True`` if a group exists
+ :rtype: ``bool``
"""
if self._import_nameservice_module(service=self.get_groupdb_service()):
@@ -816,8 +816,8 @@ class X2GoBroker(object):
"""\
Get list of known groups.
- @return: returns list of known groups
- @rtype: C{list}
+ :returns: returns list of known groups
+ :rtype: ``list``
"""
if self._import_nameservice_module(service=self.get_groupdb_service()):
@@ -829,11 +829,11 @@ class X2GoBroker(object):
"""\
Get the primary group of a given user.
- @param username: get primary group for this username
- @type username: C{unicode}
+ :param username: get primary group for this username
+ :type username: ``str``
- @return: returns the name of the primary group
- @rtype: C{unicode}
+ :returns: returns the name of the primary group
+ :rtype: ``str``
"""
if self._import_nameservice_module(service=self.get_groupdb_service()):
@@ -845,15 +845,15 @@ class X2GoBroker(object):
"""\
Check if a user is member of a given group.
- @param username: check group membership of this user
- @type username: C{unicode}
- @param group: test if user is member of this group
- @type group: C{unicode}
- @param primary_groups: if C{True}, test for primary group membership, as well
- @type primary_groups: C{bool}
+ :param username: check group membership of this user
+ :type username: ``str``
+ :param group: test if user is member of this group
+ :type group: ``str``
+ :param primary_groups: if ``True``, test for primary group membership, as well
+ :type primary_groups: ``bool``
- @return: returns C{True} if the user is member of the given group
- @rtype: C{bool}
+ :returns: returns ``True`` if the user is member of the given group
+ :rtype: ``bool``
"""
if self._import_nameservice_module(service=self.get_groupdb_service()):
@@ -863,15 +863,15 @@ class X2GoBroker(object):
def get_group_members(self, group, primary_groups=False):
"""\
- Get the list of members in group C{<group>}.
+ Get the list of members in group ``<group>``.
- @param group: valid group name
- @type group: C{unicode}
- @param primary_groups: include primary groups found with the user db service
- @type primary_groups: C{bool}
+ :param group: valid group name
+ :type group: ``str``
+ :param primary_groups: include primary groups found with the user db service
+ :type primary_groups: ``bool``
- @return: list of users belonging to the given group
- @rtype: C{list}
+ :returns: list of users belonging to the given group
+ :rtype: ``list``
"""
if self._import_nameservice_module(service=self.get_groupdb_service()):
@@ -883,13 +883,13 @@ class X2GoBroker(object):
"""\
Get all groups a given user is member of.
- @param username: get groups for this user
- @type username: C{unicode}
- @param primary_groups: if C{True}, include the user's primary group in the group list
- @type primary_groups: C{bool}
+ :param username: get groups for this user
+ :type username: ``str``
+ :param primary_groups: if ``True``, include the user's primary group in the group list
+ :type primary_groups: ``bool``
- @return: list of groups the given user is member of
- @rtype: C{list}
+ :returns: list of groups the given user is member of
+ :rtype: ``list``
"""
if self._import_nameservice_module(service=self.get_groupdb_service()):
@@ -902,20 +902,20 @@ class X2GoBroker(object):
Check if a given user with a given password may gain access to the
X2Go session broker.
- @param username: a username known to the session broker
- @type username: C{unicode}
- @param password: a password that authenticates the user against the X2Go session broker
- @type password: C{unicode}
- @param ip: the ip address of the client
- @type ip: C{unicode}
- @param cookie: an extra (static or dynamic) authentication token
- @type cookie: C{unicode}
- @param override_password_auth: let password auth always succeed, needed for SSH broker (where SSH
+ :param username: a username known to the session broker
+ :type username: ``str``
+ :param password: a password that authenticates the user against the X2Go session broker
+ :type password: ``str``
+ :param ip: the ip address of the client
+ :type ip: ``str``
+ :param cookie: an extra (static or dynamic) authentication token
+ :type cookie: ``str``
+ :param override_password_auth: let password auth always succeed, needed for SSH broker (where SSH
handled the password (or key) based authentication
- @type override_password_auth: C{bool}
+ :type override_password_auth: ``bool``
- @return: returns C{True} if the authentication has been successful
- @rtype: C{bool},C{unicode}
+ :returns: returns ``True`` if the authentication has been successful
+ :rtype: ``bool``,``str``
"""
require_password = self.config.get_value('global', 'require-password')
@@ -1037,13 +1037,13 @@ class X2GoBroker(object):
"""\
Randomly choose a remote agent for agent query.
- @param profile_id: choose remote agent for this profile ID
- @type profile_id: C{unicode}
- @param exclude_agents: a list of remote agent dict objects to be exclude from the random choice
- @type exclude_agents: C{list}
+ :param profile_id: choose remote agent for this profile ID
+ :type profile_id: ``str``
+ :param exclude_agents: a list of remote agent dict objects to be exclude from the random choice
+ :type exclude_agents: ``list``
- @return: remote agent to use for queries for profile ID
- @rtype: C{dict}
+ :returns: remote agent to use for queries for profile ID
+ :rtype: ``dict``
"""
remote_agent = None
@@ -1117,11 +1117,11 @@ class X2GoBroker(object):
"""\
Get all remote agents.
- @param profile_id: choose remote agent for this profile ID
- @type profile_id: C{unicode}
+ :param profile_id: choose remote agent for this profile ID
+ :type profile_id: ``str``
- @return: C{list} of remote agents for the given profile ID
- @rtype: C{list}
+ :returns: ``list`` of remote agents for the given profile ID
+ :rtype: ``list``
"""
remote_agents = []
@@ -1161,11 +1161,11 @@ class X2GoBroker(object):
Detect from the session profile, if it defines a desktop sharing (shadow)
session.
- @param profile_id: ID of a valid session profile
- @type profile_id: C{unicode}
+ :param profile_id: ID of a valid session profile
+ :type profile_id: ``str``
- return: C{True} if the session profile defines a desktop sharing (shadow) session
- rtype: C{bool}
+ :returns: ``True`` if the session profile defines a desktop sharing (shadow) session
+ :rtype: ``bool``
"""
profile = self.get_profile(profile_id)
@@ -1176,11 +1176,11 @@ class X2GoBroker(object):
Detect from the session profile, if we should query the remote broker
agent for running or suspended sessions.
- @param profile_id: ID of a valid session profile
- @type profile_id: C{unicode}
+ :param profile_id: ID of a valid session profile
+ :type profile_id: ``str``
- return: C{True} if the remote broker agent should be queried for running/suspended sessions
- rtype: C{bool}
+ :returns: ``True`` if the remote broker agent should be queried for running/suspended sessions
+ :rtype: ``bool``
"""
do_check = True
@@ -1201,20 +1201,20 @@ class X2GoBroker(object):
- replace BROKER_USER by the name of the authenticated user
- test if autologin is possible
- fix rootless session profile option for non-desktop sessions
- - perform an ACL check (return C{None} if it fails)
+ - perform an ACL check (return ``None`` if it fails)
- query a remote agent (if configured) to check if we have
running / suspended sessions on the remote X2Go Server
- @param profile_id: ID of a valid session profile
- @type profile_id: C{unicode}
- @param username: prepare session profile for this (authenticated) user
- @type username: C{unicode}
- @param broker_frontend: some broker frontend (e.g. UCCS) require special treatment
+ :param profile_id: ID of a valid session profile
+ :type profile_id: ``str``
+ :param username: prepare session profile for this (authenticated) user
+ :type username: ``str``
+ :param broker_frontend: some broker frontend (e.g. UCCS) require special treatment
by this method
- @type broker_frontend: C{unicode}
+ :type broker_frontend: ``str``
- return: session profile as a dictionary (ready for sending out to a broker client)
- rtype: C{dict}
+ :returns: session profile as a dictionary (ready for sending out to a broker client)
+ :rtype: ``dict``
"""
profile = self.get_profile(profile_id)
@@ -1282,11 +1282,11 @@ class X2GoBroker(object):
"""\
Retrieve a list of available session profiles for the authenticated user.
- @param username: query session profile list for this user
- @type username: C{unicode}
+ :param username: query session profile list for this user
+ :type username: ``str``
- return: list of profile dictionaries
- rtype: C{dict}
+ :returns: list of profile dictionaries
+ :rtype: ``dict``
"""
list_of_profiles = {}
@@ -1304,13 +1304,13 @@ class X2GoBroker(object):
The X2Go server that the session is launched on is selected automatically by the X2Go session
broker.
- @param profile_id: the selected profile ID. This matches one of the dictionary keys offered by the C{list_profiles} method
- @type profile_id: C{unicode}
- @param username: specify username that this operation runs for
- @type username: C{unicode}
- @param pubkey: The broker clients may send us a public key that we may
+ :param profile_id: the selected profile ID. This matches one of the dictionary keys offered by the ``list_profiles`` method
+ :type profile_id: ``str``
+ :param username: specify username that this operation runs for
+ :type username: ``str``
+ :param pubkey: The broker clients may send us a public key that we may
temporarily install into a remote X2Go Server for non-interactive login
- @type pubkey: C{unicode}
+ :type pubkey: ``str``
"""
try:
diff --git a/x2gobroker/brokers/inifile_broker.py b/x2gobroker/brokers/inifile_broker.py
index 45f0a8c..f4c8104 100644
--- a/x2gobroker/brokers/inifile_broker.py
+++ b/x2gobroker/brokers/inifile_broker.py
@@ -18,7 +18,7 @@
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
"""\
-L{x2gobroker.brokers.inifile_broker.X2GoBroker} class - a simple X2GoBroker implementations that uses text-based config files (also supports load balancing)
+:class:`x2gobroker.brokers.inifile_broker.X2GoBroker` class - a simple X2GoBroker implementations that uses text-based config files (also supports load balancing)
"""
__NAME__ = 'x2gobroker-pylib'
@@ -42,10 +42,10 @@ class X2GoBroker(base.X2GoBroker):
def __init__(self, profile_config_file=None, profile_config_defaults=None, **kwargs):
"""\
- @param profile_config_file: path to the backend's session profile configuration (x2gobroker-sessionprofiles.conf)
- @type profile_config_file: C{unicode}
- @param profile_config_defaults: Default settings for session profile configuration parameters.
- @type profile_config_defaults: C{dict}
+ :param profile_config_file: path to the backend's session profile configuration (x2gobroker-sessionprofiles.conf)
+ :type profile_config_file: ``str``
+ :param profile_config_defaults: Default settings for session profile configuration parameters.
+ :type profile_config_defaults: ``dict``
"""
base.X2GoBroker.__init__(self, **kwargs)
diff --git a/x2gobroker/brokers/zeroconf_broker.py b/x2gobroker/brokers/zeroconf_broker.py
index 1fa8293..2d981f8 100644
--- a/x2gobroker/brokers/zeroconf_broker.py
+++ b/x2gobroker/brokers/zeroconf_broker.py
@@ -18,7 +18,7 @@
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
"""\
-L{x2gobroker.brokers.zeroconf_broker.X2GoBroker} class - a demo X2GoBroker implementations that needs not configuration at all
+:class:`x2gobroker.brokers.zeroconf_broker.X2GoBroker` class - a demo X2GoBroker implementations that needs not configuration at all
"""
__NAME__ = 'x2gobroker-pylib'
diff --git a/x2gobroker/config.py b/x2gobroker/config.py
index 16fdd6f..886a3a6 100644
--- a/x2gobroker/config.py
+++ b/x2gobroker/config.py
@@ -60,12 +60,12 @@ class X2GoBrokerConfigFile(object):
def __init__(self, config_files=[], defaults={}):
"""\
- @param config_files: a list of configuration file names (e.g. a global filename and a user's home
+ :param config_files: a list of configuration file names (e.g. a global filename and a user's home
directory filename)
- @type config_files: C{list}
- @param defaults: a cascaded Python dicitionary structure with ini file defaults (to override
+ :type config_files: ``list``
+ :param defaults: a cascaded Python dicitionary structure with ini file defaults (to override
Python X2goBroker's hard-coded defaults in L{defaults}
- @type defaults: C{dict}
+ :type defaults: ``dict``
"""
# allow string/unicode objects as config_files, as well
@@ -125,17 +125,17 @@ class X2GoBrokerConfigFile(object):
"""\
Stores a value for a given section and key.
- This methods affects a C{RawConfigParser} object held in
+ This methods affects a ``RawConfigParser`` object held in
RAM. No configuration file is affected by this
method. To write the configuration to disk use
the L{write()} method.
- @param section: the ini file section
- @type section: C{str}
- @param key: the ini file key in the given section
- @type key: C{str}
- @param value: the value for the given section and key
- @type value: C{str}, C{list}, C{booAl}, ...
+ :param section: the ini file section
+ :type section: ``str``
+ :param key: the ini file key in the given section
+ :type key: ``str``
+ :param value: the value for the given section and key
+ :type value: ``str``, ``list``, ``bool``, ...
"""
if type(value) is bool:
@@ -149,7 +149,7 @@ class X2GoBrokerConfigFile(object):
def _fill_defaults(self):
"""\
- Fills a C{RawConfigParser} object with the default config file
+ Fills a ``RawConfigParser`` object with the default config file
values as pre-defined in Python X2GoBroker or. This RawConfigParser
object is held in RAM. No configuration file is affected by this
method.
@@ -167,12 +167,12 @@ class X2GoBrokerConfigFile(object):
Change a value for a given section and key. This method
does not have any effect on configuration files.
- @param section: the ini file section
- @type section: C{str}
- @param key: the ini file key in the given section
- @type key: C{str}
- @param value: the value for the given section and key
- @type value: C{str}, C{list}, C{bool}, ...
+ :param section: the ini file section
+ :type section: ``str``
+ :param key: the ini file key in the given section
+ :type key: ``str``
+ :param value: the value for the given section and key
+ :type value: ``str``, ``list``, ``bool``, ...
"""
if not self.iniConfig.has_section(section):
@@ -184,7 +184,7 @@ class X2GoBrokerConfigFile(object):
"""\
Write the ini file modifications (RawConfigParser object) from RAM to disk.
- For writing the first of the C{config_files} specified on instance construction
+ For writing the first of the ``config_files`` specified on instance construction
that is writable will be used.
"""
@@ -199,13 +199,13 @@ class X2GoBrokerConfigFile(object):
Retrieve a value type for a given section and key. The returned
value type is based on the default values dictionary.
- @param section: the ini file section
- @type section: C{str}
- @param key: the ini file key in the given section
- @type key: C{str}
+ :param section: the ini file section
+ :type section: ``str``
+ :param key: the ini file key in the given section
+ :type key: ``str``
- @return: a Python variable type
- @rtype: class
+ :returns: a Python variable type
+ :rtype: class
"""
if section in list(self.defaultValues.keys()) and key in list(self.defaultValues[section].keys()):
@@ -218,16 +218,16 @@ class X2GoBrokerConfigFile(object):
def has_value(self, section, key):
"""\
- Test if a given C{key} in C{section} exists (and
+ Test if a given ``key`` in ``section`` exists (and
has some sort of a value).
- @param section: the ini file section
- @type section: C{str}
- @param key: the ini file key in the given section
- @type key: C{str}
+ :param section: the ini file section
+ :type section: ``str``
+ :param key: the ini file key in the given section
+ :type key: ``str``
- @return: return C{True} if <key> in <section> exists
- @rtype: C{bool}
+ :returns: return ``True`` if <key> in <section> exists
+ :rtype: ``bool``
"""
if section in self.iniConfig.sections():
@@ -238,13 +238,13 @@ class X2GoBrokerConfigFile(object):
"""\
Retrieve a value for a given section and key.
- @param section: the ini file section
- @type section: C{str}
- @param key: the ini file key in the given section
- @type key: C{str}
+ :param section: the ini file section
+ :type section: ``str``
+ :param key: the ini file key in the given section
+ :type key: ``str``
- @return: the value for the given section and key
- @rtype: class
+ :returns: the value for the given section and key
+ :rtype: class
"""
if key_type is None:
@@ -291,8 +291,8 @@ class X2GoBrokerConfigFile(object):
"""\
Get all keys and values from the [DEFAULT] section of the configuration file.
- @return: the defaults with all keys and values
- @rtype: C{dict}
+ :returns: the defaults with all keys and values
+ :rtype: ``dict``
"""
_my_defaults = {}
@@ -313,11 +313,11 @@ class X2GoBrokerConfigFile(object):
"""\
Get all keys and values for a certain section of the config file.
- @param section: the name of the section to get
- @type section: C{str}
+ :param section: the name of the section to get
+ :type section: ``str``
- @return: the section with all keys and values
- @rtype: C{dict}
+ :returns: the section with all keys and values
+ :rtype: ``dict``
"""
_section_config = {}
@@ -331,8 +331,8 @@ class X2GoBrokerConfigFile(object):
"""\
Return a list of all present sections in a config file.
- @return: list of sections in this config file
- @rtype: C{list}
+ :returns: list of sections in this config file
+ :rtype: ``list``
"""
return [ s for s in self.iniConfig.sections() ]
diff --git a/x2gobroker/loadchecker.py b/x2gobroker/loadchecker.py
index 1ee423e..71da459 100644
--- a/x2gobroker/loadchecker.py
+++ b/x2gobroker/loadchecker.py
@@ -114,15 +114,15 @@ class LoadChecker(threading.Thread):
Retrieve system load for a given server (via broker backend,
profile ID and hostname).
- @param backend: broker backend to query.
- @type backend: C{unicode}
- @param profile_id: profile ID of the session profile to query
- @type profile_id: C{unicode}
- @param hostname: hostname of the X2Go Server
- @type hostname: C{unicode}
+ :param backend: broker backend to query.
+ :type backend: ``str``
+ :param profile_id: profile ID of the session profile to query
+ :type profile_id: ``str``
+ :param hostname: hostname of the X2Go Server
+ :type hostname: ``str``
- @return: load factor of the given server (or None if an error occurs)
- @rtype: C{int}
+ :returns: load factor of the given server (or None if an error occurs)
+ :rtype: ``int``
"""
try:
@@ -135,13 +135,13 @@ class LoadChecker(threading.Thread):
Retrieve system load for all servers for a given profile ID (and a given
broker backend).
- @param backend: broker backend to query.
- @type backend: C{unicode}
- @param profile_id: profile ID of the session profile to query
- @type profile_id: C{unicode}
+ :param backend: broker backend to query.
+ :type backend: ``str``
+ :param profile_id: profile ID of the session profile to query
+ :type profile_id: ``str``
- @return: load factor of the given server (or None if an error occurs)
- @rtype: C{dict}
+ :returns: load factor of the given server (or None if an error occurs)
+ :rtype: ``dict``
"""
try:
diff --git a/x2gobroker/loggers.py b/x2gobroker/loggers.py
index 2eb86e5..82db994 100644
--- a/x2gobroker/loggers.py
+++ b/x2gobroker/loggers.py
@@ -29,8 +29,8 @@ def init_console_loggers():
"""\
Initialize loggers that log to stderr.
- @return: a 3-tuple of (logger_broker, logger_access, logger_error)
- @rtype: C{tuple}
+ :returns: a 3-tuple of (logger_broker, logger_access, logger_error)
+ :rtype: ``tuple``
"""
logger_root = logging.getLogger()
stderr_handler = logging.StreamHandler(sys.stderr)
@@ -104,10 +104,10 @@ else:
def tornado_log_request(handler):
"""\
Function for overriding the log_request method in
- C{tornado.web.RequestHandler}.
+ ``tornado.web.RequestHandler``.
- @param handler: handler
- @type handler: C{obj}
+ :param handler: handler
+ :type handler: ``obj``
"""
if handler.get_status() < 400:
diff --git a/x2gobroker/uccsjson.py b/x2gobroker/uccsjson.py
index 102cebd..7d8a08f 100644
--- a/x2gobroker/uccsjson.py
+++ b/x2gobroker/uccsjson.py
@@ -50,12 +50,12 @@ class ManagementServer():
"""\
Initializ instance.
- @param url: URL of the UCCS broker server
- @type url: C{unicode}
- @param name: human-readable, descriptive server name
- @type name: C{unicode}
- @param api_version: API version used between remote logon service and broker
- @type api_version: C{int}
+ :param url: URL of the UCCS broker server
+ :type url: ``str``
+ :param name: human-readable, descriptive server name
+ :type name: ``str``
+ :param api_version: API version used between remote logon service and broker
+ :type api_version: ``int``
"""
self._api_version = api_version
@@ -69,8 +69,8 @@ class ManagementServer():
"""\
Define the default (terminal) server instance.
- @param ts_name: name of the terminal server that is to be set as default
- @type ts_name: C{unicode}
+ :param ts_name: name of the terminal server that is to be set as default
+ :type ts_name: ``str``
"""
if isinstance(ts_name, str):
@@ -84,8 +84,8 @@ class ManagementServer():
"""\
Add a terminal server to this management server object.
- @param server: instance of class L{RDPServer} or L{X2GoServer}.
- @type server: C{obj}
+ :param server: instance of class L{RDPServer} or L{X2GoServer}.
+ :type server: ``obj``
"""
self.RemoteDesktopServers.append(server)
@@ -120,16 +120,16 @@ class RDPServer():
"""
def __init__(self, host, name, username='', password='', api_version=latest_api_version):
"""\
- @param host: hostname of RDP server host
- @type host: C{unicode}
- @param name: session profile name
- @type name: C{unicode}
- @param username: username to be used for login
- @type username: C{unicode}
- @param password: password to be used for login
- @type password: C{unicode}
- @param api_version: API version used between remote logon service and broker
- @type api_version: C{int}
+ :param host: hostname of RDP server host
+ :type host: ``str``
+ :param name: session profile name
+ :type name: ``str``
+ :param username: username to be used for login
+ :type username: ``str``
+ :param password: password to be used for login
+ :type password: ``str``
+ :param api_version: API version used between remote logon service and broker
+ :type api_version: ``int``
"""
self._api_version = api_version
@@ -144,10 +144,10 @@ class RDPServer():
"""\
Set the domain for this RDP server.
- @param domain: the domain name to be set
- @type domain: C{unicode}
+ :param domain: the domain name to be set
+ :type domain: ``str``
- @raise TypeError: domain has to be C{str} or C{unicode}
+ :raises TypeError: domain has to be ``str`` or ``str``
"""
if isinstance(domain, str):
@@ -172,16 +172,16 @@ class ICAServer():
"""
def __init__(self, host, name, username='', password='', api_version=latest_api_version):
"""\
- @param host: hostname of ICA server host
- @type host: C{unicode}
- @param name: session profile name
- @type name: C{unicode}
- @param username: username to be used for login
- @type username: C{unicode}
- @param password: password to be used for login
- @type password: C{unicode}
- @param api_version: API version used between remote logon service and broker
- @type api_version: C{int}
+ :param host: hostname of ICA server host
+ :type host: ``str``
+ :param name: session profile name
+ :type name: ``str``
+ :param username: username to be used for login
+ :type username: ``str``
+ :param password: password to be used for login
+ :type password: ``str``
+ :param api_version: API version used between remote logon service and broker
+ :type api_version: ``int``
"""
self._api_version = api_version
@@ -196,10 +196,10 @@ class ICAServer():
"""\
Set the domain for this ICA server.
- @param domain: the domain name to be set
- @type domain: C{unicode}
+ :param domain: the domain name to be set
+ :type domain: ``str``
- @raise TypeError: domain has to be C{str} or C{unicode}
+ :raises TypeError: domain has to be ``str`` or ``str``
"""
if isinstance(domain, str):
@@ -224,16 +224,16 @@ class X2GoServer():
"""
def __init__(self, host, name, username='', password='', api_version=latest_api_version):
"""\
- @param host: hostname of X2Go Server host
- @type host: C{unicode}
- @param name: session profile name
- @type name: C{unicode}
- @param username: username to be used for login
- @type username: C{unicode}
- @param password: password to be used for login
- @type password: C{unicode}
- @param api_version: API version used between remote logon service and broker
- @type api_version: C{int}
+ :param host: hostname of X2Go Server host
+ :type host: ``str``
+ :param name: session profile name
+ :type name: ``str``
+ :param username: username to be used for login
+ :type username: ``str``
+ :param password: password to be used for login
+ :type password: ``str``
+ :param api_version: API version used between remote logon service and broker
+ :type api_version: ``int``
"""
self._api_version = api_version
@@ -252,10 +252,10 @@ class X2GoServer():
"""\
Set the session_type to be used on this X2Go Server.
- @param command: the session type to be set
- @type command: C{unicode}
+ :param command: the session type to be set
+ :type command: ``str``
- @raise TypeError: command has to be C{str}
+ :raises TypeError: command has to be ``str``
"""
#FIXME: throw an exception when used with API v5 or newer
@@ -269,10 +269,10 @@ class X2GoServer():
"""\
Set the command to be used on this X2Go Server.
- @param command: the session type to be set
- @type command: C{unicode}
+ :param command: the session type to be set
+ :type command: ``str``
- @raise TypeError: command has to be C{str}
+ :raises TypeError: command has to be ``str``
"""
#FIXME: throw an exception when used with API v4
diff --git a/x2gobroker/utils.py b/x2gobroker/utils.py
index 291dd25..d665a07 100644
--- a/x2gobroker/utils.py
+++ b/x2gobroker/utils.py
@@ -30,11 +30,11 @@ def _checkConfigFileDefaults(data_structure):
"""\
Check an ini-file-like data structure.
- @param data_structure: an ini-file-like data structure
- @type data_structure: C{dict} of C{dict}s
+ :param data_structure: an ini-file-like data structure
+ :type data_structure: ``dict`` of ``dict``s
- @return: C{True} if C{data_structure} matches that of an ini file data structure
- @rtype: C{bool}
+ :returns: ``True`` if ``data_structure`` matches that of an ini file data structure
+ :rtype: ``bool``
"""
if data_structure is None:
@@ -51,10 +51,10 @@ def touch_file(filename, mode='a'):
"""\
Imitates the behaviour of the GNU/touch command.
- @param filename: name of the file to touch
- @type filename: C{str}
- @param mode: the file mode (as used for Python file objects)
- @type mode: C{str}
+ :param filename: name of the file to touch
+ :type filename: ``str``
+ :param mode: the file mode (as used for Python file objects)
+ :type mode: ``str``
"""
if not os.path.isdir(os.path.dirname(filename)):
@@ -67,8 +67,8 @@ def get_encoding():
"""\
Detect systems default character encoding.
- @return: The system's local character encoding.
- @rtype: C{str}
+ :returns: The system's local character encoding.
+ :rtype: ``str``
"""
try:
@@ -85,15 +85,15 @@ def get_encoding():
def compare_versions(version_a, op, version_b):
"""\
Compare <version_a> with <version_b> using operator <op>.
- In the background C{distutils.version.LooseVersion} is
+ In the background ``distutils.version.LooseVersion`` is
used for the comparison operation.
- @param version_a: a version string
- @type version_a: C{str}
- @param op: an operator provide as string (e.g. '<', '>', '==', '>=' etc.)
- @type op: C{str}
- @param version_b: another version string that is to be compared with <version_a>
- @type version_b: C{str}
+ :param version_a: a version string
+ :type version_a: ``str``
+ :param op: an operator provide as string (e.g. '<', '>', '==', '>=' etc.)
+ :type op: ``str``
+ :param version_b: another version string that is to be compared with <version_a>
+ :type version_b: ``str``
"""
@@ -246,11 +246,11 @@ def portscan(addr, port=22):
"""\
Performing a port scan to the requested hostname.
- @param addr: address (IPv4, IPv6 or hostname) of the host
+ :param addr: address (IPv4, IPv6 or hostname) of the host
we want to probe
- @type addr: C{unicode}
- @param port: port number (default: 22)
- @type port: C{int}
+ :type addr: ``str``
+ :param port: port number (default: 22)
+ :type port: ``int``
"""
ip_proto = 0
@@ -289,9 +289,7 @@ def get_key_fingerprint(key):
"""\
Retrieve the host key fingerprint of the server to be validated.
-
:returns: host key fingerprint
-
:rtype: ``str``
"""
@@ -302,9 +300,7 @@ def get_key_fingerprint_with_colons(key):
Retrieve the (colonized) host key fingerprint of the server
to be validated.
-
:returns: host key fingerprint (with colons)
-
:rtype: ``str``
"""
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
More information about the x2go-commits
mailing list