Skip to content

Commit

Permalink
Removed Python 2 support.
Browse files Browse the repository at this point in the history
Some subpackage removed the six dependency shoobx.wfmc forgot declare
Also removing u prefixes
  • Loading branch information
agroszer committed Apr 3, 2023
1 parent b04b698 commit 612e0f4
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 279 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -11,6 +11,8 @@ CHANGES

- Added Python 3.10 and 3.11 support.

- Removed Python 2 support.


4.3.0 (2022-04-07)
------------------
Expand Down
2 changes: 1 addition & 1 deletion src/shoobx/wfmc/deadline.txt
Expand Up @@ -142,7 +142,7 @@ Do it again without the wait
Clean up deadline timer threads.

>>> import threading
>>> while threading.activeCount() > 1:
>>> while threading.active_count() > 1:
... res = [thread.cancel()
... for thread in threading.enumerate()
... if thread is not threading.current_thread()]
10 changes: 5 additions & 5 deletions src/shoobx/wfmc/process.py
Expand Up @@ -297,7 +297,7 @@ def __init__(self, activity, deadline_time, deadlineDef):
self.activity = activity
self.deadline_time = deadline_time
self.definition = deadlineDef
if deadlineDef.execution != u'SYNCHR':
if deadlineDef.execution != 'SYNCHR':
raise NotImplementedError('Only Synchronous (SYNCHR) deadlines '
'are supported at this point.')

Expand Down Expand Up @@ -852,7 +852,7 @@ def throwException(self, activity):

def deadlinePassedHandler(self, deadline):
# TODO: Is this threadsafe?
if deadline.definition.execution != u'SYNCHR':
if deadline.definition.execution != 'SYNCHR':
raise NotImplementedError('Only Synchronous (SYNCHR) deadlines are'
' supported at this point.')
activity = deadline.activity
Expand Down Expand Up @@ -958,7 +958,7 @@ def defaultChecker(transition):
if exception:
# TODO: Need support for exception Name specification
for transition in activity_definition.outgoing:
if transition.type == u'DEFAULTEXCEPTION':
if transition.type == 'DEFAULTEXCEPTION':
return [transition]
else:
raise interfaces.ProcessError(
Expand Down Expand Up @@ -1189,9 +1189,9 @@ def defineParameters(self, *parameters):
self.parameters += parameters

def __repr__(self):
input = u', '.join([param.__name__ for param in self.parameters
input = ', '.join([param.__name__ for param in self.parameters
if param.input == True])
output = u', '.join([param.__name__ for param in self.parameters
output = ', '.join([param.__name__ for param in self.parameters
if param.output == True])
return "<Application %r: (%s) --> (%s)>" % (self.id, input, output)

Expand Down
2 changes: 1 addition & 1 deletion src/shoobx/wfmc/subflow.txt
Expand Up @@ -116,7 +116,7 @@ Make sure process is finished now::
All subflows are registered in main flow

>>> sorted(proc.subflows, key=lambda p: p.definition.id)
[Process(u'innerflow'), Process(u'innerflow'), Process(u'subflow')]
[Process('innerflow'), Process('innerflow'), Process('subflow')]

Variable from inner subflow should not be visible in main flow namespace::

Expand Down
15 changes: 0 additions & 15 deletions src/shoobx/wfmc/tests.py
Expand Up @@ -16,8 +16,6 @@
from __future__ import print_function
import doctest
import os
import re
import sys
import unittest
import zope.event
import zope.interface
Expand All @@ -26,18 +24,6 @@
from shoobx.wfmc import interfaces, process


class Py23DocChecker(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
if sys.version_info[0] == 3:
# if running on py2, attempt to prefix all the strings
# with "u" to signify that they're unicode literals
want = re.sub("u'(.*?)'", "'\\1'", want)
want = re.sub('u"(.*?)"', '"\\1"', want)
else:
want = re.sub('shoobx.wfmc.xpdl.HandlerError', 'HandlerError', want)
return doctest.OutputChecker.check_output(self, want, got, optionflags)


def tearDown(test):
testing.tearDown(test)
if zope.event.subscribers:
Expand Down Expand Up @@ -446,7 +432,6 @@ def test_suite():
suite.addTest(doctest.DocFileSuite(
doctestfile,
setUp=setUp, tearDown=tearDown,
checker=Py23DocChecker(),
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF))
suite.addTest(doctest.DocTestSuite(
setUp=setUp, tearDown=testing.tearDown))
Expand Down

0 comments on commit 612e0f4

Please sign in to comment.