genie-python 15.1.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.
- genie_python/.pylintrc +539 -0
- genie_python/__init__.py +1 -0
- genie_python/_version.py +16 -0
- genie_python/block_names.py +123 -0
- genie_python/channel_access_exceptions.py +45 -0
- genie_python/genie.py +2462 -0
- genie_python/genie_advanced.py +418 -0
- genie_python/genie_alerts.py +195 -0
- genie_python/genie_api_setup.py +451 -0
- genie_python/genie_blockserver.py +64 -0
- genie_python/genie_cachannel_wrapper.py +551 -0
- genie_python/genie_change_cache.py +151 -0
- genie_python/genie_dae.py +2219 -0
- genie_python/genie_epics_api.py +906 -0
- genie_python/genie_experimental_data.py +186 -0
- genie_python/genie_logging.py +200 -0
- genie_python/genie_p4p_wrapper.py +203 -0
- genie_python/genie_plot.py +77 -0
- genie_python/genie_pre_post_cmd_manager.py +21 -0
- genie_python/genie_pv_connection_protocol.py +36 -0
- genie_python/genie_script_checker.py +507 -0
- genie_python/genie_script_generator.py +212 -0
- genie_python/genie_simulate.py +69 -0
- genie_python/genie_simulate_impl.py +1265 -0
- genie_python/genie_startup.py +29 -0
- genie_python/genie_toggle_settings.py +58 -0
- genie_python/genie_wait_for_move.py +154 -0
- genie_python/genie_waitfor.py +576 -0
- genie_python/matplotlib_backend/__init__.py +0 -0
- genie_python/matplotlib_backend/ibex_websocket_backend.py +366 -0
- genie_python/mysql_abstraction_layer.py +272 -0
- genie_python/scanning_instrument_pylint_plugin.py +31 -0
- genie_python/testing_utils/__init__.py +4 -0
- genie_python/testing_utils/script_checker.py +63 -0
- genie_python/typings/CaChannel/CaChannel.pyi +893 -0
- genie_python/typings/CaChannel/__init__.pyi +9 -0
- genie_python/typings/CaChannel/_version.pyi +6 -0
- genie_python/typings/CaChannel/ca.pyi +31 -0
- genie_python/utilities.py +406 -0
- genie_python/version.py +6 -0
- genie_python-15.1.0.dist-info/LICENSE +28 -0
- genie_python-15.1.0.dist-info/METADATA +84 -0
- genie_python-15.1.0.dist-info/RECORD +45 -0
- genie_python-15.1.0.dist-info/WHEEL +5 -0
- genie_python-15.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import tempfile
|
|
3
|
+
from types import TracebackType
|
|
4
|
+
from typing import IO
|
|
5
|
+
|
|
6
|
+
from genie_python.genie_script_checker import ScriptChecker
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def write_to_temp_file(message: list[str], suffix: str = "", dir: str = "") -> IO[bytes]:
|
|
10
|
+
"""
|
|
11
|
+
write to temporary file for test check_script
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
message: message to write to file
|
|
15
|
+
suffix: filename suffix
|
|
16
|
+
dir: directory to write into
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
temporary file
|
|
20
|
+
"""
|
|
21
|
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix, dir=dir)
|
|
22
|
+
for line in message:
|
|
23
|
+
temp_file.write(line.encode("utf-8"))
|
|
24
|
+
temp_file.close()
|
|
25
|
+
return temp_file
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CreateTempScriptAndReturnErrors:
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
script_checker: ScriptChecker,
|
|
32
|
+
machine: str,
|
|
33
|
+
script: list[str],
|
|
34
|
+
warnings_as_error: bool = True,
|
|
35
|
+
no_pyright: bool = False,
|
|
36
|
+
no_pylint: bool = False,
|
|
37
|
+
dir: str = "",
|
|
38
|
+
) -> None:
|
|
39
|
+
self.script = script
|
|
40
|
+
self.machine = machine
|
|
41
|
+
self.dir = dir
|
|
42
|
+
self.warnings_as_error = warnings_as_error
|
|
43
|
+
self.no_pyright = no_pyright
|
|
44
|
+
self.no_pylint = no_pylint
|
|
45
|
+
self.script_checker = script_checker
|
|
46
|
+
|
|
47
|
+
def __enter__(self) -> list[str]:
|
|
48
|
+
self.temp_script_file = write_to_temp_file(self.script, dir=self.dir)
|
|
49
|
+
return self.script_checker.check_script(
|
|
50
|
+
self.temp_script_file.name,
|
|
51
|
+
self.machine,
|
|
52
|
+
warnings_as_error=self.warnings_as_error,
|
|
53
|
+
no_pyright=self.no_pyright,
|
|
54
|
+
no_pylint=self.no_pylint,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def __exit__(
|
|
58
|
+
self,
|
|
59
|
+
exc_type: type[BaseException] | None,
|
|
60
|
+
exc_value: BaseException | None,
|
|
61
|
+
exc_traceback: TracebackType,
|
|
62
|
+
) -> None:
|
|
63
|
+
os.unlink(self.temp_script_file.name)
|