This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch build-main in repository python-x2go. commit 712582cc506e6daeaed1e7a37321ec18b05d5bd0 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Oct 20 10:20:40 2014 +0200 formalistic clean-up using pyflakes --- examples/x2go_resume_session.py | 3 +-- examples/x2go_start_session.py | 1 - .../x2go_start_session_with_progress_status.py | 1 - setup.py | 3 +++ x2go/backends/control/plain.py | 1 - x2go/backends/info/plain.py | 2 -- x2go/backends/printing/gconf.py | 6 +++--- x2go/backends/printing/winreg.py | 6 +++--- x2go/backends/profiles/file.py | 1 - x2go/backends/profiles/gconf.py | 7 +++++-- x2go/backends/profiles/httpbroker.py | 4 +--- x2go/backends/profiles/sshbroker.py | 11 +++++++---- x2go/backends/profiles/winreg.py | 6 ++++-- x2go/backends/settings/gconf.py | 9 +++++---- x2go/backends/settings/winreg.py | 8 +++++--- x2go/cache.py | 6 +++--- x2go/client.py | 9 --------- x2go/printqueue.py | 6 +++--- x2go/registry.py | 18 +++++++++--------- x2go/telekinesis.py | 1 - x2go/utils.py | 5 ++++- x2go/x2go_exceptions.py | 1 - 22 files changed, 56 insertions(+), 59 deletions(-) diff --git a/examples/x2go_resume_session.py b/examples/x2go_resume_session.py index 2209e2d..e6ba6ff 100644 --- a/examples/x2go_resume_session.py +++ b/examples/x2go_resume_session.py @@ -25,10 +25,9 @@ # import x2go before you import other thread based modules (e.g. paramiko) import x2go +import sys import getpass -import os,sys import gevent -import paramiko # modify to your needs... server = "server.mydomain.tld" diff --git a/examples/x2go_start_session.py b/examples/x2go_start_session.py index 958a822..f84c2ab 100644 --- a/examples/x2go_start_session.py +++ b/examples/x2go_start_session.py @@ -25,7 +25,6 @@ # import x2go before you import other thread based modules (e.g. paramiko) import x2go -import sys import gevent import getpass diff --git a/examples/x2go_start_session_with_progress_status.py b/examples/x2go_start_session_with_progress_status.py index 4cdc288..9184b36 100644 --- a/examples/x2go_start_session_with_progress_status.py +++ b/examples/x2go_start_session_with_progress_status.py @@ -25,7 +25,6 @@ # import x2go before you import other thread based modules (e.g. paramiko) import x2go -import sys import gevent import getpass import threading diff --git a/setup.py b/setup.py index 99dacf4..277729a 100755 --- a/setup.py +++ b/setup.py @@ -21,6 +21,9 @@ import os from setuptools import setup, find_packages + +# silence pyflakes, the correct __VERSION__ will be detected below... +__VERSION__ = "0.0.0.0" try: # for python3.x for line in open(os.path.join('x2go', '__init__.py'),encoding='utf-8').readlines(): diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py index 6f3b0f8..ea5b6e1 100644 --- a/x2go/backends/control/plain.py +++ b/x2go/backends/control/plain.py @@ -51,7 +51,6 @@ import x2go.defaults as defaults import x2go.checkhosts as checkhosts from x2go.defaults import BACKENDS as _BACKENDS -from x2go.defaults import CURRENT_LOCAL_USER as _current_user import x2go._paramiko x2go._paramiko.monkey_patch_paramiko() diff --git a/x2go/backends/info/plain.py b/x2go/backends/info/plain.py index 90f9f4d..b2b5438 100644 --- a/x2go/backends/info/plain.py +++ b/x2go/backends/info/plain.py @@ -32,8 +32,6 @@ __NAME__ = 'x2goserversessioninfo-pylib' import types import re -import x2go.defaults as defaults - class X2GoServerSessionInfo(object): """\ L{X2GoServerSessionInfo} is used to store all information diff --git a/x2go/backends/printing/gconf.py b/x2go/backends/printing/gconf.py index 3741c3e..88fba08 100644 --- a/x2go/backends/printing/gconf.py +++ b/x2go/backends/printing/gconf.py @@ -28,13 +28,13 @@ configuration of your X2Go client application. __NAME__ = 'x2goprint-pylib' # modules +import copy # Python X2Go modules import x2go.log as log + # we hide the default values from epydoc (that's why we transform them to _UNDERSCORE variables) from x2go.defaults import X2GO_CLIENTPRINTING_DEFAULTS as _X2GO_CLIENTPRINTING_DEFAULTS -from x2go.defaults import X2GO_PRINTING_CONFIGFILES as _X2GO_PRINTING_CONFIGFILES -import x2go.inifiles as inifiles from x2go.x2go_exceptions import X2GoNotImplementedYetException @@ -51,7 +51,7 @@ class X2GoClientPrinting(object): """ _print_action = None - defaultValues = _X2GO_CLIENTPRINTING_DEFAULTS + defaultValues = copy.deepcopy(_X2GO_CLIENTPRINTING_DEFAULTS) def __init__(self, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ diff --git a/x2go/backends/printing/winreg.py b/x2go/backends/printing/winreg.py index d0fb75d..f74c669 100644 --- a/x2go/backends/printing/winreg.py +++ b/x2go/backends/printing/winreg.py @@ -28,13 +28,13 @@ configuration of your X2Go client application. __NAME__ = 'x2goprint-pylib' # modules +import copy # Python X2Go modules import x2go.log as log + # we hide the default values from epydoc (that's why we transform them to _UNDERSCORE variables) from x2go.defaults import X2GO_CLIENTPRINTING_DEFAULTS as _X2GO_CLIENTPRINTING_DEFAULTS -from x2go.defaults import X2GO_PRINTING_CONFIGFILES as _X2GO_PRINTING_CONFIGFILES -import x2go.inifiles as inifiles from x2go.x2go_exceptions import X2GoNotImplementedYetException @@ -51,7 +51,7 @@ class X2GoClientPrinting(object): """ _print_action = None - defaultValues = _X2GO_CLIENTPRINTING_DEFAULTS + defaultValues = copy.deepcopy(_X2GO_CLIENTPRINTING_DEFAULTS) def __init__(self, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ diff --git a/x2go/backends/profiles/file.py b/x2go/backends/profiles/file.py index b604a30..0c19883 100644 --- a/x2go/backends/profiles/file.py +++ b/x2go/backends/profiles/file.py @@ -26,7 +26,6 @@ applications. """ __NAME__ = 'x2gosessionprofiles-pylib' -import types import random # Python X2Go modules diff --git a/x2go/backends/profiles/gconf.py b/x2go/backends/profiles/gconf.py index 3c3089f..85bd8c9 100644 --- a/x2go/backends/profiles/gconf.py +++ b/x2go/backends/profiles/gconf.py @@ -26,8 +26,11 @@ applications. """ __NAME__ = 'x2gosessionprofiles-pylib' +# modules +import copy + # Python X2Go modules -from x2go.defaults import X2GO_SESSIONPROFILE_DEFAULTS +from x2go.defaults import X2GO_SESSIONPROFILE_DEFAULTS as _X2GO_SESSIONPROFILE_DEFAULTS import x2go.log as log import x2go.backends.profiles.base as base @@ -35,7 +38,7 @@ from x2go.x2go_exceptions import X2GoNotImplementedYetException class X2GoSessionProfiles(base.X2GoSessionProfiles): - defaultSessionProfile = X2GO_SESSIONPROFILE_DEFAULTS + defaultSessionProfile = copy.deepcopy(_X2GO_SESSIONPROFILE_DEFAULTS) _non_profile_sections = ('embedded') def __init__(self, session_profile_defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): diff --git a/x2go/backends/profiles/httpbroker.py b/x2go/backends/profiles/httpbroker.py index e27f2ab..2e17e40 100644 --- a/x2go/backends/profiles/httpbroker.py +++ b/x2go/backends/profiles/httpbroker.py @@ -43,11 +43,9 @@ import x2go.log as log from x2go.utils import genkeypair import x2go.x2go_exceptions -from x2go.x2go_exceptions import X2GoNotImplementedYetException - class X2GoSessionProfiles(base.X2GoSessionProfiles): - defaultSessionProfile = _X2GO_SESSIONPROFILE_DEFAULTS + defaultSessionProfile = copy.deepcopy(_X2GO_SESSIONPROFILE_DEFAULTS) def __init__(self, session_profile_defaults=None, broker_url="http://localhost:8080/json/", diff --git a/x2go/backends/profiles/sshbroker.py b/x2go/backends/profiles/sshbroker.py index d5e8b70..11fbbef 100644 --- a/x2go/backends/profiles/sshbroker.py +++ b/x2go/backends/profiles/sshbroker.py @@ -26,20 +26,23 @@ applications. """ __NAME__ = 'x2gosessionprofiles-pylib' +# modules +import copy + # Python X2Go modules -from x2go.defaults import X2GO_SESSIONPROFILES_CONFIGFILES -from x2go.defaults import X2GO_SESSIONPROFILE_DEFAULTS import x2go.backends.profiles.base as base import x2go.log as log +from x2go.defaults import X2GO_SESSIONPROFILE_DEFAULTS as _X2GO_SESSIONPROFILE_DEFAULTS + from x2go.x2go_exceptions import X2GoNotImplementedYetException class X2GoSessionProfiles(base.X2GoSessionProfiles): - defaultSessionProfile = X2GO_SESSIONPROFILE_DEFAULTS + defaultSessionProfile = copy.deepcopy(_X2GO_SESSIONPROFILE_DEFAULTS) _non_profile_sections = ('embedded') - def __init__(self, session_profile_defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, session_profile_defaults=_X2GO_SESSIONPROFILE_DEFAULTS, logger=None, loglevel=log.loglevel_DEFAULT): """\ Retrieve X2Go session profiles from a SSH session broker. diff --git a/x2go/backends/profiles/winreg.py b/x2go/backends/profiles/winreg.py index 8cd9c54..95bc532 100644 --- a/x2go/backends/profiles/winreg.py +++ b/x2go/backends/profiles/winreg.py @@ -26,6 +26,9 @@ applications. """ __NAME__ = 'x2gosessionprofiles-pylib' +# modules +import copy + # Python X2Go modules from x2go.defaults import X2GO_SESSIONPROFILE_DEFAULTS import x2go.backends.profiles.base as base @@ -35,7 +38,7 @@ from x2go.x2go_exceptions import X2GoNotImplementedYetException class X2GoSessionProfilesWINREG(base.X2GoSessionProfiles): - defaultSessionProfile = X2GO_SESSIONPROFILE_DEFAULTS + defaultSessionProfile = copy.deepcopy(X2GO_SESSIONPROFILE_DEFAULTS) _non_profile_sections = ('embedded') def __init__(self, session_profile_defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): @@ -53,4 +56,3 @@ class X2GoSessionProfilesWINREG(base.X2GoSessionProfiles): """ raise X2GoNotImplementedYetException('WINREG backend support is not implemented yet') - diff --git a/x2go/backends/settings/gconf.py b/x2go/backends/settings/gconf.py index 379b409..39d31d4 100644 --- a/x2go/backends/settings/gconf.py +++ b/x2go/backends/settings/gconf.py @@ -28,11 +28,12 @@ in your Python X2Go based applications to access the """ __NAME__ = 'x2gosettings-pylib' +# modules +import copy + # Python X2Go modules import x2go.log as log -from x2go.defaults import X2GO_SETTINGS_CONFIGFILES as _X2GO_SETTINGS_CONFIGFILES from x2go.defaults import X2GO_CLIENTSETTINGS_DEFAULTS as _X2GO_CLIENTSETTINGS_DEFAULTS -import x2go.inifiles as inifiles from x2go.x2go_exceptions import X2GoNotImplementedYetException @@ -41,9 +42,9 @@ class X2GoClientSettings(object): Configure settings for L{X2GoClient} instances with the GConf daemon. """ - defaultValues = _X2GO_CLIENTSETTINGS_DEFAULTS + defaultValues = copy.deepcopy(_X2GO_CLIENTSETTINGS_DEFAULTS) - def __init__(self, config_files=_X2GO_SETTINGS_CONFIGFILES, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, defaults=_X2GO_CLIENTSETTINGS_DEFAULTS, logger=None, loglevel=log.loglevel_DEFAULT): """\ Constructs an L{X2GoClientSettings} instance. This is normally done from within an L{X2GoClient} instance. You can retrieve this L{X2GoClientSettings} instance with the L{X2GoClient.get_client_settings()} diff --git a/x2go/backends/settings/winreg.py b/x2go/backends/settings/winreg.py index 877d2b3..61eb18d 100644 --- a/x2go/backends/settings/winreg.py +++ b/x2go/backends/settings/winreg.py @@ -28,9 +28,11 @@ in your Python X2Go based applications to access the """ __NAME__ = 'x2gosettings-pylib' +# modules +import copy + # Python X2Go modules import x2go.log as log -from x2go.defaults import X2GO_SETTINGS_CONFIGFILES as _X2GO_SETTINGS_CONFIGFILES from x2go.defaults import X2GO_CLIENTSETTINGS_DEFAULTS as _X2GO_CLIENTSETTINGS_DEFAULTS import x2go.inifiles as inifiles @@ -41,9 +43,9 @@ class X2GoClientSettings(inifiles.X2GoIniFile): Windows registry based settings for L{X2GoClient} instances. """ - defaultValues = _X2GO_CLIENTSETTINGS_DEFAULTS + defaultValues = copy.deepcopy(_X2GO_CLIENTSETTINGS_DEFAULTS) - def __init__(self, config_files=_X2GO_SETTINGS_CONFIGFILES, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, defaults=_X2GO_CLIENTSETTINGS_DEFAULTS, logger=None, loglevel=log.loglevel_DEFAULT): """\ Constructs an L{X2GoClientSettings} instance. This is normally done from within an L{X2GoClient} instance. You can retrieve this L{X2GoClientSettings} instance with the L{X2GoClient.get_client_settings()} diff --git a/x2go/cache.py b/x2go/cache.py index 78fb0f4..609da1c 100644 --- a/x2go/cache.py +++ b/x2go/cache.py @@ -160,7 +160,7 @@ class X2GoListSessionsCache(object): if profile_name in self.x2go_listsessions_cache.keys(): del self.x2go_listsessions_cache[profile_name] self.protected = False - raise x2go_exceptions.X2GoControlSessionException + raise x2go_exceptions.X2GoControlSessionException(str(e)) except x2go_exceptions.X2GoTimeOutException: pass except KeyError: @@ -184,7 +184,7 @@ class X2GoListSessionsCache(object): if profile_name in self.x2go_listsessions_cache.keys(): del self.x2go_listsessions_cache[profile_name] self.protected = False - raise x2go_exceptions.X2GoControlSessionException + raise x2go_exceptions.X2GoControlSessionException(str(e)) except x2go_exceptions.X2GoTimeOutException: pass except KeyError: @@ -206,7 +206,7 @@ class X2GoListSessionsCache(object): if profile_name in self.x2go_listsessions_cache.keys(): del self.x2go_listsessions_cache[profile_name] self.protected = False - raise x2go_exceptions.X2GoControlSessionException + raise x2go_exceptions.X2GoControlSessionException(str(e)) except KeyError: pass diff --git a/x2go/client.py b/x2go/client.py index 7ec8825..d76e46c 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -146,14 +146,6 @@ from defaults import PUBAPP_MAX_NO_SUBMENUS as _PUBAPP_MAX_NO_SUBMENUS from defaults import BACKENDS as _BACKENDS -import x2go.backends.control as control -import x2go.backends.terminal as terminal -import x2go.backends.info as info -import x2go.backends.proxy as proxy -import x2go.backends.profiles as profiles -import x2go.backends.settings as settings -import x2go.backends.printing as printing - if _X2GOCLIENT_OS == 'Windows': from xserver import X2GoClientXConfig, X2GoXServer from pulseaudio import X2GoPulseAudio @@ -1546,7 +1538,6 @@ class X2GoClient(object): _desktop = '%s@%s' % (user, display) if not _desktop in self._X2GoClient__list_desktops(session_uuid): - _orig_desktop = _desktop _desktop = '%s.0' % _desktop return self.session_registry(session_uuid).share_desktop(desktop=_desktop, share_mode=share_mode, check_desktop_list=check_desktop_list, **sessionopts) diff --git a/x2go/printqueue.py b/x2go/printqueue.py index 3971cc9..f8a41d2 100644 --- a/x2go/printqueue.py +++ b/x2go/printqueue.py @@ -148,14 +148,14 @@ class X2GoPrintQueue(threading.Thread): job_files = [ jf for jf in l if jf.endswith('.ready') ] jobs = [] for _job_file in job_files: - j = open(os.path.join(self.spool_dir, _job_file), 'r') - content = j.read() + _job_file_handle = open(os.path.join(self.spool_dir, _job_file), 'r') + content = _job_file_handle.read() try: (pdf_filename, job_title) = content.split('\n')[0:2] except ValueError: pdf_filename = content job_title = 'X2Go Print Job' - j.close() + _job_file_handle.close() jobs.append((_job_file, pdf_filename, job_title)) return [ j for j in jobs if j[1] not in self.active_jobs.keys() ] else: diff --git a/x2go/registry.py b/x2go/registry.py index 1625dbd..2b181cd 100644 --- a/x2go/registry.py +++ b/x2go/registry.py @@ -659,21 +659,21 @@ class X2GoSessionRegistry(object): sessions = [ ts for ts in self.registry.values() if eval('ts.%s' % state) ] if return_profile_names: profile_names = [] - for session in sessions: - if session.profile_name not in profile_names: - profile_names.append(session.profile_name) + for this_session in sessions: + if this_session.profile_name not in profile_names: + profile_names.append(this_session.profile_name) return profile_names elif return_profile_ids: profile_ids = [] - for session in sessions: - if session.profile_id not in profile_ids: - profile_ids.append(session.profile_id) + for this_session in sessions: + if this_session.profile_id not in profile_ids: + profile_ids.append(this_session.profile_id) return profile_ids elif return_session_names: session_names = [] - for session in sessions: - if session.session_name not in session_names: - session_names.append(session.session_name) + for this_session in sessions: + if this_session.session_name not in session_names: + session_names.append(this_session.session_name) return session_names elif return_objects: return sessions diff --git a/x2go/telekinesis.py b/x2go/telekinesis.py index bd3e751..684f18e 100644 --- a/x2go/telekinesis.py +++ b/x2go/telekinesis.py @@ -41,7 +41,6 @@ if _X2GOCLIENT_OS in ("Windows"): import subprocess else: import x2go.gevent_subprocess as subprocess - from x2go.x2go_exceptions import WindowsError from x2go.defaults import LOCAL_HOME as _LOCAL_HOME from x2go.defaults import X2GO_SESSIONS_ROOTDIR as _X2GO_SESSIONS_ROOTDIR diff --git a/x2go/utils.py b/x2go/utils.py index 7196271..8ac3c8a 100644 --- a/x2go/utils.py +++ b/x2go/utils.py @@ -44,6 +44,8 @@ from defaults import pack_methods_nx3 from defaults import BACKENDS as _BACKENDS +import x2go_exceptions + if _X2GOCLIENT_OS != 'Windows': import Xlib from defaults import X_DISPLAY as _X_DISPLAY @@ -828,6 +830,8 @@ class ProgressStatus(object): raise StopIteration def _get_backend_class(backend, class_name): + # silence pyflakes, the _this_class var will be assigned in an exec() statement below... + _this_class = None if type(backend) not in (types.StringType, types.UnicodeType): return backend backend = backend.upper() available_backends = [ k for k in _BACKENDS[class_name].keys() if k != 'default' ] @@ -853,7 +857,6 @@ def genkeypair(local_username, client_address, key_type='RSA'): """ key = None pubkey = None - privkey = None # generate key pair if unicode(key_type) == u'RSA': diff --git a/x2go/x2go_exceptions.py b/x2go/x2go_exceptions.py index 4943996..61f21e4 100644 --- a/x2go/x2go_exceptions.py +++ b/x2go/x2go_exceptions.py @@ -67,7 +67,6 @@ class X2GoSSHProxyException(_X2GoException): pass class X2GoSSHProxyAuthenticationException(_X2GoException): pass class X2GoNotImplementedYetException(_X2GoException): pass class X2GoDesktopSharingDenied(_X2GoException): pass -class X2GoDesktopSharingDenied(_X2GoException): pass class X2GoTimeOutException(_X2GoException): pass class X2GoBrokerConnectionException(_X2GoException): pass class X2GoTelekinesisClientException(_X2GoException): pass -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/python-x2go.git