scipion-pyworkflow 3.10.6__py3-none-any.whl → 3.11.0__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 (123) hide show
  1. pyworkflow/config.py +131 -67
  2. pyworkflow/constants.py +2 -1
  3. pyworkflow/plugin.py +93 -44
  4. pyworkflow/resources/showj/arrowDown.png +0 -0
  5. pyworkflow/resources/showj/arrowUp.png +0 -0
  6. pyworkflow/resources/showj/background_section.png +0 -0
  7. pyworkflow/resources/showj/colRowModeOff.png +0 -0
  8. pyworkflow/resources/showj/colRowModeOn.png +0 -0
  9. pyworkflow/resources/showj/delete.png +0 -0
  10. pyworkflow/resources/showj/doc_icon.png +0 -0
  11. pyworkflow/resources/showj/download_icon.png +0 -0
  12. pyworkflow/resources/showj/enabled_gallery.png +0 -0
  13. pyworkflow/resources/showj/galleryViewOff.png +0 -0
  14. pyworkflow/resources/showj/galleryViewOn.png +0 -0
  15. pyworkflow/resources/showj/goto.png +0 -0
  16. pyworkflow/resources/showj/menu.png +0 -0
  17. pyworkflow/resources/showj/separator.png +0 -0
  18. pyworkflow/resources/showj/tableViewOff.png +0 -0
  19. pyworkflow/resources/showj/tableViewOn.png +0 -0
  20. pyworkflow/resources/showj/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  21. pyworkflow/resources/showj/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  22. pyworkflow/resources/showj/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  23. pyworkflow/resources/showj/volumeOff.png +0 -0
  24. pyworkflow/resources/showj/volumeOn.png +0 -0
  25. pyworkflow/viewer.py +23 -1
  26. pyworkflowtests/protocols.py +1 -3
  27. {scipion_pyworkflow-3.10.6.dist-info → scipion_pyworkflow-3.11.0.dist-info}/METADATA +13 -27
  28. scipion_pyworkflow-3.11.0.dist-info/RECORD +71 -0
  29. {scipion_pyworkflow-3.10.6.dist-info → scipion_pyworkflow-3.11.0.dist-info}/WHEEL +1 -1
  30. pyworkflow/apps/__init__.py +0 -29
  31. pyworkflow/apps/pw_manager.py +0 -37
  32. pyworkflow/apps/pw_plot.py +0 -51
  33. pyworkflow/apps/pw_project.py +0 -113
  34. pyworkflow/apps/pw_protocol_list.py +0 -143
  35. pyworkflow/apps/pw_protocol_run.py +0 -51
  36. pyworkflow/apps/pw_run_tests.py +0 -267
  37. pyworkflow/apps/pw_schedule_run.py +0 -322
  38. pyworkflow/apps/pw_sleep.py +0 -37
  39. pyworkflow/apps/pw_sync_data.py +0 -439
  40. pyworkflow/apps/pw_viewer.py +0 -78
  41. pyworkflow/gui/__init__.py +0 -36
  42. pyworkflow/gui/browser.py +0 -726
  43. pyworkflow/gui/canvas.py +0 -1190
  44. pyworkflow/gui/dialog.py +0 -977
  45. pyworkflow/gui/form.py +0 -2637
  46. pyworkflow/gui/graph.py +0 -247
  47. pyworkflow/gui/graph_layout.py +0 -271
  48. pyworkflow/gui/gui.py +0 -566
  49. pyworkflow/gui/matplotlib_image.py +0 -233
  50. pyworkflow/gui/plotter.py +0 -247
  51. pyworkflow/gui/project/__init__.py +0 -25
  52. pyworkflow/gui/project/base.py +0 -192
  53. pyworkflow/gui/project/constants.py +0 -139
  54. pyworkflow/gui/project/labels.py +0 -205
  55. pyworkflow/gui/project/project.py +0 -492
  56. pyworkflow/gui/project/searchprotocol.py +0 -154
  57. pyworkflow/gui/project/searchrun.py +0 -181
  58. pyworkflow/gui/project/steps.py +0 -171
  59. pyworkflow/gui/project/utils.py +0 -332
  60. pyworkflow/gui/project/variables.py +0 -179
  61. pyworkflow/gui/project/viewdata.py +0 -472
  62. pyworkflow/gui/project/viewprojects.py +0 -510
  63. pyworkflow/gui/project/viewprotocols.py +0 -2093
  64. pyworkflow/gui/project/viewprotocols_extra.py +0 -559
  65. pyworkflow/gui/text.py +0 -771
  66. pyworkflow/gui/tooltip.py +0 -185
  67. pyworkflow/gui/tree.py +0 -684
  68. pyworkflow/gui/widgets.py +0 -307
  69. pyworkflow/mapper/__init__.py +0 -26
  70. pyworkflow/mapper/mapper.py +0 -222
  71. pyworkflow/mapper/sqlite.py +0 -1581
  72. pyworkflow/mapper/sqlite_db.py +0 -145
  73. pyworkflow/project/__init__.py +0 -31
  74. pyworkflow/project/config.py +0 -454
  75. pyworkflow/project/manager.py +0 -180
  76. pyworkflow/project/project.py +0 -2007
  77. pyworkflow/protocol/__init__.py +0 -38
  78. pyworkflow/protocol/bibtex.py +0 -48
  79. pyworkflow/protocol/constants.py +0 -87
  80. pyworkflow/protocol/executor.py +0 -471
  81. pyworkflow/protocol/hosts.py +0 -314
  82. pyworkflow/protocol/launch.py +0 -270
  83. pyworkflow/protocol/package.py +0 -42
  84. pyworkflow/protocol/params.py +0 -741
  85. pyworkflow/protocol/protocol.py +0 -2641
  86. pyworkflow/tests/__init__.py +0 -29
  87. pyworkflow/tests/test_utils.py +0 -25
  88. pyworkflow/tests/tests.py +0 -341
  89. pyworkflow/utils/__init__.py +0 -38
  90. pyworkflow/utils/dataset.py +0 -414
  91. pyworkflow/utils/echo.py +0 -104
  92. pyworkflow/utils/graph.py +0 -169
  93. pyworkflow/utils/log.py +0 -284
  94. pyworkflow/utils/path.py +0 -528
  95. pyworkflow/utils/process.py +0 -153
  96. pyworkflow/utils/profiler.py +0 -92
  97. pyworkflow/utils/progressbar.py +0 -154
  98. pyworkflow/utils/properties.py +0 -631
  99. pyworkflow/utils/reflection.py +0 -129
  100. pyworkflow/utils/utils.py +0 -879
  101. pyworkflow/utils/which.py +0 -229
  102. pyworkflow/webservices/__init__.py +0 -8
  103. pyworkflow/webservices/config.py +0 -11
  104. pyworkflow/webservices/notifier.py +0 -162
  105. pyworkflow/webservices/repository.py +0 -59
  106. pyworkflow/webservices/workflowhub.py +0 -74
  107. pyworkflowtests/tests/__init__.py +0 -0
  108. pyworkflowtests/tests/test_canvas.py +0 -72
  109. pyworkflowtests/tests/test_domain.py +0 -45
  110. pyworkflowtests/tests/test_logs.py +0 -74
  111. pyworkflowtests/tests/test_mappers.py +0 -392
  112. pyworkflowtests/tests/test_object.py +0 -507
  113. pyworkflowtests/tests/test_project.py +0 -42
  114. pyworkflowtests/tests/test_protocol_execution.py +0 -142
  115. pyworkflowtests/tests/test_protocol_export.py +0 -78
  116. pyworkflowtests/tests/test_protocol_output.py +0 -158
  117. pyworkflowtests/tests/test_streaming.py +0 -47
  118. pyworkflowtests/tests/test_utils.py +0 -210
  119. scipion_pyworkflow-3.10.6.dist-info/RECORD +0 -140
  120. scipion_pyworkflow-3.10.6.dist-info/dependency_links.txt +0 -1
  121. {scipion_pyworkflow-3.10.6.dist-info → scipion_pyworkflow-3.11.0.dist-info}/entry_points.txt +0 -0
  122. {scipion_pyworkflow-3.10.6.dist-info → scipion_pyworkflow-3.11.0.dist-info}/licenses/LICENSE.txt +0 -0
  123. {scipion_pyworkflow-3.10.6.dist-info → scipion_pyworkflow-3.11.0.dist-info}/top_level.txt +0 -0
@@ -1,92 +0,0 @@
1
-
2
- import time
3
- instances = {}
4
- elapsedTime = {}
5
-
6
-
7
- def getInstancesCount():
8
- return instances
9
-
10
-
11
- def instanceCreated(cls):
12
- instances[cls] = instances.get(cls, 0) + 1
13
-
14
-
15
- def instanceDestroyed(cls):
16
- instances[cls] = instances.get(cls, 0) - 1
17
-
18
-
19
- def printInstances():
20
- for k, v in instances.items():
21
- print("%s: %d", k, v)
22
-
23
-
24
- def waitForDebugger(seconds=20):
25
- print("Waiting for debugger %d seconds." % seconds)
26
- from pyworkflow.utils import printTraceBack
27
- printTraceBack()
28
-
29
- while seconds > 0:
30
- time.sleep(1)
31
- # Set seconds to 0:
32
- # Execute this in the debugger: seconds = 0
33
- print(str(seconds) + " seconds left.")
34
- seconds -= 1
35
-
36
-
37
- # From: https://www.huyng.com/posts/python-performance-analysis
38
-
39
-
40
- class Timer(object):
41
- indentation = 0
42
- blackList = []
43
- whiteList = []
44
- minms = 1
45
-
46
- def __init__(self, name=None, verbose=True):
47
- self.verbose = verbose
48
- self.name = name
49
- Timer.indentation += 1
50
-
51
- def __enter__(self):
52
- self.start = time.time()
53
- return self
54
-
55
- def __exit__(self, *args):
56
- self.end = time.time()
57
- self.secs = self.end - self.start
58
- self.msecs = self.secs * 1000 # millisecs
59
- Timer.indentation -= 1
60
-
61
- toPrint = (len(Timer.whiteList) == 0)
62
-
63
- if any(self.name.startswith(s) for s in Timer.blackList):
64
- toPrint = False
65
-
66
- if any(self.name.startswith(s) for s in Timer.whiteList):
67
- toPrint = True
68
-
69
- if self.verbose and toPrint and self.msecs > Timer.minms:
70
- print('{0}{1:10.0f}\tms\t{2}'.format('\t' * Timer.indentation, self.msecs, self.name))
71
-
72
- # To monitor memory leaks:
73
- # 1.- Check you have installed pympler: scipion run pip install pympler
74
- # 2.- Uncomment lines below
75
- # 3.- Add a with statement like:
76
- # with monitor.MemoryMonitor():
77
- # <code to analyze>
78
- # from pympler.tracker import SummaryTracker
79
- #
80
- #
81
- # class MemoryMonitor(object):
82
- #
83
- # def __init__(self):
84
- # self.tracker = None
85
- #
86
- # def __enter__(self):
87
- # self.tracker = SummaryTracker()
88
- # self.tracker.print_diff()
89
- # return self
90
- #
91
- # def __exit__(self, *args):
92
- # self.tracker.print_diff()
@@ -1,154 +0,0 @@
1
- # **************************************************************************
2
- # *
3
- # * Authors: Roberto Marabini (roberto@cnb.csic.es) [1]
4
- # * J.M. De la Rosa Trevin (delarosatrevin@scilifelab.se) [2]
5
- # *
6
- # * [1] Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
7
- # * [2] SciLifeLab, Stockholm University
8
- # *
9
- # * This program is free software; you can redistribute it and/or modify
10
- # * it under the terms of the GNU General Public License as published by
11
- # * the Free Software Foundation; either version 3 of the License, or
12
- # * (at your option) any later version.
13
- # *
14
- # * This program is distributed in the hope that it will be useful,
15
- # * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # * GNU General Public License for more details.
18
- # *
19
- # * You should have received a copy of the GNU General Public License
20
- # * along with this program; if not, write to the Free Software
21
- # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22
- # * 02111-1307 USA
23
- # *
24
- # * All comments concerning this program package may be sent to the
25
- # * e-mail address 'scipion@cnb.csic.es'
26
- # *
27
- # **************************************************************************
28
-
29
-
30
- import sys
31
- import re
32
-
33
-
34
- class ProgressBar(object):
35
- """ Text progress bar class for Python.
36
-
37
- A text progress bar is typically used to display the progress of a long-running
38
- operation, providing a visual cue that processing is underway.
39
-
40
- Example::
41
-
42
- N = 1000
43
- pb = ProgressBar(N, fmt=ProgressBar.FULL)
44
- pb.start()
45
- for x in range(N):
46
- pb.update(x+1)
47
- sleep(0.1)
48
- pb.finish()
49
-
50
- Optionally you can pass a step param (default to 10000) and call increase in each loop. Only when the step is reached, the progress is printed.
51
- """
52
- DEFAULT = 'Progress: %(bar)s %(percent)3d%%'
53
- FULL = '%(bar)s %(current)d/%(total)d (%(percent)3d%%) %(remaining)d to go'
54
- # scipion uses variable fonts so the bar size changes
55
- # since the space width is different from the = width
56
- NOBAR = '%(current)d/%(total)d (%(percent)3d%%) %(remaining)d to go'
57
- OBJID = '%(bar)s %(current)d/%(total)d (%(percent)3d%%) (objectId=%(objectId)d)'
58
- DOT = '.'
59
-
60
- def __init__(self, total, width=40, fmt=DEFAULT, symbol='=',
61
- output=None, extraArgs=None, step=10000):
62
- """
63
- Create a new ProgressBar object.
64
-
65
- :param total: The total amount that will be running the progress bar.
66
- The value in the update() method can no go greater than this value.
67
- :param width: progress bar width (without the percentage and number of
68
- iterations loop)
69
- :param fmt: predefined format string, so far DEFAULT, FULL, OBJID and
70
- DOT are defined.
71
- :param symbol: progress bar is made with this symbol
72
- :param output:
73
- :param extraArgs: Additional arguments that can be passed to be used
74
- the fmt format. (e.g extraArgs={'objectId': 1} for fmt=OBJID
75
- :param step: interval between printing progress. Use in combination with "increase"
76
- """
77
- if len(symbol) != 1:
78
- raise Exception("Symbol should be only 1 character length. ")
79
-
80
- self._total = total
81
- self._width = width
82
- self._symbol = symbol
83
- self._output = output or sys.stdout
84
- self._current = -1
85
- self._extraArgs = extraArgs or {}
86
- self._fmt = fmt
87
- self._directPrint = fmt == self.DOT
88
- self.step = step
89
-
90
- if not self._directPrint:
91
- # This line computes the number of digits
92
- # in total and rewrites the fmt string
93
- # so if total = 100, %d is converted to %3d
94
- self._fmt = re.sub(r'(?P<name>%\(.+?\))d',
95
- r'\g<name>%dd' % len(str(total)), fmt)
96
-
97
- def __getStr(self):
98
- """ Internal function to return the current string value.
99
- It should be called after the value has being set.
100
- """
101
- if self._directPrint: # print just a dot
102
- return self._fmt if self._current else ''
103
-
104
- percent = self._current / float(self._total)
105
- size = int(self._width * percent)
106
- remaining = self._total - self._current
107
- bar = '[' + self._symbol * size + ' ' * (self._width - size) + ']'
108
-
109
- args = {
110
- 'total': self._total,
111
- 'bar': bar,
112
- 'current': self._current,
113
- 'percent': percent * 100,
114
- 'remaining': remaining,
115
- }
116
- args.update(self._extraArgs)
117
-
118
- return '\r' + self._fmt % args
119
-
120
- def start(self):
121
- """ Print empty progress bar. """
122
- self.update(0)
123
-
124
- def update(self, value):
125
- """
126
- Update the current value and print the progress.
127
-
128
- :param value: New value, should be greater than the previous
129
- value and less or equal the total value
130
- :return:
131
- """
132
- if value < 0 or value <= self._current or value > self._total:
133
- raise Exception("Incorrect value provided. It should be greater "
134
- "than previous value and between 0 and total. ")
135
- self._current = value
136
- self._output.write(self.__getStr())
137
- self._output.flush()
138
-
139
- def increase(self):
140
- """ Increase the value by 1. Is new value matches the step. update is called"""
141
- nextValue = self._current + 1
142
- if (nextValue) % self.step == 0:
143
- self.update(nextValue)
144
- else:
145
- self._current=nextValue
146
-
147
- def finish(self, printNewLine=True):
148
- """ Finalize the progress and
149
- print last update with 100% complete message """
150
- if self._current < self._total:
151
- self.update(self._total)
152
- # print a new line
153
- if printNewLine:
154
- self._output.write("\n")