scipion-pyworkflow 3.11.0__py3-none-any.whl → 3.11.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 (98) hide show
  1. pyworkflow/apps/__init__.py +29 -0
  2. pyworkflow/apps/pw_manager.py +37 -0
  3. pyworkflow/apps/pw_plot.py +51 -0
  4. pyworkflow/apps/pw_project.py +113 -0
  5. pyworkflow/apps/pw_protocol_list.py +143 -0
  6. pyworkflow/apps/pw_protocol_run.py +51 -0
  7. pyworkflow/apps/pw_run_tests.py +267 -0
  8. pyworkflow/apps/pw_schedule_run.py +322 -0
  9. pyworkflow/apps/pw_sleep.py +37 -0
  10. pyworkflow/apps/pw_sync_data.py +439 -0
  11. pyworkflow/apps/pw_viewer.py +78 -0
  12. pyworkflow/constants.py +1 -1
  13. pyworkflow/gui/__init__.py +36 -0
  14. pyworkflow/gui/browser.py +760 -0
  15. pyworkflow/gui/canvas.py +1190 -0
  16. pyworkflow/gui/dialog.py +979 -0
  17. pyworkflow/gui/form.py +2726 -0
  18. pyworkflow/gui/graph.py +247 -0
  19. pyworkflow/gui/graph_layout.py +271 -0
  20. pyworkflow/gui/gui.py +566 -0
  21. pyworkflow/gui/matplotlib_image.py +233 -0
  22. pyworkflow/gui/plotter.py +247 -0
  23. pyworkflow/gui/project/__init__.py +25 -0
  24. pyworkflow/gui/project/base.py +192 -0
  25. pyworkflow/gui/project/constants.py +139 -0
  26. pyworkflow/gui/project/labels.py +205 -0
  27. pyworkflow/gui/project/project.py +491 -0
  28. pyworkflow/gui/project/searchprotocol.py +238 -0
  29. pyworkflow/gui/project/searchrun.py +181 -0
  30. pyworkflow/gui/project/steps.py +171 -0
  31. pyworkflow/gui/project/utils.py +332 -0
  32. pyworkflow/gui/project/variables.py +179 -0
  33. pyworkflow/gui/project/viewdata.py +472 -0
  34. pyworkflow/gui/project/viewprojects.py +510 -0
  35. pyworkflow/gui/project/viewprotocols.py +2116 -0
  36. pyworkflow/gui/project/viewprotocols_extra.py +562 -0
  37. pyworkflow/gui/text.py +771 -0
  38. pyworkflow/gui/tooltip.py +185 -0
  39. pyworkflow/gui/tree.py +684 -0
  40. pyworkflow/gui/widgets.py +307 -0
  41. pyworkflow/mapper/__init__.py +26 -0
  42. pyworkflow/mapper/mapper.py +222 -0
  43. pyworkflow/mapper/sqlite.py +1581 -0
  44. pyworkflow/mapper/sqlite_db.py +145 -0
  45. pyworkflow/project/__init__.py +31 -0
  46. pyworkflow/project/config.py +454 -0
  47. pyworkflow/project/manager.py +180 -0
  48. pyworkflow/project/project.py +2095 -0
  49. pyworkflow/project/usage.py +165 -0
  50. pyworkflow/protocol/__init__.py +38 -0
  51. pyworkflow/protocol/bibtex.py +48 -0
  52. pyworkflow/protocol/constants.py +87 -0
  53. pyworkflow/protocol/executor.py +483 -0
  54. pyworkflow/protocol/hosts.py +317 -0
  55. pyworkflow/protocol/launch.py +277 -0
  56. pyworkflow/protocol/package.py +42 -0
  57. pyworkflow/protocol/params.py +781 -0
  58. pyworkflow/protocol/protocol.py +2707 -0
  59. pyworkflow/tests/__init__.py +29 -0
  60. pyworkflow/tests/test_utils.py +25 -0
  61. pyworkflow/tests/tests.py +341 -0
  62. pyworkflow/utils/__init__.py +38 -0
  63. pyworkflow/utils/dataset.py +414 -0
  64. pyworkflow/utils/echo.py +104 -0
  65. pyworkflow/utils/graph.py +169 -0
  66. pyworkflow/utils/log.py +293 -0
  67. pyworkflow/utils/path.py +528 -0
  68. pyworkflow/utils/process.py +153 -0
  69. pyworkflow/utils/profiler.py +92 -0
  70. pyworkflow/utils/progressbar.py +154 -0
  71. pyworkflow/utils/properties.py +617 -0
  72. pyworkflow/utils/reflection.py +129 -0
  73. pyworkflow/utils/utils.py +880 -0
  74. pyworkflow/utils/which.py +229 -0
  75. pyworkflow/webservices/__init__.py +8 -0
  76. pyworkflow/webservices/config.py +8 -0
  77. pyworkflow/webservices/notifier.py +152 -0
  78. pyworkflow/webservices/repository.py +59 -0
  79. pyworkflow/webservices/workflowhub.py +74 -0
  80. pyworkflowtests/tests/__init__.py +0 -0
  81. pyworkflowtests/tests/test_canvas.py +72 -0
  82. pyworkflowtests/tests/test_domain.py +45 -0
  83. pyworkflowtests/tests/test_logs.py +74 -0
  84. pyworkflowtests/tests/test_mappers.py +392 -0
  85. pyworkflowtests/tests/test_object.py +507 -0
  86. pyworkflowtests/tests/test_project.py +42 -0
  87. pyworkflowtests/tests/test_protocol_execution.py +146 -0
  88. pyworkflowtests/tests/test_protocol_export.py +78 -0
  89. pyworkflowtests/tests/test_protocol_output.py +158 -0
  90. pyworkflowtests/tests/test_streaming.py +47 -0
  91. pyworkflowtests/tests/test_utils.py +210 -0
  92. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/METADATA +2 -2
  93. scipion_pyworkflow-3.11.1.dist-info/RECORD +161 -0
  94. scipion_pyworkflow-3.11.0.dist-info/RECORD +0 -71
  95. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/WHEEL +0 -0
  96. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/entry_points.txt +0 -0
  97. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/licenses/LICENSE.txt +0 -0
  98. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,129 @@
1
+ # **************************************************************************
2
+ # *
3
+ # * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
4
+ # *
5
+ # * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6
+ # *
7
+ # * This program is free software; you can redistribute it and/or modify
8
+ # * it under the terms of the GNU General Public License as published by
9
+ # * the Free Software Foundation; either version 3 of the License, or
10
+ # * (at your option) any later version.
11
+ # *
12
+ # * This program is distributed in the hope that it will be useful,
13
+ # * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # * GNU General Public License for more details.
16
+ # *
17
+ # * You should have received a copy of the GNU General Public License
18
+ # * along with this program; if not, write to the Free Software
19
+ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20
+ # * 02111-1307 USA
21
+ # *
22
+ # * All comments concerning this program package may be sent to the
23
+ # * e-mail address 'scipion@cnb.csic.es'
24
+ # *
25
+ # **************************************************************************
26
+ """
27
+ This module contains reflection utilities
28
+ (dynamically load classes, inspect object properties and others)
29
+ """
30
+
31
+ import os
32
+ from os.path import exists, join
33
+ import sys
34
+ from inspect import isclass
35
+
36
+
37
+ def getModules(path):
38
+ """ Try to find possible sub-modules under path.
39
+ A dictionary will be returned with modules names
40
+ as keys and the modules objects as values.
41
+ """
42
+ sys.path.append(path)
43
+ folders = os.listdir(path)
44
+ modules = {}
45
+
46
+ for f in folders:
47
+ if exists(join(path, f, '__init__.py')):
48
+ try:
49
+ m = __import__(f)
50
+ modules[f] = m
51
+ checkPlugin(m)
52
+ except Exception as ex:
53
+ print(">>> Error loading module: '%s'" % f)
54
+ print(">>> Exception: ", ex)
55
+ import traceback
56
+ traceback.print_exc()
57
+
58
+ return modules
59
+
60
+
61
+ def getSubclassesFromModules(BaseClass, modules, debug=False):
62
+ """ Find subclasses of BaseClass from a give dict of modules.
63
+ """
64
+ subclasses = {}
65
+
66
+ for m in modules.values():
67
+ if debug:
68
+ print("loading module: ", m.__name__)
69
+ subDict = getSubclasses(BaseClass, m.__dict__)
70
+
71
+ for subclass in subDict.values():
72
+ # some protocols have pyworkflow.em.packages. in the __module__ and other no
73
+ moduleName = subclass.__module__.replace('pwem.packages.', '')
74
+ if moduleName.startswith(m.__name__):
75
+ subclass._package = m
76
+ if debug:
77
+ print(" found: ", subclass.__name__, "module: ", subclass.__module__)
78
+ subclasses.update(subDict)
79
+
80
+ return subclasses
81
+
82
+
83
+ def getSubclassesFromPath(BaseClass, path):
84
+ """ Try to find possible sub-packages under path
85
+ and find subclasses of BaseClass from them
86
+ Return a dictionary containing the subclasses.
87
+ """
88
+ modules = getModules(path)
89
+ return getSubclassesFromModules(BaseClass, modules)
90
+
91
+
92
+ def getSubclasses(BaseClass, inputDict):
93
+ """ Iterate over inputDict and find all subclasses
94
+ of BaseClass, that will be set in outputDict.
95
+ """
96
+ outputDict = {}
97
+ for k, v in inputDict.items():
98
+ # Do not add the base class that is imported in all modules
99
+ if (not v==BaseClass) and isclass(v) and issubclass(v, BaseClass):
100
+ outputDict[k] = v
101
+ return outputDict
102
+
103
+
104
+ def checkPlugin(module):
105
+ if not getattr(module, '_plugin', None):
106
+ print('WARNING: module "%s" using old package structure, '
107
+ '_plugin attribute missing' % module.__name__)
108
+
109
+
110
+ def isSameFunction(function1, function2):
111
+ """ Check if the content of 2 functions is the same.
112
+ This could be used to check if a method has been overridden or not
113
+ From https://stackoverflow.com/questions/13620542/detecting-empty-function-definitions-in-python"""
114
+ return function1.__code__.co_code == function2.__code__.co_code
115
+
116
+
117
+ def isModuleAFolder(modulename):
118
+ """ Returns True if a python module is a folder"""
119
+ # So far e can test for the filename
120
+ module = sys.modules[modulename]
121
+
122
+ return module.__file__.endswith("__init__.py")
123
+
124
+
125
+ def isModuleLoaded(modulename):
126
+ """
127
+ Return True if a python module is loaded, False otherwise
128
+ """
129
+ return modulename in sys.modules