taskflow 5.12.0__py3-none-any.whl → 6.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. taskflow/atom.py +3 -5
  2. taskflow/conductors/backends/__init__.py +0 -2
  3. taskflow/conductors/backends/impl_blocking.py +1 -3
  4. taskflow/conductors/backends/impl_executor.py +3 -6
  5. taskflow/conductors/backends/impl_nonblocking.py +1 -3
  6. taskflow/conductors/base.py +1 -3
  7. taskflow/deciders.py +0 -2
  8. taskflow/engines/__init__.py +0 -2
  9. taskflow/engines/action_engine/actions/base.py +1 -3
  10. taskflow/engines/action_engine/actions/retry.py +1 -3
  11. taskflow/engines/action_engine/actions/task.py +1 -3
  12. taskflow/engines/action_engine/builder.py +2 -4
  13. taskflow/engines/action_engine/compiler.py +9 -11
  14. taskflow/engines/action_engine/completer.py +5 -7
  15. taskflow/engines/action_engine/deciders.py +1 -3
  16. taskflow/engines/action_engine/engine.py +4 -26
  17. taskflow/engines/action_engine/executor.py +2 -4
  18. taskflow/engines/action_engine/runtime.py +1 -3
  19. taskflow/engines/action_engine/scheduler.py +3 -5
  20. taskflow/engines/action_engine/scopes.py +3 -5
  21. taskflow/engines/action_engine/selector.py +1 -3
  22. taskflow/engines/action_engine/traversal.py +0 -2
  23. taskflow/engines/base.py +1 -3
  24. taskflow/engines/helpers.py +0 -2
  25. taskflow/engines/worker_based/dispatcher.py +2 -4
  26. taskflow/engines/worker_based/endpoint.py +1 -3
  27. taskflow/engines/worker_based/engine.py +1 -4
  28. taskflow/engines/worker_based/executor.py +0 -2
  29. taskflow/engines/worker_based/protocol.py +1 -3
  30. taskflow/engines/worker_based/proxy.py +2 -4
  31. taskflow/engines/worker_based/server.py +3 -5
  32. taskflow/engines/worker_based/types.py +6 -7
  33. taskflow/engines/worker_based/worker.py +4 -6
  34. taskflow/examples/99_bottles.py +0 -2
  35. taskflow/examples/alphabet_soup.py +0 -2
  36. taskflow/examples/build_a_car.py +1 -3
  37. taskflow/examples/buildsystem.py +1 -3
  38. taskflow/examples/calculate_in_parallel.py +1 -3
  39. taskflow/examples/calculate_linear.py +3 -5
  40. taskflow/examples/create_parallel_volume.py +2 -5
  41. taskflow/examples/delayed_return.py +1 -3
  42. taskflow/examples/distance_calculator.py +12 -24
  43. taskflow/examples/dump_memory_backend.py +1 -3
  44. taskflow/examples/echo_listener.py +0 -2
  45. taskflow/examples/example_utils.py +1 -3
  46. taskflow/examples/fake_billing.py +9 -11
  47. taskflow/examples/graph_flow.py +2 -4
  48. taskflow/examples/hello_world.py +2 -4
  49. taskflow/examples/jobboard_produce_consume_colors.py +3 -5
  50. taskflow/examples/parallel_table_multiply.py +1 -3
  51. taskflow/examples/persistence_example.py +1 -3
  52. taskflow/examples/pseudo_scoping.py +2 -4
  53. taskflow/examples/resume_from_backend.py +1 -3
  54. taskflow/examples/resume_many_flows/my_flows.py +0 -2
  55. taskflow/examples/resume_many_flows/resume_all.py +1 -3
  56. taskflow/examples/resume_many_flows/run_flow.py +2 -4
  57. taskflow/examples/resume_many_flows.py +0 -2
  58. taskflow/examples/resume_vm_boot.py +12 -15
  59. taskflow/examples/resume_volume_create.py +3 -5
  60. taskflow/examples/retry_flow.py +0 -2
  61. taskflow/examples/reverting_linear.py +1 -3
  62. taskflow/examples/run_by_iter.py +0 -2
  63. taskflow/examples/run_by_iter_enumerate.py +1 -3
  64. taskflow/examples/share_engine_thread.py +2 -4
  65. taskflow/examples/simple_linear.py +0 -2
  66. taskflow/examples/simple_linear_listening.py +1 -3
  67. taskflow/examples/simple_linear_pass.py +0 -2
  68. taskflow/examples/simple_map_reduce.py +0 -2
  69. taskflow/examples/switch_graph_flow.py +1 -3
  70. taskflow/examples/timing_listener.py +1 -3
  71. taskflow/examples/tox_conductor.py +3 -5
  72. taskflow/examples/wbe_event_sender.py +0 -2
  73. taskflow/examples/wbe_mandelbrot.py +0 -2
  74. taskflow/examples/wbe_simple_linear.py +0 -2
  75. taskflow/examples/wrapped_exception.py +0 -2
  76. taskflow/exceptions.py +7 -9
  77. taskflow/flow.py +1 -3
  78. taskflow/formatters.py +22 -8
  79. taskflow/jobs/backends/__init__.py +0 -2
  80. taskflow/jobs/backends/impl_redis.py +22 -18
  81. taskflow/jobs/backends/impl_zookeeper.py +7 -8
  82. taskflow/jobs/base.py +5 -7
  83. taskflow/listeners/base.py +1 -3
  84. taskflow/listeners/capturing.py +1 -3
  85. taskflow/listeners/claims.py +1 -3
  86. taskflow/listeners/logging.py +10 -6
  87. taskflow/listeners/printing.py +1 -3
  88. taskflow/listeners/timing.py +10 -13
  89. taskflow/logging.py +0 -2
  90. taskflow/patterns/graph_flow.py +2 -4
  91. taskflow/patterns/linear_flow.py +4 -9
  92. taskflow/patterns/unordered_flow.py +4 -9
  93. taskflow/persistence/backends/__init__.py +1 -3
  94. taskflow/persistence/backends/impl_dir.py +3 -6
  95. taskflow/persistence/backends/impl_memory.py +6 -9
  96. taskflow/persistence/backends/impl_sqlalchemy.py +4 -6
  97. taskflow/persistence/backends/impl_zookeeper.py +2 -4
  98. taskflow/persistence/backends/sqlalchemy/alembic/env.py +0 -2
  99. taskflow/persistence/backends/sqlalchemy/alembic/versions/00af93df9d77_add_unique_into_all_indexes.py +74 -0
  100. taskflow/persistence/backends/sqlalchemy/alembic/versions/14b227d79a87_add_intention_column.py +0 -2
  101. taskflow/persistence/backends/sqlalchemy/alembic/versions/1c783c0c2875_replace_exception_an.py +0 -2
  102. taskflow/persistence/backends/sqlalchemy/alembic/versions/1cea328f0f65_initial_logbook_deta.py +0 -2
  103. taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py +0 -2
  104. taskflow/persistence/backends/sqlalchemy/alembic/versions/3162c0f3f8e4_add_revert_results_and_revert_failure_.py +0 -2
  105. taskflow/persistence/backends/sqlalchemy/alembic/versions/589dccdf2b6e_rename_taskdetails_to_atomdetails.py +0 -2
  106. taskflow/persistence/backends/sqlalchemy/alembic/versions/84d6e888850_add_task_detail_type.py +0 -2
  107. taskflow/persistence/backends/sqlalchemy/tables.py +0 -2
  108. taskflow/persistence/base.py +2 -4
  109. taskflow/persistence/models.py +19 -24
  110. taskflow/persistence/path_based.py +1 -3
  111. taskflow/retry.py +12 -18
  112. taskflow/states.py +0 -2
  113. taskflow/storage.py +9 -11
  114. taskflow/task.py +15 -18
  115. taskflow/test.py +5 -5
  116. taskflow/tests/test_examples.py +0 -2
  117. taskflow/tests/unit/action_engine/test_builder.py +1 -3
  118. taskflow/tests/unit/action_engine/test_compile.py +4 -6
  119. taskflow/tests/unit/action_engine/test_creation.py +0 -21
  120. taskflow/tests/unit/action_engine/test_scoping.py +1 -3
  121. taskflow/tests/unit/jobs/base.py +1 -3
  122. taskflow/tests/unit/jobs/test_entrypoint.py +0 -2
  123. taskflow/tests/unit/jobs/test_redis_job.py +1 -3
  124. taskflow/tests/unit/jobs/test_zk_job.py +2 -4
  125. taskflow/tests/unit/patterns/test_graph_flow.py +18 -20
  126. taskflow/tests/unit/patterns/test_linear_flow.py +7 -9
  127. taskflow/tests/unit/patterns/test_unordered_flow.py +12 -14
  128. taskflow/tests/unit/persistence/base.py +2 -4
  129. taskflow/tests/unit/persistence/test_dir_persistence.py +2 -4
  130. taskflow/tests/unit/persistence/test_memory_persistence.py +2 -4
  131. taskflow/tests/unit/persistence/test_sql_persistence.py +8 -10
  132. taskflow/tests/unit/persistence/test_zk_persistence.py +2 -4
  133. taskflow/tests/unit/test_arguments_passing.py +3 -25
  134. taskflow/tests/unit/test_check_transition.py +3 -5
  135. taskflow/tests/unit/test_conductors.py +0 -2
  136. taskflow/tests/unit/test_deciders.py +1 -3
  137. taskflow/tests/unit/test_engine_helpers.py +0 -2
  138. taskflow/tests/unit/test_engines.py +19 -102
  139. taskflow/tests/unit/test_exceptions.py +4 -6
  140. taskflow/tests/unit/test_failure.py +10 -12
  141. taskflow/tests/unit/test_flow_dependencies.py +62 -64
  142. taskflow/tests/unit/test_formatters.py +0 -2
  143. taskflow/tests/unit/test_functor_task.py +1 -3
  144. taskflow/tests/unit/test_listeners.py +9 -11
  145. taskflow/tests/unit/test_mapfunctor_task.py +1 -3
  146. taskflow/tests/unit/test_notifier.py +1 -3
  147. taskflow/tests/unit/test_progress.py +2 -4
  148. taskflow/tests/unit/test_reducefunctor_task.py +1 -3
  149. taskflow/tests/unit/test_retries.py +1 -25
  150. taskflow/tests/unit/test_states.py +0 -2
  151. taskflow/tests/unit/test_storage.py +10 -12
  152. taskflow/tests/unit/test_suspend.py +2 -23
  153. taskflow/tests/unit/test_task.py +17 -19
  154. taskflow/tests/unit/test_types.py +4 -6
  155. taskflow/tests/unit/test_utils.py +9 -11
  156. taskflow/tests/unit/test_utils_async_utils.py +0 -2
  157. taskflow/tests/unit/test_utils_binary.py +12 -14
  158. taskflow/tests/unit/test_utils_iter_utils.py +1 -3
  159. taskflow/tests/unit/test_utils_kazoo_utils.py +0 -2
  160. taskflow/tests/unit/test_utils_threading_utils.py +1 -3
  161. taskflow/tests/unit/worker_based/test_creation.py +0 -2
  162. taskflow/tests/unit/worker_based/test_dispatcher.py +0 -2
  163. taskflow/tests/unit/worker_based/test_endpoint.py +2 -4
  164. taskflow/tests/unit/worker_based/test_executor.py +1 -3
  165. taskflow/tests/unit/worker_based/test_message_pump.py +0 -2
  166. taskflow/tests/unit/worker_based/test_pipeline.py +0 -2
  167. taskflow/tests/unit/worker_based/test_protocol.py +2 -4
  168. taskflow/tests/unit/worker_based/test_proxy.py +2 -4
  169. taskflow/tests/unit/worker_based/test_server.py +3 -5
  170. taskflow/tests/unit/worker_based/test_types.py +0 -2
  171. taskflow/tests/unit/worker_based/test_worker.py +1 -3
  172. taskflow/tests/utils.py +11 -15
  173. taskflow/types/entity.py +1 -3
  174. taskflow/types/failure.py +3 -6
  175. taskflow/types/graph.py +14 -18
  176. taskflow/types/latch.py +1 -3
  177. taskflow/types/notifier.py +6 -9
  178. taskflow/types/sets.py +2 -5
  179. taskflow/types/timing.py +1 -3
  180. taskflow/types/tree.py +6 -10
  181. taskflow/utils/async_utils.py +0 -2
  182. taskflow/utils/banner.py +8 -9
  183. taskflow/utils/eventlet_utils.py +0 -2
  184. taskflow/utils/iter_utils.py +0 -2
  185. taskflow/utils/kazoo_utils.py +7 -9
  186. taskflow/utils/kombu_utils.py +5 -7
  187. taskflow/utils/misc.py +4 -6
  188. taskflow/utils/persistence_utils.py +0 -2
  189. taskflow/utils/redis_utils.py +2 -4
  190. taskflow/utils/schema_utils.py +0 -2
  191. taskflow/utils/threading_utils.py +1 -3
  192. taskflow/version.py +1 -3
  193. {taskflow-5.12.0.dist-info → taskflow-6.0.1.dist-info}/AUTHORS +1 -0
  194. {taskflow-5.12.0.dist-info → taskflow-6.0.1.dist-info}/METADATA +1 -1
  195. taskflow-6.0.1.dist-info/RECORD +243 -0
  196. {taskflow-5.12.0.dist-info → taskflow-6.0.1.dist-info}/WHEEL +1 -1
  197. taskflow-6.0.1.dist-info/pbr.json +1 -0
  198. taskflow/engines/action_engine/process_executor.py +0 -720
  199. taskflow/tests/unit/action_engine/test_process_executor.py +0 -106
  200. taskflow-5.12.0.dist-info/RECORD +0 -244
  201. taskflow-5.12.0.dist-info/pbr.json +0 -1
  202. {taskflow-5.12.0.dist-info → taskflow-6.0.1.dist-info}/LICENSE +0 -0
  203. {taskflow-5.12.0.dist-info → taskflow-6.0.1.dist-info}/entry_points.txt +0 -0
  204. {taskflow-5.12.0.dist-info → taskflow-6.0.1.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -30,9 +28,9 @@ from taskflow.types import failure
30
28
  from taskflow.utils import persistence_utils as p_utils
31
29
 
32
30
 
33
- class StorageTestMixin(object):
31
+ class StorageTestMixin:
34
32
  def setUp(self):
35
- super(StorageTestMixin, self).setUp()
33
+ super().setUp()
36
34
  self.backend = None
37
35
  self.thread_count = 50
38
36
 
@@ -40,7 +38,7 @@ class StorageTestMixin(object):
40
38
  with contextlib.closing(self.backend) as be:
41
39
  with contextlib.closing(be.get_connection()) as conn:
42
40
  conn.clear_all()
43
- super(StorageTestMixin, self).tearDown()
41
+ super().tearDown()
44
42
 
45
43
  @staticmethod
46
44
  def _run_many_threads(threads):
@@ -357,14 +355,14 @@ class StorageTestMixin(object):
357
355
  s.inject({'foo': 'bar', 'spam': 'eggs'})
358
356
  self.assertEqual({'viking': 'eggs'},
359
357
  s.fetch_mapped_args({'viking': 'spam'},
360
- optional_args=set(['viking'])))
358
+ optional_args={'viking'}))
361
359
 
362
360
  def test_fetch_optional_args_not_found(self):
363
361
  s = self._get_storage()
364
362
  s.inject({'foo': 'bar', 'spam': 'eggs'})
365
363
  self.assertEqual({},
366
364
  s.fetch_mapped_args({'viking': 'helmet'},
367
- optional_args=set(['viking'])))
365
+ optional_args={'viking'}))
368
366
 
369
367
  def test_set_and_get_task_state(self):
370
368
  s = self._get_storage()
@@ -437,7 +435,7 @@ class StorageTestMixin(object):
437
435
 
438
436
  def test_result_is_checked(self):
439
437
  s = self._get_storage()
440
- s.ensure_atom(test_utils.NoopTask('my task', provides=set(['result'])))
438
+ s.ensure_atom(test_utils.NoopTask('my task', provides={'result'}))
441
439
  s.save('my task', {})
442
440
  self.assertRaisesRegex(exceptions.NotFound,
443
441
  '^Unable to find result', s.fetch, 'result')
@@ -539,7 +537,7 @@ class StorageTestMixin(object):
539
537
  s = self._get_storage()
540
538
  s.ensure_atom(t)
541
539
  missing = s.fetch_unsatisfied_args(t.name, t.rebind)
542
- self.assertEqual(set(['x']), missing)
540
+ self.assertEqual({'x'}, missing)
543
541
  s.inject_atom_args(t.name, {'x': 2}, transient=False)
544
542
  missing = s.fetch_unsatisfied_args(t.name, t.rebind)
545
543
  self.assertEqual(set(), missing)
@@ -551,7 +549,7 @@ class StorageTestMixin(object):
551
549
  s = self._get_storage()
552
550
  s.ensure_atom(t)
553
551
  missing = s.fetch_unsatisfied_args(t.name, t.rebind)
554
- self.assertEqual(set(['x']), missing)
552
+ self.assertEqual({'x'}, missing)
555
553
  s.inject_atom_args(t.name, {'x': 2}, transient=False)
556
554
  s.inject_atom_args(t.name, {'x': 3}, transient=True)
557
555
  missing = s.fetch_unsatisfied_args(t.name, t.rebind)
@@ -589,13 +587,13 @@ class StorageTestMixin(object):
589
587
 
590
588
  class StorageMemoryTest(StorageTestMixin, test.TestCase):
591
589
  def setUp(self):
592
- super(StorageMemoryTest, self).setUp()
590
+ super().setUp()
593
591
  self.backend = backends.fetch({'connection': 'memory://'})
594
592
 
595
593
 
596
594
  class StorageSQLTest(StorageTestMixin, test.TestCase):
597
595
  def setUp(self):
598
- super(StorageSQLTest, self).setUp()
596
+ super().setUp()
599
597
  self.backend = backends.fetch({'connection': 'sqlite://'})
600
598
  with contextlib.closing(self.backend.get_connection()) as conn:
601
599
  conn.upgrade()
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -25,23 +23,18 @@ from taskflow import test
25
23
  from taskflow.tests import utils
26
24
  from taskflow.utils import eventlet_utils as eu
27
25
 
28
- try:
29
- from taskflow.engines.action_engine import process_executor as pe
30
- except ImportError:
31
- pe = None
32
-
33
26
 
34
27
  class SuspendingListener(utils.CaptureListener):
35
28
 
36
29
  def __init__(self, engine,
37
30
  task_name, task_state, capture_flow=False):
38
- super(SuspendingListener, self).__init__(
31
+ super().__init__(
39
32
  engine,
40
33
  capture_flow=capture_flow)
41
34
  self._revert_match = (task_name, task_state)
42
35
 
43
36
  def _task_receiver(self, state, details):
44
- super(SuspendingListener, self)._task_receiver(state, details)
37
+ super()._task_receiver(state, details)
45
38
  if (details['task_name'], state) == self._revert_match:
46
39
  self._engine.suspend()
47
40
 
@@ -227,17 +220,3 @@ class ParallelEngineWithEventletTest(SuspendTest, test.TestCase):
227
220
  return taskflow.engines.load(flow, flow_detail=flow_detail,
228
221
  backend=self.backend, engine='parallel',
229
222
  executor=executor)
230
-
231
-
232
- @testtools.skipIf(pe is None, 'process_executor is not available')
233
- class ParallelEngineWithProcessTest(SuspendTest, test.TestCase):
234
- _EXECUTOR_WORKERS = 2
235
-
236
- def _make_engine(self, flow, flow_detail=None, executor=None):
237
- if executor is None:
238
- executor = 'processes'
239
- return taskflow.engines.load(flow, flow_detail=flow_detail,
240
- engine='parallel',
241
- backend=self.backend,
242
- executor=executor,
243
- max_workers=self._EXECUTOR_WORKERS)
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright 2015 Hewlett-Packard Development Company, L.P.
4
2
  # Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
5
3
  #
@@ -81,7 +79,7 @@ class TaskTest(test.TestCase):
81
79
 
82
80
  def test_generated_name(self):
83
81
  my_task = MyTask()
84
- self.assertEqual('%s.%s' % (__name__, 'MyTask'),
82
+ self.assertEqual('{}.{}'.format(__name__, 'MyTask'),
85
83
  my_task.name)
86
84
 
87
85
  def test_task_str(self):
@@ -121,7 +119,7 @@ class TaskTest(test.TestCase):
121
119
  }
122
120
  self.assertEqual(expected,
123
121
  my_task.rebind)
124
- self.assertEqual(set(['spam', 'eggs', 'context']),
122
+ self.assertEqual({'spam', 'eggs', 'context'},
125
123
  my_task.requires)
126
124
 
127
125
  def test_requires_amended(self):
@@ -150,12 +148,12 @@ class TaskTest(test.TestCase):
150
148
 
151
149
  def test_requires_ignores_optional(self):
152
150
  my_task = DefaultArgTask()
153
- self.assertEqual(set(['spam']), my_task.requires)
154
- self.assertEqual(set(['eggs']), my_task.optional)
151
+ self.assertEqual({'spam'}, my_task.requires)
152
+ self.assertEqual({'eggs'}, my_task.optional)
155
153
 
156
154
  def test_requires_allows_optional(self):
157
155
  my_task = DefaultArgTask(requires=('spam', 'eggs'))
158
- self.assertEqual(set(['spam', 'eggs']), my_task.requires)
156
+ self.assertEqual({'spam', 'eggs'}, my_task.requires)
159
157
  self.assertEqual(set(), my_task.optional)
160
158
 
161
159
  def test_rebind_includes_optional(self):
@@ -174,7 +172,7 @@ class TaskTest(test.TestCase):
174
172
  'context': 'c'
175
173
  }
176
174
  self.assertEqual(expected, my_task.rebind)
177
- self.assertEqual(set(['a', 'b', 'c']),
175
+ self.assertEqual({'a', 'b', 'c'},
178
176
  my_task.requires)
179
177
 
180
178
  def test_rebind_partial(self):
@@ -185,7 +183,7 @@ class TaskTest(test.TestCase):
185
183
  'context': 'context'
186
184
  }
187
185
  self.assertEqual(expected, my_task.rebind)
188
- self.assertEqual(set(['a', 'b', 'context']),
186
+ self.assertEqual({'a', 'b', 'context'},
189
187
  my_task.requires)
190
188
 
191
189
  def test_rebind_unknown(self):
@@ -208,7 +206,7 @@ class TaskTest(test.TestCase):
208
206
  'eggs': 'c'
209
207
  }
210
208
  self.assertEqual(expected, my_task.rebind)
211
- self.assertEqual(set(['a', 'b', 'c']),
209
+ self.assertEqual({'a', 'b', 'c'},
212
210
  my_task.requires)
213
211
 
214
212
  def test_rebind_list_partial(self):
@@ -219,7 +217,7 @@ class TaskTest(test.TestCase):
219
217
  'eggs': 'eggs'
220
218
  }
221
219
  self.assertEqual(expected, my_task.rebind)
222
- self.assertEqual(set(['a', 'b', 'eggs']),
220
+ self.assertEqual({'a', 'b', 'eggs'},
223
221
  my_task.requires)
224
222
 
225
223
  def test_rebind_list_more(self):
@@ -234,7 +232,7 @@ class TaskTest(test.TestCase):
234
232
  'c': 'c'
235
233
  }
236
234
  self.assertEqual(expected, my_task.rebind)
237
- self.assertEqual(set(['a', 'b', 'c']),
235
+ self.assertEqual({'a', 'b', 'c'},
238
236
  my_task.requires)
239
237
 
240
238
  def test_rebind_list_bad_value(self):
@@ -243,12 +241,12 @@ class TaskTest(test.TestCase):
243
241
 
244
242
  def test_default_provides(self):
245
243
  my_task = DefaultProvidesTask()
246
- self.assertEqual(set(['def']), my_task.provides)
244
+ self.assertEqual({'def'}, my_task.provides)
247
245
  self.assertEqual({'def': None}, my_task.save_as)
248
246
 
249
247
  def test_default_provides_can_be_overridden(self):
250
248
  my_task = DefaultProvidesTask(provides=('spam', 'eggs'))
251
- self.assertEqual(set(['spam', 'eggs']), my_task.provides)
249
+ self.assertEqual({'spam', 'eggs'}, my_task.provides)
252
250
  self.assertEqual({'spam': 0, 'eggs': 1}, my_task.save_as)
253
251
 
254
252
  def test_update_progress_within_bounds(self):
@@ -366,7 +364,7 @@ class TaskTest(test.TestCase):
366
364
  my_task = SeparateRevertTask(rebind=('a',), revert_rebind=('b',))
367
365
  self.assertEqual({'execute_arg': 'a'}, my_task.rebind)
368
366
  self.assertEqual({'revert_arg': 'b'}, my_task.revert_rebind)
369
- self.assertEqual(set(['a', 'b']),
367
+ self.assertEqual({'a', 'b'},
370
368
  my_task.requires)
371
369
 
372
370
  my_task = SeparateRevertTask(requires='execute_arg',
@@ -374,13 +372,13 @@ class TaskTest(test.TestCase):
374
372
 
375
373
  self.assertEqual({'execute_arg': 'execute_arg'}, my_task.rebind)
376
374
  self.assertEqual({'revert_arg': 'revert_arg'}, my_task.revert_rebind)
377
- self.assertEqual(set(['execute_arg', 'revert_arg']),
375
+ self.assertEqual({'execute_arg', 'revert_arg'},
378
376
  my_task.requires)
379
377
 
380
378
  def test_separate_revert_optional_args(self):
381
379
  my_task = SeparateRevertOptionalTask()
382
- self.assertEqual(set(['execute_arg']), my_task.optional)
383
- self.assertEqual(set(['revert_arg']), my_task.revert_optional)
380
+ self.assertEqual({'execute_arg'}, my_task.optional)
381
+ self.assertEqual({'revert_arg'}, my_task.revert_optional)
384
382
 
385
383
  def test_revert_kwargs(self):
386
384
  my_task = RevertKwargsTask()
@@ -389,7 +387,7 @@ class TaskTest(test.TestCase):
389
387
  self.assertEqual(expected_rebind, my_task.rebind)
390
388
  expected_rebind = {'execute_arg1': 'execute_arg1'}
391
389
  self.assertEqual(expected_rebind, my_task.revert_rebind)
392
- self.assertEqual(set(['execute_arg1', 'execute_arg2']),
390
+ self.assertEqual({'execute_arg1', 'execute_arg2'},
393
391
  my_task.requires)
394
392
 
395
393
 
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -66,9 +64,9 @@ class GraphTest(test.TestCase):
66
64
  g.add_node("b")
67
65
  g.add_node("c")
68
66
  g.add_edge("b", "c")
69
- self.assertEqual(set(['a', 'b']),
67
+ self.assertEqual({'a', 'b'},
70
68
  set(g.no_predecessors_iter()))
71
- self.assertEqual(set(['a', 'c']),
69
+ self.assertEqual({'a', 'c'},
72
70
  set(g.no_successors_iter()))
73
71
 
74
72
  def test_directed(self):
@@ -534,8 +532,8 @@ CEO
534
532
  def test_dfs_itr(self):
535
533
  root = self._make_species()
536
534
  things = list([n.item for n in root.dfs_iter(include_self=True)])
537
- self.assertEqual(set(['animal', 'reptile', 'mammal', 'horse',
538
- 'primate', 'monkey', 'human']), set(things))
535
+ self.assertEqual({'animal', 'reptile', 'mammal', 'horse',
536
+ 'primate', 'monkey', 'human'}, set(things))
539
537
 
540
538
  def test_dfs_itr_left_to_right(self):
541
539
  root = self._make_species()
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -30,7 +28,7 @@ from taskflow.utils import threading_utils
30
28
  class CachedPropertyTest(test.TestCase):
31
29
  def test_attribute_caching(self):
32
30
 
33
- class A(object):
31
+ class A:
34
32
  def __init__(self):
35
33
  self.call_counter = 0
36
34
 
@@ -46,7 +44,7 @@ class CachedPropertyTest(test.TestCase):
46
44
 
47
45
  def test_custom_property(self):
48
46
 
49
- class A(object):
47
+ class A:
50
48
  @misc.cachedproperty('_c')
51
49
  def b(self):
52
50
  return 'b'
@@ -60,7 +58,7 @@ class CachedPropertyTest(test.TestCase):
60
58
  def try_del(a):
61
59
  del a.b
62
60
 
63
- class A(object):
61
+ class A:
64
62
  @misc.cachedproperty
65
63
  def b(self):
66
64
  return 'b'
@@ -75,7 +73,7 @@ class CachedPropertyTest(test.TestCase):
75
73
  def try_set(a):
76
74
  a.b = 'c'
77
75
 
78
- class A(object):
76
+ class A:
79
77
  @misc.cachedproperty
80
78
  def b(self):
81
79
  return 'b'
@@ -87,7 +85,7 @@ class CachedPropertyTest(test.TestCase):
87
85
 
88
86
  def test_documented_property(self):
89
87
 
90
- class A(object):
88
+ class A:
91
89
  @misc.cachedproperty
92
90
  def b(self):
93
91
  """I like bees."""
@@ -97,7 +95,7 @@ class CachedPropertyTest(test.TestCase):
97
95
 
98
96
  def test_undocumented_property(self):
99
97
 
100
- class A(object):
98
+ class A:
101
99
  @misc.cachedproperty
102
100
  def b(self):
103
101
  return 'b'
@@ -107,7 +105,7 @@ class CachedPropertyTest(test.TestCase):
107
105
  def test_threaded_access_property(self):
108
106
  called = collections.deque()
109
107
 
110
- class A(object):
108
+ class A:
111
109
  @misc.cachedproperty
112
110
  def b(self):
113
111
  called.append(1)
@@ -311,7 +309,7 @@ class TestClamping(test.TestCase):
311
309
  class TestIterable(test.TestCase):
312
310
  def test_string_types(self):
313
311
  self.assertFalse(misc.is_iterable('string'))
314
- self.assertFalse(misc.is_iterable(u'string'))
312
+ self.assertFalse(misc.is_iterable('string'))
315
313
 
316
314
  def test_list(self):
317
315
  self.assertTrue(misc.is_iterable(list()))
@@ -347,7 +345,7 @@ class TestSafeCopyDictRaises(testscenarios.TestWithScenarios):
347
345
  scenarios = [
348
346
  ('list', {'original': [1, 2], 'exception': TypeError}),
349
347
  ('tuple', {'original': (1, 2), 'exception': TypeError}),
350
- ('set', {'original': set([1, 2]), 'exception': TypeError}),
348
+ ('set', {'original': {1, 2}, 'exception': TypeError}),
351
349
  ]
352
350
 
353
351
  def test_exceptions(self):
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -38,15 +36,15 @@ class BinaryEncodeTest(test.TestCase):
38
36
  self._check(data, data)
39
37
 
40
38
  def test_simple_text(self):
41
- self._check(u'hello', _bytes('hello'))
39
+ self._check('hello', _bytes('hello'))
42
40
 
43
41
  def test_unicode_text(self):
44
- self._check(u'привет', _bytes('привет'))
42
+ self._check('привет', _bytes('привет'))
45
43
 
46
44
  def test_unicode_other_encoding(self):
47
- result = misc.binary_encode(u'mañana', 'latin-1')
45
+ result = misc.binary_encode('mañana', 'latin-1')
48
46
  self.assertIsInstance(result, bytes)
49
- self.assertEqual(u'mañana'.encode('latin-1'), result)
47
+ self.assertEqual('mañana'.encode('latin-1'), result)
50
48
 
51
49
 
52
50
  class BinaryDecodeTest(test.TestCase):
@@ -57,24 +55,24 @@ class BinaryDecodeTest(test.TestCase):
57
55
  self.assertEqual(expected_result, result)
58
56
 
59
57
  def test_simple_text(self):
60
- data = u'hello'
58
+ data = 'hello'
61
59
  self._check(data, data)
62
60
 
63
61
  def test_unicode_text(self):
64
- data = u'привет'
62
+ data = 'привет'
65
63
  self._check(data, data)
66
64
 
67
65
  def test_simple_binary(self):
68
- self._check(_bytes('hello'), u'hello')
66
+ self._check(_bytes('hello'), 'hello')
69
67
 
70
68
  def test_unicode_binary(self):
71
- self._check(_bytes('привет'), u'привет')
69
+ self._check(_bytes('привет'), 'привет')
72
70
 
73
71
  def test_unicode_other_encoding(self):
74
- data = u'mañana'.encode('latin-1')
72
+ data = 'mañana'.encode('latin-1')
75
73
  result = misc.binary_decode(data, 'latin-1')
76
74
  self.assertIsInstance(result, str)
77
- self.assertEqual(u'mañana', result)
75
+ self.assertEqual('mañana', result)
78
76
 
79
77
 
80
78
  class DecodeJsonTest(test.TestCase):
@@ -85,11 +83,11 @@ class DecodeJsonTest(test.TestCase):
85
83
 
86
84
  def test_it_works_with_unicode(self):
87
85
  data = _bytes('{"foo": "фуу"}')
88
- self.assertEqual({"foo": u'фуу'}, misc.decode_json(data))
86
+ self.assertEqual({"foo": 'фуу'}, misc.decode_json(data))
89
87
 
90
88
  def test_handles_invalid_unicode(self):
91
89
  self.assertRaises(ValueError, misc.decode_json,
92
- '{"\xf1": 1}'.encode('latin-1'))
90
+ b'{"\xf1": 1}')
93
91
 
94
92
  def test_handles_bad_json(self):
95
93
  self.assertRaises(ValueError, misc.decode_json,
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -140,7 +138,7 @@ class IterUtilsTest(test.TestCase):
140
138
  self.assertRaises(ValueError, iter_utils.while_is_not, 2, 'a')
141
139
 
142
140
  def test_while_is_not(self):
143
- class Dummy(object):
141
+ class Dummy:
144
142
  def __init__(self, char):
145
143
  self.char = char
146
144
  dummy_list = [Dummy(a)
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) Red Hat
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -53,7 +51,7 @@ class TestThreadBundle(test.TestCase):
53
51
  thread_count = 5
54
52
 
55
53
  def setUp(self):
56
- super(TestThreadBundle, self).setUp()
54
+ super().setUp()
57
55
  self.bundle = tu.ThreadBundle()
58
56
  self.death = threading.Event()
59
57
  self.addCleanup(self.bundle.stop)
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -25,7 +23,7 @@ from taskflow.tests import utils
25
23
  class Task(task.Task):
26
24
 
27
25
  def __init__(self, a, *args, **kwargs):
28
- super(Task, self).__init__(*args, **kwargs)
26
+ super().__init__(*args, **kwargs)
29
27
 
30
28
  def execute(self, *args, **kwargs):
31
29
  pass
@@ -34,7 +32,7 @@ class Task(task.Task):
34
32
  class TestEndpoint(test.TestCase):
35
33
 
36
34
  def setUp(self):
37
- super(TestEndpoint, self).setUp()
35
+ super().setUp()
38
36
  self.task_cls = utils.TaskOneReturn
39
37
  self.task_uuid = 'task-uuid'
40
38
  self.task_args = {'context': 'context'}
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -29,7 +27,7 @@ from taskflow.types import failure
29
27
  class TestWorkerTaskExecutor(test.MockTestCase):
30
28
 
31
29
  def setUp(self):
32
- super(TestWorkerTaskExecutor, self).setUp()
30
+ super().setUp()
33
31
  self.task = test_utils.DummyTask()
34
32
  self.task_uuid = 'task-uuid'
35
33
  self.task_args = {'a': 'a'}
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -25,7 +23,7 @@ from taskflow.tests import utils
25
23
  from taskflow.types import failure
26
24
 
27
25
 
28
- class Unserializable(object):
26
+ class Unserializable:
29
27
  pass
30
28
 
31
29
 
@@ -98,7 +96,7 @@ class TestProtocolValidation(test.TestCase):
98
96
  class TestProtocol(test.TestCase):
99
97
 
100
98
  def setUp(self):
101
- super(TestProtocol, self).setUp()
99
+ super().setUp()
102
100
  self.task = utils.DummyTask()
103
101
  self.task_uuid = 'task-uuid'
104
102
  self.task_action = 'execute'
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -25,7 +23,7 @@ from taskflow.utils import threading_utils
25
23
  class TestProxy(test.MockTestCase):
26
24
 
27
25
  def setUp(self):
28
- super(TestProxy, self).setUp()
26
+ super().setUp()
29
27
  self.topic = 'test-topic'
30
28
  self.broker_url = 'test-url'
31
29
  self.exchange = 'test-exchange'
@@ -72,7 +70,7 @@ class TestProxy(test.MockTestCase):
72
70
  self.resetMasterMock()
73
71
 
74
72
  def _queue_name(self, topic):
75
- return "%s_%s" % (self.exchange, topic)
73
+ return "{}_{}".format(self.exchange, topic)
76
74
 
77
75
  def proxy_start_calls(self, calls, exc_type=mock.ANY):
78
76
  return [
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -27,7 +25,7 @@ from taskflow.types import failure
27
25
  class TestServer(test.MockTestCase):
28
26
 
29
27
  def setUp(self):
30
- super(TestServer, self).setUp()
28
+ super().setUp()
31
29
  self.server_topic = 'server-topic'
32
30
  self.server_exchange = 'server-exchange'
33
31
  self.broker_url = 'test-url'
@@ -140,8 +138,8 @@ class TestServer(test.MockTestCase):
140
138
  self.assertEqual(
141
139
  (self.task.name, self.task.name, 'revert',
142
140
  dict(arguments=self.task_args,
143
- failures=dict((i, utils.FailureMatcher(f))
144
- for i, f in failures.items()))),
141
+ failures={i: utils.FailureMatcher(f)
142
+ for i, f in failures.items()})),
145
143
  (task_cls, task_name, action, task_args))
146
144
 
147
145
  @mock.patch("taskflow.engines.worker_based.server.LOG.critical")
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -27,7 +25,7 @@ from taskflow.tests import utils
27
25
  class TestWorker(test.MockTestCase):
28
26
 
29
27
  def setUp(self):
30
- super(TestWorker, self).setUp()
28
+ super().setUp()
31
29
  self.task_cls = utils.DummyTask
32
30
  self.task_name = reflection.get_class_name(self.task_cls)
33
31
  self.broker_url = 'test-url'