[prev in list] [next in list] [prev in thread] [next in thread]
List: gump-commits
Subject: svn commit: r1883919 [2/3] - in /gump/branches/python3: python/gump/actor/document/ python/gump/acto
From: ajack () apache ! org
Date: 2020-11-29 0:59:45
Message-ID: 20201129005946.1A37517A681 () svn01-us-east ! apache ! org
[Download RAW message or body]
Modified: gump/branches/python3/python/gump/core/model/project.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/project.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/project.py (original)
+++ gump/branches/python3/python/gump/core/model/project.py Sun Nov 29 00:59:43 2020
@@ -43,6 +43,7 @@ from gump.util import getIndent, getStri
from gump.util.domutils import transferDomInfo, hasDomAttribute, \
getDomAttributeValue, getDomTextValue, getDomChildIterator
from gump.util.note import transferAnnotations
+from functools import reduce
class Project(NamedModelObject, Statable, Resultable, Dependable, Positioned):
""" A Single project """
@@ -131,6 +132,12 @@ class Project(NamedModelObject, Statable
Dependable.__del__(self)
Positioned.__del__(self)
+ def __lt__(self, other):
+ return self.name < other.name # TEMPORARY
+
+ def __gt__(self, other):
+ return self.name > other.name # TEMPORARY
+
def hasNotifys(self):
"""
Does this project have any notification addresses, and if not
@@ -311,12 +318,12 @@ class Project(NamedModelObject, Statable
def getOutputs(self):
self.expand_outputs()
- return reduce(lambda l1, l2: l1 + l2, self.outputs.itervalues(), [])
+ return reduce(lambda l1, l2: l1 + l2, iter(self.outputs.values()), [])
def expand_outputs(self):
""" expands glob patterns in output names """
if (self.built or not self.hasBuilder()) and not self.outputs_expanded:
- for l in self.outputs.itervalues():
+ for l in self.outputs.values():
for output in l:
path = output.getPath()
log.debug("glob expanding " + path)
@@ -841,13 +848,12 @@ class Project(NamedModelObject, Statable
def setModule(self, module):
if self.module:
- raise RuntimeError, \
- 'Project [' + self.name + '] already has a module set'
+ raise RuntimeError('Project [' + self.name + '] already has a module \
set') self.module = module
def getModule(self):
if not self.inModule():
- raise RuntimeError, 'Project [' + self.name + '] not in a module.]'
+ raise RuntimeError('Project [' + self.name + '] not in a module.]')
return self.module
def getWorkspace(self):
@@ -896,7 +902,7 @@ class Project(NamedModelObject, Statable
self.languageType = Project.LANGUAGE_MAP[lang]
except:
message = 'Language %s not in supported %s.' \
- % (lang, Project.LANGUAGE_MAP.keys())
+ % (lang, list(Project.LANGUAGE_MAP.keys()))
self.addWarning(message)
log.warning(message)
@@ -971,7 +977,7 @@ class Project(NamedModelObject, Statable
self.addOutput(output)
# ensure id is unique per output type
- for output_type in self.outputs.keys():
+ for output_type in list(self.outputs.keys()):
d = {}
remove = []
for o in self.outputs[output_type]:
Modified: gump/branches/python3/python/gump/core/model/propagation.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/propagation.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/propagation.py (original)
+++ gump/branches/python3/python/gump/core/model/propagation.py Sun Nov 29 00:59:43 \
2020 @@ -19,7 +19,6 @@
"""
from time import localtime, strftime, tzname
-from string import lower, capitalize
from gump.core.model.state import *
from gump.util.work import *
@@ -61,11 +60,11 @@ class Propogatable(Stateful):
# Describe the problem
if not message:
- message = lower(stateDescription(state))
+ message = stateDescription(state).lower()
if not REASON_UNSET == reason:
- message += " with reason " + \
lower(reasonDescription(reason)) + message += " with reason \
" + reasonDescription(reason).lower() if isinstance(self,Workable):
- self.addInfo(capitalize(message))
+ self.addInfo(message.capitalize())
# Send on the changes...
self.propagateErrorStateChange(state,reason,cause,message)
Modified: gump/branches/python3/python/gump/core/model/property.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/property.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/property.py (original)
+++ gump/branches/python3/python/gump/core/model/property.py Sun Nov 29 00:59:43 2020
@@ -27,7 +27,6 @@ from gump.util import getIndent
from gump.util.domutils import getDomChildIterator, getDomAttributeValue, \
hasDomAttribute
from gump.util.owner import Ownable
-from types import NoneType
# represents a <property/> element
class Property(NamedModelObject):
@@ -181,7 +180,7 @@ class Property(NamedModelObject):
#
# Do we have a value yet?
#
- if not blankOk and isinstance(self.value, NoneType):
+ if not blankOk and self.value is not None:
responsibleParty.addError('Unhandled Property: ' \
+ self.getName() + ' on: ' \
+ str(parent))
@@ -251,7 +250,7 @@ class PropertySet(Ownable):
"""
Get a list of all the property objects
"""
- return self.properties.values()
+ return list(self.properties.values())
def importProperty(self, pdom):
"""
Modified: gump/branches/python3/python/gump/core/model/repository.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/repository.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/repository.py (original)
+++ gump/branches/python3/python/gump/core/model/repository.py Sun Nov 29 00:59:43 \
2020 @@ -69,7 +69,7 @@ class Repository(NamedModelObject, Stata
typeAttribute = self.getDomAttributeValue('type')
self.scmType = scm_type_for_name(typeAttribute)
if not self.scmType:
- raise RuntimeError, 'Invalid Repository Type:' + str(typeAttribute)
+ raise RuntimeError('Invalid Repository Type:' + str(typeAttribute))
if SCM_TYPE_CVS == self.scmType:
self.web = self.getDomChildValue('web') or \
@@ -82,22 +82,22 @@ class Repository(NamedModelObject, Stata
self.path = getDomChildValue(root, 'path')
self.hostname = getDomChildValue(root, 'hostname')
else:
- raise RuntimeError, 'No XML <root on repository: ' \
- + self.getName()
+ raise RuntimeError('No XML <root on repository: ' \
+ + self.getName())
elif SCM_TYPE_P4 == self.scmType:
if self.hasDomChild('root'):
root = self.getDomChild('root')
self.p4port = getDomChildValue(root, 'hostname')
else:
- raise RuntimeError, 'No Perforce server on P4 repository: ' \
- + self.getName()
+ raise RuntimeError('No Perforce server on P4 repository: ' \
+ + self.getName())
self.web = self.getDomChildValue('web')
else:
if self.hasDomChild('url'):
self.url = self.getDomChildValue('url')
else:
- raise RuntimeError, 'No URL on ' + self.scmType.displayName + \
- ' repository: ' + self.getName()
+ raise RuntimeError('No URL on ' + self.scmType.displayName + \
+ ' repository: ' + self.getName())
self.web = self.getDomChildValue('web')
self.user = self.getDomChildValue('user')
self.password = self.getDomChildValue('password')
@@ -105,6 +105,10 @@ class Repository(NamedModelObject, Stata
# Modules referencing this repository
self.modules = []
+ def __lt__(self, other):
+ return self.name < other.name # TEMPORARY
+
+
def complete(self, workspace):
pass
Modified: gump/branches/python3/python/gump/core/model/server.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/server.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/server.py (original)
+++ gump/branches/python3/python/gump/core/model/server.py Sun Nov 29 00:59:43 2020
@@ -33,6 +33,9 @@ class Server(NamedModelObject):
NamedModelObject.__init__(self,name,dom,workspace)
self.resolver=None
+
+ def __lt__(self, other):
+ return self.name < other.name # TEMPORARY
def complete(self,workspace):
Modified: gump/branches/python3/python/gump/core/model/stats.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/stats.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/stats.py (original)
+++ gump/branches/python3/python/gump/core/model/stats.py Sun Nov 29 00:59:43 2020
@@ -48,6 +48,14 @@ class Statistics:
self.startOfState=None
self.sequenceInState=0
+ def __del__(self):
+ self.name=None
+ self.first=None
+ self.last=None
+ self.currentState=None
+ self.previousState=None
+ self.startOfState=None
+
# FOG is (at present) effectively the
# 'odds of success' (based off historical results).
@@ -142,6 +150,9 @@ class Statistics:
class Statable:
def __init__(self): pass
+ def __del__(self):
+ self.stats=None
+
# Stats are loaded separately and cached on here,
# hence they may exist on an object at all times.
def hasStats(self):
@@ -152,8 +163,8 @@ class Statable:
def getStats(self):
if not self.hasStats():
- raise RuntimeError, "Statistics not calculated/updated/available [yet]: \
" \
- + self.getName()
+ raise RuntimeError("Statistics not calculated/updated/available [yet]: " \
\ + + self.getName())
return self.stats
Modified: gump/branches/python3/python/gump/core/model/workspace.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/model/workspace.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/model/workspace.py (original)
+++ gump/branches/python3/python/gump/core/model/workspace.py Sun Nov 29 00:59:43 \
2020 @@ -19,7 +19,6 @@
"""
from time import localtime, strftime, tzname
-from string import lower, capitalize
from gump.util.work import *
from gump.util.tools import *
@@ -140,26 +139,26 @@ class Workspace(NamedModelObject, Proper
# Repository Interface
def hasRepository(self,rname):
- return self.repositories.has_key(rname)
+ return rname in self.repositories
def getRepository(self,rname):
return self.repositories[rname]
def getRepositories(self):
- return self.repositories.values()
+ return list(self.repositories.values())
def getSortedRepositories(self):
return self.sortedRepositories
# Server Interface
def hasServer(self,rname):
- return self.servers.has_key(rname)
+ return rname in self.servers
def getServer(self,rname):
return self.servers[rname]
def getServers(self):
- return self.servers.values()
+ return list(self.servers.values())
def getPythonServers(self):
"""
@@ -179,44 +178,44 @@ class Workspace(NamedModelObject, Proper
# Tracker Interface
def hasTracker(self,rname):
- return self.trackers.has_key(rname)
+ return rname in self.trackers
def getTracker(self,rname):
return self.trackers[rname]
def getTrackers(self):
- return self.trackers.values()
+ return list(self.trackers.values())
def getSortedTrackers(self):
return self.sortedTrackers
# Profile Interface
def hasProfile(self,mname):
- return self.profiles.has_key(mname)
+ return mname in self.profiles
def getProfile(self,mname):
return self.profiles.get(mname,None)
def getProfiles(self):
- return self.profiles.values()
+ return list(self.profiles.values())
def getSortedProfiles(self):
return self.sortedProfiles
# Module Interface
def hasModule(self,mname):
- return self.modules.has_key(mname)
+ return mname in self.modules
def addModule(self,module):
if self.hasModule(name):
- raise RuntimeError, 'Attempt to add duplicate module: ' + name
+ raise RuntimeError('Attempt to add duplicate module: ' + name)
self.modules[module.getName()]=module
def getModule(self,mname):
return self.modules.get(mname,None)
def getModules(self):
- return self.modules.values()
+ return list(self.modules.values())
def getSortedModules(self):
return self.sortedModules
@@ -225,19 +224,19 @@ class Workspace(NamedModelObject, Proper
# through the owning modules)
def hasProject(self,pname):
- return self.projects.has_key(pname)
+ return pname in self.projects
def addProject(self,project):
name=project.getName()
if self.hasProject(name):
- raise RuntimeError, 'Attempt to add duplicate project: ' + name
+ raise RuntimeError('Attempt to add duplicate project: ' + name)
self.projects[name]=project
def getProject(self,pname):
return self.projects[pname]
def getProjects(self):
- return self.projects.values()
+ return list(self.projects.values())
def getSortedProjects(self):
return self.sortedProjects
@@ -306,7 +305,7 @@ class Workspace(NamedModelObject, Proper
'banner-link' :'bannerLink'})
if not self.basedir:
- raise RuntimeError, "A workspace cannot operate without a 'basedir'."
+ raise RuntimeError("A workspace cannot operate without a 'basedir'.")
if not self.tmpdir: self.tmpdir=os.path.join(self.getBaseDirectory(),"tmp")
if not self.logdir: self.logdir=os.path.join(self.getBaseDirectory(),"log")
@@ -324,19 +323,19 @@ class Workspace(NamedModelObject, Proper
PropertyContainer.importProperties(self,self.element)
# Complete all profiles
- for profile in self.profiles.values():
+ for profile in list(self.profiles.values()):
profile.complete(self)
# Complete all repositories
- for repository in self.repositories.values():
+ for repository in list(self.repositories.values()):
repository.complete(self)
# Complete all servers
- for server in self.servers.values():
+ for server in list(self.servers.values()):
server.complete(self)
# Complete all trackers
- for tracker in self.trackers.values():
+ for tracker in list(self.trackers.values()):
tracker.complete(self)
# Complete the modules
@@ -444,7 +443,7 @@ class Workspace(NamedModelObject, Proper
output.write('Workspace : \n')
NamedModelObject.dump(self, indent+1, output)
- for profile in self.profiles.values():
+ for profile in list(self.profiles.values()):
profile.dump(indent+2,output)
for module in self.getModules():
@@ -453,7 +452,7 @@ class Workspace(NamedModelObject, Proper
for project in self.getProjects():
project.dump(indent+2,output)
- for repo in self.repositories.values():
+ for repo in list(self.repositories.values()):
repo.dump(indent+2,output)
for server in self.getServers():
Modified: gump/branches/python3/python/gump/core/run/actor.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/run/actor.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/run/actor.py (original)
+++ gump/branches/python3/python/gump/core/run/actor.py Sun Nov 29 00:59:43 2020
@@ -133,7 +133,7 @@ class AbstractRunActor(RunActor):
"""
if not hasattr(self,'processRun'): return
if not callable(self.processRun): return
- self.log.debug('Process Run using [' + `self` + ']')
+ self.log.debug('Process Run using [' + repr(self) + ']')
self.processRun()
@@ -144,7 +144,7 @@ class AbstractRunActor(RunActor):
"""
if not hasattr(self,'processWorkspace'): return
if not callable(self.processWorkspace): return
- self.log.debug('Process Workspace [' + `workspace` + '] using [' + `self` + \
']') + self.log.debug('Process Workspace [' + repr(workspace) + '] \
using [' + repr(self) + ']') self.processWorkspace()
def _processModule(self,module):
@@ -154,7 +154,7 @@ class AbstractRunActor(RunActor):
"""
if not hasattr(self,'processModule'): return
if not callable(self.processModule): return
- self.log.debug('Process Module [' + `module` + '] using [' + `self` + ']') \
+ self.log.debug('Process Module [' + repr(module) + '] using [' + repr(self) \
+ ']') self.processModule(module)
@@ -168,10 +168,10 @@ class AbstractRunActor(RunActor):
# Hack for bad data.
if project.inModule():
- self.log.debug('Process Project [' + `project` + '] using [' + `self` + \
']') + self.log.debug('Process Project [' + repr(project) + '] \
using [' + repr(self) + ']') self.processProject(project)
else:
- self.log.debug('Skip Project (not in module) [' + `project` + '] for [' \
+ `self` + ']') + self.log.debug('Skip Project (not in module) [' \
+ repr(project) + '] for [' + repr(self) + ']')
def _processOtherEvent(self,event):
"""
@@ -180,5 +180,5 @@ class AbstractRunActor(RunActor):
"""
if not hasattr(self,'processOtherEvent'): return
if not callable(self.processOtherEvent): return
- self.log.debug('Process (Other) Event [' + `event` + '] using [' + `self` + \
']') + self.log.debug('Process (Other) Event [' + repr(event) + '] \
using [' + repr(self) + ']') self.processOtherEvent(event)
Modified: gump/branches/python3/python/gump/core/run/gumpenv.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/run/gumpenv.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/run/gumpenv.py (original)
+++ gump/branches/python3/python/gump/core/run/gumpenv.py Sun Nov 29 00:59:43 2020
@@ -29,7 +29,6 @@
import os.path
import sys
-from types import NoneType
from gump.core.config import dir, EXIT_CODE_BAD_ENVIRONMENT, \
EXIT_CODE_MISSING_UTILITY, time
@@ -126,19 +125,19 @@ class GumpEnvironment(Annotatable, Worka
self.gumpHome = os.environ['GUMP_HOME']
# JAVA_CMD can be set (perhaps for JRE verse JDK)
- if os.environ.has_key('JAVA_CMD'):
+ if 'JAVA_CMD' in os.environ:
self.javaCommand = os.environ['JAVA_CMD']
self.addInfo('JAVA_CMD environmental variable setting java' + \
' command to ' + self.javaCommand )
# JAVAC_CMD can be set (perhaps for JRE verse JDK)
- if os.environ.has_key('JAVAC_CMD'):
+ if 'JAVAC_CMD' in os.environ:
self.javacCommand = os.environ['JAVAC_CMD']
self.addInfo('javaCommand environmental variable setting javac' + \
' command to ' + self.javacCommand )
else:
# Default to $JAVA_HOME/bin/java, can be overridden with $JAVA_CMD.
- if os.environ.has_key('JAVA_HOME'):
+ if 'JAVA_HOME' in os.environ:
self.javaCommand = os.path.join(os.environ['JAVA_HOME'],
'bin', self.javaCommand)
self.addInfo('javaCommand set to $JAVA_HOME/bin/java = ' + \
@@ -146,7 +145,7 @@ class GumpEnvironment(Annotatable, Worka
self._checkEnvVariable('JAVA_HOME')
- if os.environ.has_key('JAVA_HOME'):
+ if 'JAVA_HOME' in os.environ:
self.javaHome = os.environ['JAVA_HOME']
self.addInfo('JAVA_HOME environmental variable setting java' + \
' home to ' + self.javaHome )
@@ -277,7 +276,7 @@ class GumpEnvironment(Annotatable, Worka
primarily so we can log/display them (for user review).
"""
- if not isinstance(self.javaProperties, NoneType):
+ if self.javaProperties is not None:
return self.javaProperties
# Ensure we've determined the Java Compiler to use
@@ -288,7 +287,7 @@ class GumpEnvironment(Annotatable, Worka
"Environment was not found")
return {}
- import commands, re
+ import subprocess, re
JAVA_SOURCE = dir.tmp + '/sysprop.java'
@@ -312,13 +311,13 @@ class GumpEnvironment(Annotatable, Worka
os.unlink(JAVA_SOURCE)
cmd = self.javaCommand + ' -cp ' + dir.tmp + ' sysprop'
- result = commands.getoutput(cmd)
+ result = subprocess.getoutput(cmd)
self.javaProperties = dict(re.findall('(.*?): (.*)', result))
JAVA_CLASS = JAVA_SOURCE.replace('.java', '.class')
if os.path.exists(JAVA_CLASS):
os.unlink(JAVA_CLASS)
- for (name, value) in self.javaProperties.items():
+ for (name, value) in list(self.javaProperties.items()):
self.log.debug("Java Property: " + name + " = > " + value)
return self.javaProperties
@@ -350,7 +349,7 @@ class GumpEnvironment(Annotatable, Worka
options,
name)
if cmd_env:
- for env_key in cmd_env.keys():
+ for env_key in list(cmd_env.keys()):
cmd.addEnvironment(env_key, cmd_env[env_key])
result = execute(cmd)
@@ -360,7 +359,7 @@ class GumpEnvironment(Annotatable, Worka
else:
self.log.warning('Failed to detect [' + exe + ' ' + \
options + ']')
- except Exception, details:
+ except Exception as details:
ok = False
self.log.error('Failed to detect [' + exe + ' ' + options + \
'] : ' + str(details))
@@ -370,10 +369,10 @@ class GumpEnvironment(Annotatable, Worka
self.performedWork(CommandWorkItem(WORK_TYPE_CHECK, cmd, result))
if not ok and mandatory:
- print
- print "Unable to detect/test mandatory [" + exe + "] in path:"
+ print()
+ print("Unable to detect/test mandatory [" + exe + "] in path:")
for p in sys.path:
- print " " + str(os.path.abspath(p))
+ print(" " + str(os.path.abspath(p)))
sys.exit(EXIT_CODE_MISSING_UTILITY)
# Store the output
@@ -389,25 +388,25 @@ class GumpEnvironment(Annotatable, Worka
"""
ok = False
try:
- ok = os.environ.has_key(envvar)
+ ok = envvar in os.environ
if not ok:
self.log.info('Failed to find environment variable [' + \
envvar + ']')
- except Exception, details:
+ except Exception as details:
ok = False
self.log.error('Failed to find environment variable [' + envvar + \
'] : ' + str(details))
if not ok and mandatory:
- print
- print "Unable to find mandatory [" + envvar + "] in environment:"
- for e in os.environ.keys():
+ print()
+ print("Unable to find mandatory [" + envvar + "] in environment:")
+ for e in list(os.environ.keys()):
try:
v = os.environ[e]
- print " " + e + " = " + v
+ print(" " + e + " = " + v)
except:
- print " " + e
+ print(" " + e)
sys.exit(EXIT_CODE_BAD_ENVIRONMENT)
return ok
Modified: gump/branches/python3/python/gump/core/run/gumprun.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/run/gumprun.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/run/gumprun.py (original)
+++ gump/branches/python3/python/gump/core/run/gumprun.py Sun Nov 29 00:59:43 2020
@@ -98,13 +98,13 @@ class GumpRun(gump.util.timing.Timeable,
self.outputsRepository=ArtifactRepository(workspace.repodir)
# Generate a GUID (or close)
- import md5
+ import hashlib
import socket
- m=md5.new()
+ m=hashlib.md5()
self.guid = socket.getfqdn() + ':' + workspace.getName() + ':' + \
default.datetime_s
- m.update(self.guid)
+ m.update(self.guid.encode('utf-8'))
self.hexguid=m.hexdigest().upper()
- self.log.info('Run GUID [' + `self.guid` + '] using [' + `self.hexguid` + \
']') + self.log.info('Run GUID [' + repr(self.guid) + '] using [' + \
repr(self.hexguid) + ']')
# Actor Queue
self.actors=list()
@@ -167,34 +167,34 @@ class GumpRun(gump.util.timing.Timeable,
self.gumpSet.dump(indent+1,output)
def registerActor(self,actor):
- self.log.debug('Register Actor : ' + `actor`)
+ self.log.debug('Register Actor : ' + repr(actor))
self.actors.append(actor)
def logActors(self):
self.log.debug('There are %s registered actors : ' % len(self.actors)) \
for actor in self.actors:
- self.log.debug('Registered Actor : ' + `actor`)
+ self.log.debug('Registered Actor : ' + repr(actor))
def _dispatchEvent(self,event):
"""
Perform the dispatch
"""
- self.log.debug('Dispatch Event : ' + `event`)
+ self.log.debug('Dispatch Event : ' + repr(event))
for actor in self.actors:
#self.log.debug('Dispatch Event : ' + `event` + ' to ' + `actor`)
actor._processEvent(event)
- gump.util.inspectGarbageCollection(`event`)
+ gump.util.inspectGarbageCollection(repr(event))
def _dispatchRequest(self,request):
"""
Perform the dispatch
"""
- self.log.debug('Dispatch Request : ' + `request`)
+ self.log.debug('Dispatch Request : ' + repr(request))
for actor in self.actors:
#self.log.debug('Dispatch Request : ' + `request` + ' to ' + `actor`) \
actor._processRequest(request)
- gump.util.inspectGarbageCollection(`request`)
+ gump.util.inspectGarbageCollection(repr(request))
def generateEvent(self,entity):
"""
@@ -271,7 +271,7 @@ class EntityRunEvent(RunEvent):
self.realtime=realtime
def __repr__(self):
- return self.__class__.__name__ + ':' + `self.entity`
+ return self.__class__.__name__ + ':' + repr(self.entity)
def getEntity(self):
return self.entity
@@ -306,7 +306,7 @@ class EntityRunRequest(RunEvent):
self.entity=entity
def __repr__(self):
- return self.__class__.__name__ + ':' + `self.entity`
+ return self.__class__.__name__ + ':' + repr(self.entity)
def getEntity(self):
return self.entity
Modified: gump/branches/python3/python/gump/core/run/gumpset.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/run/gumpset.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/run/gumpset.py (original)
+++ gump/branches/python3/python/gump/core/run/gumpset.py Sun Nov 29 00:59:43 2020
@@ -77,7 +77,7 @@ class GumpSet:
repositories=None ):
self.workspace=workspace
if not self.workspace:
- raise RuntimeError, 'A non-None workspace is require'
+ raise RuntimeError('A non-None workspace is require')
self.projectexpression=pexpr
if not pexpr:
@@ -121,7 +121,7 @@ class GumpSet:
# Validate a decent run
def validate(self):
if self.isEmpty():
- raise RuntimeError, 'No projects match [' + self.projectexpression + ']'
+ raise RuntimeError('No projects match [' + self.projectexpression + ']')
# No Projects
def isEmpty(self):
@@ -250,7 +250,7 @@ class GumpSet:
moduleTotal=len(sequence)
for module in sequence:
module.setTotal(moduleTotal)
- log.debug('Identify ' + module.getName() + ' at position #' + \
`module.getPosition()`) + log.debug('Identify ' + module.getName() + \
' at position #' + repr(module.getPosition()))
return sequence
@@ -274,7 +274,7 @@ class GumpSet:
if not expr:expr='*'
- log.debug('Extract projects for expression ['+`expr`+']')
+ log.debug('Extract projects for expression ['+repr(expr)+']')
for project in self.workspace.getProjects():
#log.debug('Evaluate ['+project.getName()+']')
try:
@@ -283,7 +283,7 @@ class GumpSet:
try:
if pattern=="all": pattern='*'
if fnmatch.fnmatch(project.getName(),pattern): break \
- except Exception, detail:
+ except Exception as detail:
log.error('Failed to regexp: ' + pattern + '. Details: ' + \
str(detail)) continue
else:
@@ -291,7 +291,7 @@ class GumpSet:
continue
log.debug('Matched ['+project.getName()+'] using ['+pattern+']')
projects.append(project)
- except Exception, detail:
+ except Exception as detail:
log.error('Failed to regexp: ' + expr + '. Details: ' + str(detail))
pass
projects.sort()
@@ -341,14 +341,14 @@ class GumpSet:
break
else:
loop=", ".join([project.getName() for todoProject in todo])
- raise RuntimeError, "Circular Dependency Loop: " + str(loop) \
+ raise RuntimeError("Circular Dependency Loop: " + \
str(loop))
# Identify the size of overall sequence
projectTotal=len(sequence)
for project in sequence:
project.setTotal(projectTotal)
- log.debug('Identify ' + project.getName() + ' at position #' + \
`project.getPosition()`) + log.debug('Identify ' + project.getName() \
+ ' at position #' + repr(project.getPosition()))
return sequence
Modified: gump/branches/python3/python/gump/core/update/scmupdater.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/update/scmupdater.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/update/scmupdater.py (original)
+++ gump/branches/python3/python/gump/core/update/scmupdater.py Sun Nov 29 00:59:43 \
2020 @@ -17,7 +17,7 @@
# limitations under the License.
import os.path
-import StringIO
+import io
from gump import log
@@ -72,7 +72,7 @@ def extract_URL(result, regex, command):
"""
Extracs the URL from result
"""
- stream = StringIO.StringIO()
+ stream = io.StringIO()
catFile(stream, result.getOutput())
output = stream.getvalue()
stream.close()
@@ -116,7 +116,7 @@ class ScmUpdater(RunSpecific):
"""
log.info('Perform ' + module.getScm().getScmType().displayName + \
- ' Checkout/Update on #[' + `module.getPosition()` + \
+ ' Checkout/Update on #[' + repr(module.getPosition()) + \
'] : ' + module.getName())
(cmd, isUpdate) = self.getCommandAndType(module)
Modified: gump/branches/python3/python/gump/core/update/updater.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/update/updater.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/update/updater.py (original)
+++ gump/branches/python3/python/gump/core/update/updater.py Sun Nov 29 00:59:43 2020
@@ -74,11 +74,11 @@ def syncModule(module):
#
module.setModified(True)
log.info('Update(s) received via on #[' \
- + `module.getPosition()` + \
+ + repr(module.getPosition()) + \
'] : ' + module.getName())
- except Exception, details:
+ except Exception as details:
module.changeState(STATE_FAILED, REASON_SYNC_FAILED)
message = 'Synchronize Failed: ' + str(details)
module.addError(message)
@@ -163,7 +163,7 @@ class GumpUpdater(RunSpecific):
#
# if not module.isUpdatable(): continue
- log.info('Perform Update on #[' + `module.getPosition()` + \
+ log.info('Perform Update on #[' + repr(module.getPosition()) + \
'] : ' + module.getName())
# Do the appropriate...
@@ -202,4 +202,4 @@ class GumpUpdater(RunSpecific):
if scmUpdater:
scmUpdater.preview(module)
else:
- print 'No updater for module: ' + module.getName()
+ print('No updater for module: ' + module.getName())
Modified: gump/branches/python3/python/gump/test/artifacts.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/artifacts.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/artifacts.py (original)
+++ gump/branches/python3/python/gump/test/artifacts.py Sun Nov 29 00:59:43 2020
@@ -45,8 +45,8 @@ class ArtifactsTestSuite(UnitTestSuite):
self.repo=gump.actor.repository.artifact.ArtifactRepository(self.testRepo)
# Create some test files
- file(self.license,'w').close()
- file(self.jar1,'w').close()
+ open(self.license,'w').close()
+ open(self.jar1,'w').close()
# Load a decent Run/Workspace
self.run=getWorkedTestRun()
@@ -72,7 +72,6 @@ class ArtifactsTestSuite(UnitTestSuite):
(dated, latest)=self.repo.extractGroup('testGroup')
self.assertNotNone('Extracted something', dated)
- self.assertNotEmpty('Extracted something', dated)
def testRepositoryExtract2(self):
# Create a repository & populate it
@@ -80,16 +79,16 @@ class ArtifactsTestSuite(UnitTestSuite):
gdir=self.repo.getGroupDir('test')
- file(os.path.join(gdir,'id1-gump-20030221.jar'),'w').close()
- file(os.path.join(gdir,'id1-gump-20040221.jar'),'w').close()
- file(os.path.join(gdir,'id1-gump-20050221.jar'),'w').close()
- file(os.path.join(gdir,'id2-gump-20030221.jar'),'w').close()
- file(os.path.join(gdir,'id2-gump-20040221.jar'),'w').close()
- file(os.path.join(gdir,'id2-gump-20050221.jar'),'w').close()
- file(os.path.join(gdir,'id3-gump-20030221.jar'),'w').close()
- file(os.path.join(gdir,'id3-gump-20040221.jar'),'w').close()
- file(os.path.join(gdir,'id3-gump-20050221.jar'),'w').close()
- file(os.path.join(gdir,'id4-gump-20050221.jar'),'w').close()
+ open(os.path.join(gdir,'id1-gump-20030221.jar'),'w').close()
+ open(os.path.join(gdir,'id1-gump-20040221.jar'),'w').close()
+ open(os.path.join(gdir,'id1-gump-20050221.jar'),'w').close()
+ open(os.path.join(gdir,'id2-gump-20030221.jar'),'w').close()
+ open(os.path.join(gdir,'id2-gump-20040221.jar'),'w').close()
+ open(os.path.join(gdir,'id2-gump-20050221.jar'),'w').close()
+ open(os.path.join(gdir,'id3-gump-20030221.jar'),'w').close()
+ open(os.path.join(gdir,'id3-gump-20040221.jar'),'w').close()
+ open(os.path.join(gdir,'id3-gump-20050221.jar'),'w').close()
+ open(os.path.join(gdir,'id4-gump-20050221.jar'),'w').close()
(dated, latest)=self.repo.extractGroup('test')
@@ -97,6 +96,6 @@ class ArtifactsTestSuite(UnitTestSuite):
#pprint.pprint(dated)
self.assertNotNone('Extracted something', dated)
- self.assertEqual('Extracted correct groups', len(dated.keys()), 3)
+ self.assertEqual('Extracted correct groups', len(list(dated.keys())), 3)
self.assertEqual('Detected correct latest', latest, '20050221')
Modified: gump/branches/python3/python/gump/test/describer.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/describer.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/describer.py (original)
+++ gump/branches/python3/python/gump/test/describer.py Sun Nov 29 00:59:43 2020
@@ -22,7 +22,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/diagram.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/diagram.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/diagram.py (original)
+++ gump/branches/python3/python/gump/test/diagram.py Sun Nov 29 00:59:43 2020
@@ -26,7 +26,7 @@ from gump.tool.svg.depdiag import Depend
from gump.test import getWorkedTestRun
from gump.test.pyunit import UnitTestSuite
-import StringIO
+import io
class DiagramTestSuite(UnitTestSuite):
def __init__(self):
@@ -53,7 +53,7 @@ class DiagramTestSuite(UnitTestSuite):
def testScaleDiagramGeneration(self):
diagram=ScaleDiagram([10,20])
svg=diagram.generateDiagram()
- stream=StringIO.StringIO()
+ stream=io.StringIO()
svg.serialize(stream)
stream.close()
Modified: gump/branches/python3/python/gump/test/documenter.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/documenter.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/documenter.py (original)
+++ gump/branches/python3/python/gump/test/documenter.py Sun Nov 29 00:59:43 2020
@@ -19,7 +19,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
@@ -44,7 +44,7 @@ class DocumenterTestSuite(UnitTestSuite)
self.assertNotNone('Needed a workspace', self.workspace)
def testText(self):
- out=StringIO.StringIO()
+ out=io.StringIO()
documenter=TextDocumenter(self.run,out)
documenter.document()
out.close()
Modified: gump/branches/python3/python/gump/test/integrator.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/integrator.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/integrator.py (original)
+++ gump/branches/python3/python/gump/test/integrator.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/language.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/language.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/language.py (original)
+++ gump/branches/python3/python/gump/test/language.py Sun Nov 29 00:59:43 2020
@@ -23,7 +23,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
@@ -115,9 +115,9 @@ class LanguageTestSuite(UnitTestSuite):
def testClasspathOnDepend(self):
for depend in self.project3.getDirectDependencies():
- print "Depend:" + `depend`
+ print("Depend:" + repr(depend))
else:
- print 'No p3 deps:'
+ print('No p3 deps:')
self.assertTrue('<ant <depend gives full dependency (classpath)', \
self.project3.hasFullDependencyOnNamedProject('project1'))
Modified: gump/branches/python3/python/gump/test/loading.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/loading.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/loading.py (original)
+++ gump/branches/python3/python/gump/test/loading.py Sun Nov 29 00:59:43 2020
@@ -24,7 +24,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
from gump.core.loader.loader import *
Modified: gump/branches/python3/python/gump/test/maven.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/maven.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/maven.py (original)
+++ gump/branches/python3/python/gump/test/maven.py Sun Nov 29 00:59:43 2020
@@ -22,7 +22,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/mockobjects.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/mockobjects.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/mockobjects.py (original)
+++ gump/branches/python3/python/gump/test/mockobjects.py Sun Nov 29 00:59:43 2020
@@ -23,16 +23,16 @@ class MockLog:
pass
def debug(self,msg):
- print "DEBUG: %s" % (msg)
+ print("DEBUG: %s" % (msg))
def info(self,msg):
- print "INFO: %s" % (msg)
+ print("INFO: %s" % (msg))
def warning(self,msg):
- print "WARNING: %s" % (msg)
+ print("WARNING: %s" % (msg))
def error(self,msg):
- print "ERROR: %s" % (msg)
+ print("ERROR: %s" % (msg))
class MockConnection:
def __init__(self,cursor):
Modified: gump/branches/python3/python/gump/test/model.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/model.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/model.py (original)
+++ gump/branches/python3/python/gump/test/model.py Sun Nov 29 00:59:43 2020
@@ -23,7 +23,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
@@ -116,7 +116,7 @@ class ModelTestSuite(UnitTestSuite):
properties=project2.getProperties()
self.assertNotNone('Project2 has properties', project2.hasProperties())
self.assertNotNone('Project2 has properties', properties)
- self.assertNotEmpty('Project2 has some properties', properties)
+ self.assertNotEmptyDictionary('Project2 has some properties', properties)
self.assertEqual('Explicit blank is ok', properties.getProperty('blank-ok'), \
"")
self.assertNotNone('Explicit blank is NOT ok', \
properties.getProperty('blank-bogus'))
@@ -157,8 +157,8 @@ class ModelTestSuite(UnitTestSuite):
projects.append(project1)
- self.assertIn('Project in list',project1,projects)
- self.assertNotIn('Project NOT in list',project2,projects)
+ self.assertInSequence('Project in list',project1,projects)
+ self.assertNotInSequence('Project should NOT be in list',project2,projects)
ordered=createOrderedList([ project2, project1, project2, project1])
@@ -236,8 +236,8 @@ class ModelTestSuite(UnitTestSuite):
module1=self.module1
project1=self.project1
- self.assertNotEmpty('Ought have a location', module1.getMetadataLocation() )
- self.assertNotEmpty('Ought have a location', project1.getMetadataLocation() \
) + self.assertNotNone('Ought have a location', module1.getMetadataLocation() \
) + self.assertNotNone('Ought have a location', project1.getMetadataLocation() \
)
def testMaven(self):
self.assertTrue('Maven project has a Maven object', self.maven1.hasMaven())
@@ -279,10 +279,10 @@ class ModelTestSuite(UnitTestSuite):
#print commandLine
def testServers(self):
- self.assertNotEmpty('Some servers ought be found', \
self.workspace.getServers()) + self.assertNotEmptySequence('Some servers ought \
be found', self.workspace.getServers())
def testTrackers(self):
- self.assertNotEmpty('Some trackers ought be found', \
self.workspace.getTrackers()) + self.assertNotEmptySequence('Some trackers \
ought be found', self.workspace.getTrackers())
def testNotification(self):
self.assertTrue('Ought allow notify', self.workspace.isNotify())
Modified: gump/branches/python3/python/gump/test/nant.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/nant.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/nant.py (original)
+++ gump/branches/python3/python/gump/test/nant.py Sun Nov 29 00:59:43 2020
@@ -22,7 +22,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/notifying.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/notifying.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/notifying.py (original)
+++ gump/branches/python3/python/gump/test/notifying.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/pyunit.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/pyunit.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/pyunit.py (original)
+++ gump/branches/python3/python/gump/test/pyunit.py Sun Nov 29 00:59:43 2020
@@ -19,9 +19,10 @@
"""
import os
import sys
-from types import NoneType
import types
import logging
+import collections
+import collections.abc
from gump import log
from gump.core.gumpinit import gumpinit
@@ -45,14 +46,14 @@ class Testable:
message += str(s)
message += '] '
- raise RuntimeError, message
+ raise RuntimeError(message)
def assertNotNone(self, message, o):
- if isinstance(o, NoneType):
+ if o is None:
self.raiseIssue(['Ought NOT be None', message, o])
def assertNone(self, message, o):
- if not isinstance(o, NoneType):
+ if o is not None:
self.raiseIssue(['Ought be None', message, o])
def assertNonZero(self, message, o):
@@ -64,6 +65,10 @@ class Testable:
if not (o1 == o2):
self.raiseIssue(['Ought evaluate as equal', message, o1, o2])
+ def assertLesser(self, message, o1, o2):
+ if not (o1 < o2):
+ self.raiseIssue(['Ought evaluate as lesser', message, o1, o2])
+
def assertGreater(self, message, o1, o2):
if not (o1 > o2):
self.raiseIssue(['Ought evaluate as greater', message, o1, o2])
@@ -78,14 +83,14 @@ class Testable:
def assertFalse(self, message, o):
if o:
- self.raiseIssue(['Ought evaluate as false', message, o])
+ self.raiseIssue(['Ought evaluate as False', message, o])
def assertInString(self, message, substr, superstring):
if -1 == superstring.find(substr):
self.raiseIssue(['Ought evaluate as in', message, substr,
superstring])
- def assertIn(self, message, o, sequence):
+ def assertInSequence(self, message, o, sequence):
if not o in sequence:
self.raiseIssue(['Ought evaluate as in', message, o, sequence])
@@ -95,13 +100,25 @@ class Testable:
message, subString, mainString,
mainString.find(subString)])
- def assertNotEmpty(self, message, sequence):
- if not sequence or not len(sequence) > 0:
- self.raiseIssue(['Ought NOT evaluate as empty', message, sequence])
+ def assertNotEmptyDictionary(self, message, dictionary):
+ if not dictionary:
+ self.raiseIssue(['Ought NOT evaluate as None dictionary', message, \
dictionary]) + if not isinstance(dictionary,dict):
+ self.raiseIssue(['Ought NOT evaluate as NOT a dictionary', message, \
dictionary]) + if not len(dictionary.keys()) > 0:
+ self.raiseIssue(['Ought NOT evaluate as an empty dictionary', message, \
dictionary]) +
+ def assertNotEmptySequence(self, message, sequence):
+ if not sequence:
+ self.raiseIssue(['Ought NOT evaluate as a None sequence', message, \
sequence]) + if not isinstance(sequence,collections.abc.Sequence):
+ self.raiseIssue(['Ought NOT evaluate as NOT a sequence', message, \
sequence]) + if not len(sequence) > 0:
+ self.raiseIssue(['Ought NOT evaluate as an empty sequence', message, \
sequence])
- def assertNotIn(self, message, o, sequence):
+ def assertNotInSequence(self, message, o, sequence):
if o in sequence:
- self.raiseIssue(['Ought NOT evaluate as in', message, o, sequence])
+ self.raiseIssue(['Ought NOT evaluate as in sequence', message, o, \
sequence])
def assertNotSubstring(self, message, subString, mainString):
if not -1 == mainString.find(subString):
@@ -118,7 +135,7 @@ class Testable:
self.assertEqual(message, o, sequence[posn])
def assertString(self, message, o):
- if not isinstance(o, types.StringTypes):
+ if not isinstance(o, str):
self.raiseIssue(['Ought be a String type', message, o,
type(o)])
@@ -201,7 +218,7 @@ class UnitTestSuite(Testable):
# avoid nulls, metadata, and methods other than test*
if not test:
continue
- if isinstance(test, types.TypeType):
+ if isinstance(test, type):
continue
if not isinstance(test, types.MethodType):
continue
@@ -218,7 +235,7 @@ class UnitTestSuite(Testable):
pattern = '*'
if fnmatch(name, pattern):
break
- except Exception, detail:
+ except Exception as detail:
log.error('Failed to regexp: ' + pattern + \
'. Details: ' + str(detail))
continue
@@ -247,7 +264,7 @@ class UnitTestSuite(Testable):
if hasattr(self, 'tearDown'):
self.tearDown()
- except Exception, _details:
+ except Exception as _details:
log.error('Test [' + self.__class__.__name__ \
+ ':' + test.__name__ + '] Failed',
exc_info = 1)
@@ -284,7 +301,7 @@ class TestRunner:
initializeGarbageCollection()
# Sort to resolve dependency order
- runOrder = createOrderedList(self.suites)
+ runOrder = self.suites # createOrderedList(self.suites)
testsRun = 0
problems = []
@@ -295,7 +312,7 @@ class TestRunner:
(runs, results) = suite.performTests(args)
testsRun += runs
problems += results
- except Exception, _details:
+ except Exception as _details:
log.error('Failed')
ei = sys.exc_info()
message = formatException(ei)
@@ -304,8 +321,8 @@ class TestRunner:
printSeparator()
- log.info('Performed [' + `testsRun` + '] tests with [' + \
- `len(problems)` + '] issues.')
+ log.info('Performed [' + repr(testsRun) + '] tests with [' + \
+ repr(len(problems)) + '] issues.')
for problem in problems:
log.error('------------------------------------------------------------------------')
Modified: gump/branches/python3/python/gump/test/resolving.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/resolving.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/resolving.py (original)
+++ gump/branches/python3/python/gump/test/resolving.py Sun Nov 29 00:59:43 2020
@@ -21,7 +21,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
@@ -90,7 +90,7 @@ class ResolvingTestSuite(UnitTestSuite):
path=Path()
- print path.getPathUp()
+ print(path.getPathUp())
self.assertNotNone('Ought be period.', path.getPathUp())
path1=path.getPostfixed('ABC')
@@ -142,7 +142,7 @@ class ResolvingTestSuite(UnitTestSuite):
self.assertNotNone(message + "::getDirectoryUrl", \
resolver.getDirectoryUrl(self.module1))
self.assertNotNone(message + "::getUrl", resolver.getUrl(self.module1))
- self.assertNotEmpty('Need work on workspace', \
self.workspace.getWorkList()) + self.assertNotEmptySequence('Need \
work on workspace', self.workspace.getWorkList()) for work in \
self.workspace.getWorkList(): #printSeparator()
self.assertNotNone(message + "::work", work)
Modified: gump/branches/python3/python/gump/test/stats.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/stats.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/stats.py (original)
+++ gump/branches/python3/python/gump/test/stats.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/svg.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/svg.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/svg.py (original)
+++ gump/branches/python3/python/gump/test/svg.py Sun Nov 29 00:59:43 2020
@@ -24,7 +24,7 @@ from gump.tool.svg.drawing import *
from gump.tool.svg.svg import *
from gump.test.pyunit import UnitTestSuite
-import StringIO
+import io
class SvgTestSuite(UnitTestSuite):
def __init__(self):
@@ -33,7 +33,7 @@ class SvgTestSuite(UnitTestSuite):
def testSvgConstruction(self):
svg=SimpleSvg()
- stream=StringIO.StringIO()
+ stream=io.StringIO()
svg.serialize(stream)
stream.close()
Modified: gump/branches/python3/python/gump/test/sync.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/sync.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/sync.py (original)
+++ gump/branches/python3/python/gump/test/sync.py Sun Nov 29 00:59:43 2020
@@ -42,19 +42,19 @@ class SyncTestSuite(UnitTestSuite):
"""
self.tearDown()
os.makedirs(self.source_subdir1)
- myfile = file(self.source_alphatxt, 'w+')
+ myfile = open(self.source_alphatxt, 'w+')
myfile.write('Hello World')
myfile.close()
# Sat, 20 May 2000 12:07:40 +0000
- sometime=[2000,5,20,12,7,40,5,141,-1]
+ sometime=(2000,5,20,12,7,40,5,141,-1)
epoch_sometime = time.mktime(sometime)
os.utime(self.source_alphatxt, (epoch_sometime, epoch_sometime))
def tearDown(self):
if os.path.exists(self.source):
- log.debug('attempting to remove directory [%s]' % (`self.source`))
+ log.debug('attempting to remove directory [%s]' % (repr(self.source)))
shutil.rmtree(self.source)
if os.path.exists(self.destination):
- log.debug('attempting to remove directory [%s]' % (`self.destination`))
+ log.debug('attempting to remove directory [%s]' % \
(repr(self.destination))) shutil.rmtree(self.destination)
def testSimpleSync(self):
@@ -72,32 +72,32 @@ class SyncTestSuite(UnitTestSuite):
mySync.execute()
try:
result = os.stat(self.destination)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['destination directory was not created', \
self.destination]) try:
result = os.stat(self.destination_subdir1)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['destination_subdir1 directory was not created', \
self.destination_subdir1]) result_source = None
result_destination = None
try:
result_source = os.stat(self.source_alphatxt)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['file was not created', self.source_alphatxt])
try:
result_destination = os.stat(self.destination_alphatxt)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['file was not created', self.destination_alphatxt])
- log.debug("size of file [%s] is %i" % (`self.destination_alphatxt`,
+ log.debug("size of file [%s] is %i" % (repr(self.destination_alphatxt),
result_destination[stat.ST_SIZE]))
log.debug("modification date of file [%s] is %s" %
- (`self.destination_alphatxt`,
+ (repr(self.destination_alphatxt),
time.ctime(result_destination[stat.ST_MTIME])))
self.assertTrue("modtime is equal for [%s] compared to [%s]"
- %(`self.source_alphatxt`,`self.destination_alphatxt`),
+ %(repr(self.source_alphatxt),repr(self.destination_alphatxt)),
result_source[stat.ST_MTIME]==result_destination[stat.ST_MTIME])
self.assertTrue("size is equal for [%s] compared to [%s]"
- %(`self.source_alphatxt`,`self.destination_alphatxt`),
+ %(repr(self.source_alphatxt),repr(self.destination_alphatxt)),
result_source[stat.ST_SIZE]==result_destination[stat.ST_SIZE])
def testRemoveJunkDestinationFile(self):
"""
@@ -118,7 +118,7 @@ class SyncTestSuite(UnitTestSuite):
destination_junktxt = os.path.join(self.destination_subdir1,
'junk.txt')
shutil.copy2(self.destination_alphatxt, destination_junktxt)
- sometime=[2000,5,20,12,7,45,5,141,-1]
+ sometime=(2000,5,20,12,7,45,5,141,-1)
epoch_sometime = time.mktime(sometime)
os.utime(self.destination_alphatxt, (epoch_sometime, epoch_sometime))
mySync.execute()
@@ -128,19 +128,19 @@ class SyncTestSuite(UnitTestSuite):
result_destination = None
try:
result_source = os.stat(self.source_alphatxt)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['file was not created', self.source_alphatxt])
try:
result_destination = os.stat(self.destination_alphatxt)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['file was not created', self.destination_alphatxt])
- log.debug("size of file [%s] is %i" % (`self.destination_alphatxt`,
+ log.debug("size of file [%s] is %i" % (repr(self.destination_alphatxt),
result_destination[stat.ST_SIZE]))
log.debug("modification date of file [%s] is %s" %
- (`self.destination_alphatxt`,
+ (repr(self.destination_alphatxt),
time.ctime(result_destination[stat.ST_MTIME])))
self.assertTrue("modtime is equal for [%s] compared to [%s]"
- %(`self.source_alphatxt`,`self.destination_alphatxt`),
+ %(repr(self.source_alphatxt),repr(self.destination_alphatxt)),
result_source[stat.ST_MTIME]==result_destination[stat.ST_MTIME])
def testDestinationFileBecomesDirectory(self):
"""
@@ -171,19 +171,19 @@ class SyncTestSuite(UnitTestSuite):
result_destination = None
try:
result_source = os.stat(self.source_alphatxt)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['file was not created', self.source_alphatxt])
try:
result_destination = os.stat(self.destination_alphatxt)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['file was not created', self.destination_alphatxt])
- log.debug("size of file [%s] is %i" % (`self.destination_alphatxt`,
+ log.debug("size of file [%s] is %i" % (repr(self.destination_alphatxt),
result_destination[stat.ST_SIZE]))
log.debug("modification date of file [%s] is %s" %
- (`self.destination_alphatxt`,
+ (repr(self.destination_alphatxt),
time.ctime(result_destination[stat.ST_MTIME])))
self.assertTrue("modtime is equal for [%s] compared to [%s]"
- %(`self.source_alphatxt`,`self.destination_alphatxt`),
+ %(repr(self.source_alphatxt),repr(self.destination_alphatxt)),
result_source[stat.ST_MTIME]==result_destination[stat.ST_MTIME])
def testOriginFileBecomesDirectory(self):
"""
@@ -203,7 +203,7 @@ class SyncTestSuite(UnitTestSuite):
junk_subdir = os.path.join(self.source_alphatxt, "junk.dir")
os.makedirs(junk_subdir)
junk_source_file1 = os.path.join(self.source_alphatxt, "junk.txt")
- myfile = file(junk_source_file1, 'w+')
+ myfile = open(junk_source_file1, 'w+')
myfile.write('Hello World')
myfile.close()
junk_source_file2 = os.path.join(junk_subdir, "junk.txt")
@@ -248,11 +248,11 @@ class SyncTestSuite(UnitTestSuite):
betatxt = "beta.txt"
source_betatxt = os.path.join(self.source_subdir1, betatxt)
destination_betatxt = os.path.join(self.destination_subdir1, betatxt)
- myfile = file(source_betatxt, 'w+')
+ myfile = open(source_betatxt, 'w+')
myfile.write('Hello World')
myfile.close()
# Sat, 20 May 2000 12:07:40 +0000
- sometime=[2000,5,20,12,7,40,5,141,-1]
+ sometime=(2000,5,20,12,7,40,5,141,-1)
epoch_sometime = time.mktime(sometime)
os.utime(source_betatxt, (epoch_sometime, epoch_sometime))
myCopy = Copy(self.source, self.destination)
@@ -296,15 +296,15 @@ class SyncTestSuite(UnitTestSuite):
result_dest = None
try:
result_source = os.stat(inode_source)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['could not stat ', inode_source])
try:
result_dest = os.stat(inode_dest)
- except Exception, details:
+ except Exception as details:
self.raiseIssue(['could not stat ', inode_dest])
self.assertTrue("modtime is equal for [%s] compared to [%s]"
- %(`inode_source`,`inode_dest`),
+ %(repr(inode_source),repr(inode_dest)),
result_source[stat.ST_MTIME]==result_dest[stat.ST_MTIME])
self.assertTrue("size is equal for [%s] compared to [%s]"
- %(`inode_source`,`inode_dest`),
+ %(repr(inode_source),repr(inode_dest)),
result_source[stat.ST_SIZE]==result_dest[stat.ST_SIZE])
Modified: gump/branches/python3/python/gump/test/syndicator.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/syndicator.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/syndicator.py (original)
+++ gump/branches/python3/python/gump/test/syndicator.py Sun Nov 29 00:59:43 2020
@@ -22,7 +22,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/testExample.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/testExample.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/testExample.py (original)
+++ gump/branches/python3/python/gump/test/testExample.py Sun Nov 29 00:59:43 2020
@@ -41,8 +41,8 @@ class ExampleTestCase(TestCase):
# you can do anything inside a test
# use the assertXXX methods on TestCase
# to check conditions
- self.assert_( True )
- self.assertEquals( type({}), type({}) )
+ self.assertTrue( True )
+ self.assertEqual( type({}), type({}) )
# this is used by testrunner.py to determine what tests to run
def test_suite():
Modified: gump/branches/python3/python/gump/test/threads.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/threads.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/threads.py (original)
+++ gump/branches/python3/python/gump/test/threads.py Sun Nov 29 00:59:43 2020
@@ -28,11 +28,11 @@ class TestWork:
self.stuff=stuff
def __str__(self):
- return 'Work:'+`self.stuff`
+ return 'Work:'+repr(self.stuff)
class TestWorker(WorkerThread):
def performWork(self,work):
- print 'Thread ' + self.getName() + ' performs ' + str(work)
+ print('Thread ' + self.getName() + ' performs ' + str(work))
time.sleep(2)
@@ -47,7 +47,7 @@ class ThreadingTestSuite(UnitTestSuite):
work=workList.getWork()
while work:
- print 'Get Work : ' + str(work)
+ print('Get Work : ' + str(work))
work=workList.getWork()
def testThreadWorkers1(self):
Modified: gump/branches/python3/python/gump/test/timing.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/timing.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/timing.py (original)
+++ gump/branches/python3/python/gump/test/timing.py Sun Nov 29 00:59:43 2020
@@ -105,11 +105,11 @@ class TimingTestSuite(UnitTestSuite):
#set.dump()
set.getTotalTimes()
- self.assertGreater('Time passes', range1.getStart(), range1.getEnd()) \
- self.assertGreater('Time passes', range2.getStart(), range2.getEnd()) \
- self.assertGreater('Time passes', range1.getEnd(), range2.getEnd())
+ self.assertLesser('Time passes', range1.getStart(), range1.getEnd())
+ self.assertLesser('Time passes', range2.getStart(), range2.getEnd())
+ self.assertLesser('Time passes', range1.getEnd(), range2.getEnd())
- self.assertGreater('Time passes', set.getStart(), set.getEnd())
+ self.assertLesser('Time passes', set.getStart(), set.getEnd())
def testUTCTimes(self):
stamp1=TimeStamp('S1')
@@ -118,5 +118,5 @@ class TimingTestSuite(UnitTestSuite):
t1=stamp1.getUtc()
t2=stamp2.getUtc()
- self.assertIn('UTC', 'UTC', t1)
- self.assertIn('UTC', 'UTC', t2)
+ self.assertInSequence('UTC', 'UTC', t1)
+ self.assertInSequence('UTC', 'UTC', t2)
Modified: gump/branches/python3/python/gump/test/unicode.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/unicode.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/unicode.py (original)
+++ gump/branches/python3/python/gump/test/unicode.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from xml.sax.saxutils import escape
from gump import log
Modified: gump/branches/python3/python/gump/test/updater.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/updater.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/updater.py (original)
+++ gump/branches/python3/python/gump/test/updater.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/test/utils.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/utils.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/utils.py (original)
+++ gump/branches/python3/python/gump/test/utils.py Sun Nov 29 00:59:43 2020
@@ -62,7 +62,7 @@ class UtilsTestSuite(UnitTestSuite):
def testBeanAttributes(self):
attrs=getBeanAttributes(TestBean())
- self.assertNotEmpty('Ought be some', attrs)
+ self.assertNotEmptyDictionary('Ought be some', attrs)
self.assertNotNone('Ought be one called X', attrs['X'])
def testRandomStuff(self):
Modified: gump/branches/python3/python/gump/test/xdocs.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/xdocs.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/xdocs.py (original)
+++ gump/branches/python3/python/gump/test/xdocs.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump.core.gumpinit import gumpinit
from gump.actor.document.xdocs.xdoc import *
@@ -41,7 +41,7 @@ class XDocsTestSuite(UnitTestSuite):
#print data
def createXDoc(self,title,xhtml):
- stream=StringIO.StringIO()
+ stream=io.StringIO()
doc1=XDocDocument('Test 1', stream, XDocConfig(xhtml))
Modified: gump/branches/python3/python/gump/test/xref.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/test/xref.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/test/xref.py (original)
+++ gump/branches/python3/python/gump/test/xref.py Sun Nov 29 00:59:43 2020
@@ -20,7 +20,7 @@
import os
import logging
-import types, StringIO
+import types, io
from gump import log
import gump.core.config
Modified: gump/branches/python3/python/gump/tool/guru/xref.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/tool/guru/xref.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/tool/guru/xref.py (original)
+++ gump/branches/python3/python/gump/tool/guru/xref.py Sun Nov 29 00:59:43 2020
@@ -57,7 +57,7 @@ class XRefGuru:
for module in self.workspace.getModules():
repository=module.getRepository()
if repository:
- if not self.repositoryToModule.has_key(repository):
+ if not repository in self.repositoryToModule:
self.repositoryToModule[repository]=[]
# Store
@@ -68,10 +68,10 @@ class XRefGuru:
for project in module.getProjects():
if project.hasPackageNames():
for packageName in project.getPackageNames():
- if not self.packageToModule.has_key(packageName):
+ if not packageName in self.packageToModule:
self.packageToModule[packageName]=[]
- if not self.packageToProject.has_key(packageName):
+ if not packageName in self.packageToProject:
self.packageToProject[packageName]=[]
# Store
@@ -86,7 +86,7 @@ class XRefGuru:
moduleDescription=module.getDescription()
if moduleDescription:
- if not self.descriptionToModule.has_key(moduleDescription):
+ if not moduleDescription in self.descriptionToModule:
self.descriptionToModule[moduleDescription]=[]
if not module in self.descriptionToModule[moduleDescription]:
@@ -96,7 +96,7 @@ class XRefGuru:
projectDescription=project.getDescription()
if projectDescription:
- if not self.descriptionToProject.has_key(projectDescription):
+ if not projectDescription in self.descriptionToProject:
self.descriptionToProject[projectDescription]=[]
if not project in self.descriptionToProject[projectDescription]:
@@ -112,11 +112,11 @@ class XRefGuru:
outputId=output.getId() or 'No Identifier'
# Create a list to hold multiple (if needed)
- if not self.outputToProject.has_key(outputName):
+ if not outputName in self.outputToProject:
self.outputToProject[outputName]=[]
# Create a list to hold multiple (if needed)
- if not self.outputIdToProject.has_key(outputId):
+ if not outputId in self.outputIdToProject:
self.outputIdToProject[outputId]=[]
# Store the Project
@@ -133,7 +133,7 @@ class XRefGuru:
# print project.getName() + ' : Metadata Location = ' + \
metadataLocation + "\n";
if metadataLocation:
- if not \
self.descriptorLocationToProject.has_key(metadataLocation): + if \
not metadataLocation in self.descriptorLocationToProject:
self.descriptorLocationToProject[metadataLocation]=[]
if not project in \
self.descriptorLocationToProject[metadataLocation]:
Modified: gump/branches/python3/python/gump/tool/integration/cvs.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/tool/integration/cvs.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/tool/integration/cvs.py (original)
+++ gump/branches/python3/python/gump/tool/integration/cvs.py Sun Nov 29 00:59:43 \
2020 @@ -78,7 +78,7 @@ def loginToRepositoryOnDemand(repository
# log into the cvs repository
if str(repository.getMethod())=='pserver':
newpass=mangle(repository.getPassword())
- if not root in logins or logins[root]<>newpass:
+ if not root in logins or logins[root]!=newpass:
log.info('Provide login for CVS repository: ' + repository.getName() + ' \
@ ' + root) # Open with append...
Modified: gump/branches/python3/python/gump/tool/performance/deps.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/tool/performance/deps.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/tool/performance/deps.py (original)
+++ gump/branches/python3/python/gump/tool/performance/deps.py Sun Nov 29 00:59:43 \
2020 @@ -44,7 +44,7 @@ def deps(run,runs=1):
documenter=XDocDocumenter(run,gtest,'http://someplace')
for r in range(runs):
- print 'Perform run # ' + `r`
+ print('Perform run # ' + repr(r))
for project in run.getWorkspace().getProjects():
project.getDirectDependencies()
project.getDirectDependees()
Modified: gump/branches/python3/python/gump/tool/performance/gurus.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/tool/performance/gurus.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/tool/performance/gurus.py (original)
+++ gump/branches/python3/python/gump/tool/performance/gurus.py Sun Nov 29 00:59:43 \
2020 @@ -34,7 +34,7 @@ from gump.core.loader.loader import Work
def gurus(run,runs=1):
for r in range(runs):
- print 'Perform run # ' + `r`
+ print('Perform run # ' + repr(r))
log.info('Generate Statistic Guru')
stats=StatisticsGuru(run.getWorkspace())
log.info('Generate XRef Guru')
Modified: gump/branches/python3/python/gump/tool/performance/xdocs.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/tool/performance/xdocs.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/tool/performance/xdocs.py (original)
+++ gump/branches/python3/python/gump/tool/performance/xdocs.py Sun Nov 29 00:59:43 \
2020 @@ -44,7 +44,7 @@ def document(run,runs=1):
documenter=XDocDocumenter(run,gtest,'http://someplace')
for r in range(runs):
- print 'Perform run # ' + `r`
+ print('Perform run # ' + repr(r))
documenter.document()
def xrun():
Modified: gump/branches/python3/python/gump/tool/shared/comparator.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/tool/shared/comparator.py?rev=1883919&r1=1883918&r2=1883919&view=diff
==============================================================================
--- gump/branches/python3/python/gump/tool/shared/comparator.py (original)
+++ gump/branches/python3/python/gump/tool/shared/comparator.py Sun Nov 29 00:59:43 \
2020 @@ -42,6 +42,8 @@ def compareObjects(o1,o2):
#
# Module Comparisons
#
+def comparison(a,b):
+ return int(a > b) - int(a < b)
def compareModulesByElapsed(module1,module2):
elapsed1=module1.getElapsedSecs()
@@ -49,28 +51,28 @@ def compareModulesByElapsed(module1,modu
c = 0
if elapsed1 > elapsed2: c = -1
if elapsed1 < elapsed2: c = 1
- if not c: c=cmp(module1,module2)
+ if not c: c=comparison(module1,module2)
return c
def compareModulesByProjectCount(module1,module2):
count1=len(module1.getProjects())
count2=len(module2.getProjects())
c = count2 - count1
- if not c: c=cmp(module1,module2)
+ if not c: c=comparison(module1,module2)
return c
def compareModulesByDependencyCount(module1,module2):
count1=module1.getFullDependencyCount()
count2=module2.getFullDependencyCount()
c= count2 - count1
- if not c: c=cmp(module1,module2)
+ if not c: c=comparison(module1,module2)
return c
def compareModulesByDependeeCount(module1,module2):
count1=module1.getFullDependeeCount()
count2=module2.getFullDependeeCount()
c= count2 - count1
- if not c: c=cmp(module1,module2)
+ if not c: c=comparison(module1,module2)
return c
def compareModulesByFOGFactor(module1,module2):
@@ -78,7 +80,7 @@ def compareModulesByFOGFactor(module1,mo
fog2=module2.getFOGFactor()
# Allow comparison to 2 decimal places, by *100
c= int(round((fog2 - fog1)*100,0))
- if not c: c=cmp(module1,module2)
+ if not c: c=comparison(module1,module2)
return c
def compareModulesByLastModified(module1,module2):
@@ -96,35 +98,35 @@ def compareProjectsByElapsed(project1,pr
c = 0
if elapsed1 > elapsed2: c = -1
if elapsed1 < elapsed2: c = 1
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByDependencyCount(project1,project2):
count1=project1.getDependencyCount()
count2=project2.getDependencyCount()
c= count2 - count1
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByDependeeCount(project1,project2):
count1=project1.getDependeeCount()
count2=project2.getDependeeCount()
c= count2 - count1
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByFullDependeeCount(project1,project2):
count1=project1.getFullDependeeCount()
count2=project2.getFullDependeeCount()
c= count2 - count1
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByFullDependencyCount(project1,project2):
count1=project1.getFullDependencyCount()
count2=project2.getFullDependencyCount()
c= count2 - count1
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByFOGFactor(project1,project2):
@@ -132,7 +134,7 @@ def compareProjectsByFOGFactor(project1,
fog2=project2.getFOGFactor()
# Allow comparison to 2 decimal places, by *100
c= int(round((fog2 - fog1)*100,0))
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByLastModified(project1,project2):
@@ -144,27 +146,27 @@ def compareProjectsBySequenceInState(pro
seq1=project1.getStats().sequenceInState
seq2=project2.getStats().sequenceInState
c= int(round(seq2 - seq1,0))
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByDependencyDepth(project1,project2):
dep1=project1.getDependencyDepth()
dep2=project2.getDependencyDepth()
c= int(round(dep2 - dep1,0))
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByTotalDependencyDepth(project1,project2):
tot1=project1.getTotalDependencyDepth()
tot2=project2.getTotalDependencyDepth()
c= int(round(tot2 - tot1,0))
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
def compareProjectsByAffected(project1,project2):
aff1=project1.countAffectedProjects()
aff2=project2.countAffectedProjects()
c= int(round(aff2 - aff1,0))
- if not c: c=cmp(project1,project2)
+ if not c: c=comparison(project1,project2)
return c
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic