cocotb 1.9.2__cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.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.

Potentially problematic release.


This version of cocotb might be problematic. Click here for more details.

Files changed (89) hide show
  1. cocotb/ANSI.py +92 -0
  2. cocotb/__init__.py +371 -0
  3. cocotb/_deprecation.py +36 -0
  4. cocotb/_py_compat.py +63 -0
  5. cocotb/_sim_versions.py +145 -0
  6. cocotb/_vendor/__init__.py +0 -0
  7. cocotb/_vendor/distutils_version.py +346 -0
  8. cocotb/_version.py +8 -0
  9. cocotb/binary.py +858 -0
  10. cocotb/clock.py +174 -0
  11. cocotb/config.py +289 -0
  12. cocotb/decorators.py +332 -0
  13. cocotb/handle.py +1175 -0
  14. cocotb/ipython_support.py +92 -0
  15. cocotb/libs/libcocotb.so +0 -0
  16. cocotb/libs/libcocotbfli_modelsim.so +0 -0
  17. cocotb/libs/libcocotbutils.so +0 -0
  18. cocotb/libs/libcocotbvhpi_aldec.so +0 -0
  19. cocotb/libs/libcocotbvhpi_ius.so +0 -0
  20. cocotb/libs/libcocotbvhpi_modelsim.so +0 -0
  21. cocotb/libs/libcocotbvhpi_nvc.so +0 -0
  22. cocotb/libs/libcocotbvpi_aldec.so +0 -0
  23. cocotb/libs/libcocotbvpi_ghdl.so +0 -0
  24. cocotb/libs/libcocotbvpi_icarus.vpl +0 -0
  25. cocotb/libs/libcocotbvpi_ius.so +0 -0
  26. cocotb/libs/libcocotbvpi_modelsim.so +0 -0
  27. cocotb/libs/libcocotbvpi_vcs.so +0 -0
  28. cocotb/libs/libcocotbvpi_verilator.so +0 -0
  29. cocotb/libs/libembed.so +0 -0
  30. cocotb/libs/libgpi.so +0 -0
  31. cocotb/libs/libgpilog.so +0 -0
  32. cocotb/libs/libpygpilog.so +0 -0
  33. cocotb/log.py +303 -0
  34. cocotb/memdebug.py +35 -0
  35. cocotb/outcomes.py +56 -0
  36. cocotb/queue.py +179 -0
  37. cocotb/regression.py +933 -0
  38. cocotb/result.py +209 -0
  39. cocotb/runner.py +1400 -0
  40. cocotb/scheduler.py +1099 -0
  41. cocotb/share/def/.gitignore +2 -0
  42. cocotb/share/def/README.md +4 -0
  43. cocotb/share/def/aldec.def +61 -0
  44. cocotb/share/def/ghdl.def +43 -0
  45. cocotb/share/def/icarus.def +43 -0
  46. cocotb/share/def/modelsim.def +137 -0
  47. cocotb/share/include/cocotb_utils.h +93 -0
  48. cocotb/share/include/embed.h +56 -0
  49. cocotb/share/include/exports.h +20 -0
  50. cocotb/share/include/gpi.h +265 -0
  51. cocotb/share/include/gpi_logging.h +212 -0
  52. cocotb/share/include/py_gpi_logging.h +30 -0
  53. cocotb/share/include/vhpi_user_ext.h +26 -0
  54. cocotb/share/include/vpi_user_ext.h +55 -0
  55. cocotb/share/lib/verilator/verilator.cpp +196 -0
  56. cocotb/share/makefiles/Makefile.deprecations +12 -0
  57. cocotb/share/makefiles/Makefile.inc +176 -0
  58. cocotb/share/makefiles/Makefile.sim +113 -0
  59. cocotb/share/makefiles/simulators/Makefile.activehdl +79 -0
  60. cocotb/share/makefiles/simulators/Makefile.cvc +94 -0
  61. cocotb/share/makefiles/simulators/Makefile.ghdl +113 -0
  62. cocotb/share/makefiles/simulators/Makefile.icarus +111 -0
  63. cocotb/share/makefiles/simulators/Makefile.ius +125 -0
  64. cocotb/share/makefiles/simulators/Makefile.modelsim +32 -0
  65. cocotb/share/makefiles/simulators/Makefile.nvc +64 -0
  66. cocotb/share/makefiles/simulators/Makefile.questa +171 -0
  67. cocotb/share/makefiles/simulators/Makefile.riviera +183 -0
  68. cocotb/share/makefiles/simulators/Makefile.vcs +98 -0
  69. cocotb/share/makefiles/simulators/Makefile.verilator +86 -0
  70. cocotb/share/makefiles/simulators/Makefile.xcelium +136 -0
  71. cocotb/simulator.cpython-313-i386-linux-gnu.so +0 -0
  72. cocotb/task.py +325 -0
  73. cocotb/triggers.py +1104 -0
  74. cocotb/types/__init__.py +50 -0
  75. cocotb/types/array.py +309 -0
  76. cocotb/types/logic.py +292 -0
  77. cocotb/types/logic_array.py +298 -0
  78. cocotb/types/range.py +198 -0
  79. cocotb/utils.py +698 -0
  80. cocotb/wavedrom.py +199 -0
  81. cocotb/xunit_reporter.py +80 -0
  82. cocotb-1.9.2.dist-info/LICENSE +28 -0
  83. cocotb-1.9.2.dist-info/METADATA +168 -0
  84. cocotb-1.9.2.dist-info/RECORD +89 -0
  85. cocotb-1.9.2.dist-info/WHEEL +8 -0
  86. cocotb-1.9.2.dist-info/entry_points.txt +2 -0
  87. cocotb-1.9.2.dist-info/top_level.txt +21 -0
  88. pygpi/__init__.py +0 -0
  89. pygpi/entry.py +26 -0
cocotb/clock.py ADDED
@@ -0,0 +1,174 @@
1
+ # Copyright (c) 2013 Potential Ventures Ltd
2
+ # Copyright (c) 2013 SolarFlare Communications Inc
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # * Redistributions of source code must retain the above copyright
8
+ # notice, this list of conditions and the following disclaimer.
9
+ # * Redistributions in binary form must reproduce the above copyright
10
+ # notice, this list of conditions and the following disclaimer in the
11
+ # documentation and/or other materials provided with the distribution.
12
+ # * Neither the name of Potential Ventures Ltd,
13
+ # SolarFlare Communications Inc nor the
14
+ # names of its contributors may be used to endorse or promote products
15
+ # derived from this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
21
+ # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ """A clock class."""
29
+
30
+ import itertools
31
+ import warnings
32
+ from decimal import Decimal
33
+ from numbers import Real
34
+ from typing import Union
35
+
36
+ from cocotb.log import SimLog
37
+ from cocotb.triggers import Timer
38
+ from cocotb.utils import get_sim_steps, get_time_from_sim_steps, lazy_property
39
+
40
+
41
+ class BaseClock:
42
+ """Base class to derive from."""
43
+
44
+ def __init__(self, signal):
45
+ self.signal = signal
46
+
47
+ @lazy_property
48
+ def log(self):
49
+ return SimLog("cocotb.{}.{}".format(type(self).__qualname__, self.signal._name))
50
+
51
+
52
+ class Clock(BaseClock):
53
+ r"""Simple 50:50 duty cycle clock driver.
54
+
55
+ Instances of this class should call its :meth:`start` method
56
+ and pass the coroutine object to one of the functions in :ref:`task-management`.
57
+
58
+ This will create a clocking task that drives the signal at the
59
+ desired period/frequency.
60
+
61
+ Example:
62
+
63
+ .. code-block:: python
64
+
65
+ c = Clock(dut.clk, 10, 'ns')
66
+ await cocotb.start(c.start())
67
+
68
+ Args:
69
+ signal: The clock pin/signal to be driven.
70
+ period (int): The clock period. Must convert to an even number of
71
+ timesteps.
72
+ units (str, optional): One of
73
+ ``'step'``, ``'fs'``, ``'ps'``, ``'ns'``, ``'us'``, ``'ms'``, ``'sec'``.
74
+ When *units* is ``'step'``,
75
+ the timestep is determined by the simulator (see :make:var:`COCOTB_HDL_TIMEPRECISION`).
76
+
77
+ If you need more features like a phase shift and an asymmetric duty cycle,
78
+ it is simple to create your own clock generator (that you then :func:`~cocotb.start`):
79
+
80
+ .. code-block:: python
81
+
82
+ async def custom_clock():
83
+ # pre-construct triggers for performance
84
+ high_time = Timer(high_delay, units="ns")
85
+ low_time = Timer(low_delay, units="ns")
86
+ await Timer(initial_delay, units="ns")
87
+ while True:
88
+ dut.clk.value = 1
89
+ await high_time
90
+ dut.clk.value = 0
91
+ await low_time
92
+
93
+ If you also want to change the timing during simulation,
94
+ use this slightly more inefficient example instead where
95
+ the :class:`Timer`\ s inside the while loop are created with
96
+ current delay values:
97
+
98
+ .. code-block:: python
99
+
100
+ async def custom_clock():
101
+ while True:
102
+ dut.clk.value = 1
103
+ await Timer(high_delay, units="ns")
104
+ dut.clk.value = 0
105
+ await Timer(low_delay, units="ns")
106
+
107
+ high_delay = low_delay = 100
108
+ await cocotb.start(custom_clock())
109
+ await Timer(1000, units="ns")
110
+ high_delay = low_delay = 10 # change the clock speed
111
+ await Timer(1000, units="ns")
112
+
113
+ .. versionchanged:: 1.5
114
+ Support ``'step'`` as the *units* argument to mean "simulator time step".
115
+
116
+ .. deprecated:: 1.5
117
+ Using ``None`` as the *units* argument is deprecated, use ``'step'`` instead.
118
+ """
119
+
120
+ def __init__(
121
+ self, signal, period: Union[float, Real, Decimal], units: str = "step"
122
+ ):
123
+ BaseClock.__init__(self, signal)
124
+ if units is None:
125
+ warnings.warn(
126
+ 'Using units=None is deprecated, use units="step" instead.',
127
+ DeprecationWarning,
128
+ stacklevel=2,
129
+ )
130
+ units = "step" # don't propagate deprecated value
131
+ self.period = get_sim_steps(period, units)
132
+ self.half_period = get_sim_steps(period / 2, units)
133
+ self.frequency = 1 / get_time_from_sim_steps(self.period, units="us")
134
+ self.hdl = None
135
+ self.signal = signal
136
+ self.coro = None
137
+ self.mcoro = None
138
+
139
+ async def start(self, cycles=None, start_high=True):
140
+ r"""Clocking coroutine. Start driving your clock by :func:`cocotb.start`\ ing a
141
+ call to this.
142
+
143
+ Args:
144
+ cycles (int, optional): Cycle the clock *cycles* number of times,
145
+ or if ``None`` then cycle the clock forever.
146
+ Note: ``0`` is not the same as ``None``, as ``0`` will cycle no times.
147
+ start_high (bool, optional): Whether to start the clock with a ``1``
148
+ for the first half of the period.
149
+ Default is ``True``.
150
+
151
+ .. versionadded:: 1.3
152
+ """
153
+ t = Timer(self.half_period)
154
+ if cycles is None:
155
+ it = itertools.count()
156
+ else:
157
+ it = range(cycles)
158
+
159
+ # branch outside for loop for performance (decision has to be taken only once)
160
+ if start_high:
161
+ for _ in it:
162
+ self.signal.value = 1
163
+ await t
164
+ self.signal.value = 0
165
+ await t
166
+ else:
167
+ for _ in it:
168
+ self.signal.value = 0
169
+ await t
170
+ self.signal.value = 1
171
+ await t
172
+
173
+ def __str__(self):
174
+ return type(self).__qualname__ + "(%3.1f MHz)" % self.frequency
cocotb/config.py ADDED
@@ -0,0 +1,289 @@
1
+ #!/usr/bin/env python
2
+ ###############################################################################
3
+ # Copyright (c) 2013 Potential Ventures Ltd
4
+ # Copyright (c) 2013 SolarFlare Communications Inc
5
+ # All rights reserved.
6
+ #
7
+ # Redistribution and use in source and binary forms, with or without
8
+ # modification, are permitted provided that the following conditions are met:
9
+ # * Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in the
13
+ # documentation and/or other materials provided with the distribution.
14
+ # * Neither the name of Potential Ventures Ltd,
15
+ # SolarFlare Communications Inc nor the
16
+ # names of its contributors may be used to endorse or promote products
17
+ # derived from this software without specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ # DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
23
+ # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ ###############################################################################
30
+
31
+ """
32
+ Module for querying the cocotb configuration
33
+
34
+ This module provides information in module global variables and through a
35
+ ``main()`` function that is used in the cocotb-config script.
36
+
37
+ Global variables:
38
+ share_dir: str, path where the cocotb data is stored
39
+ makefiles_dir: str, path where the cocotb makefiles are installed
40
+ libs_dir: str, path where the cocotb interface libraries are located
41
+ """
42
+ import argparse
43
+ import os
44
+ import sys
45
+ import textwrap
46
+ from pathlib import Path
47
+
48
+ import find_libpython
49
+
50
+ import cocotb
51
+
52
+ __all__ = ["share_dir", "makefiles_dir", "libs_dir"]
53
+
54
+ base_dir = Path(cocotb.__file__).parent.resolve()
55
+ share_dir = base_dir.joinpath("share").as_posix()
56
+ makefiles_dir = base_dir.joinpath("share").joinpath("makefiles").as_posix()
57
+ libs_dir = base_dir.joinpath("libs").as_posix()
58
+
59
+
60
+ def help_vars_text():
61
+ if "dev" in cocotb.__version__:
62
+ doclink = "https://docs.cocotb.org/en/latest/building.html"
63
+ else:
64
+ doclink = f"https://docs.cocotb.org/en/v{cocotb.__version__}/building.html"
65
+
66
+ # NOTE: make sure to keep "helpmsg" aligned with documentation/source/building.rst
67
+ # Also keep it at 80 chars.
68
+ helpmsg = textwrap.dedent(
69
+ """\
70
+ The following variables are environment variables:
71
+
72
+ Cocotb
73
+ ------
74
+ TOPLEVEL Instance in the hierarchy to use as the DUT
75
+ RANDOM_SEED Random seed, to recreate a previous test stimulus
76
+ COCOTB_ANSI_OUTPUT Force cocotb to print or not print in color
77
+ COCOTB_REDUCED_LOG_FMT Display log lines shorter
78
+ COCOTB_ATTACH Pause time value in seconds before the simulator start
79
+ COCOTB_ENABLE_PROFILING Performance analysis of the Python portion of cocotb
80
+ COCOTB_LOG_LEVEL Default logging level (default INFO)
81
+ COCOTB_RESOLVE_X How to resolve X, Z, U, W on integer conversion
82
+ MEMCHECK HTTP port to use for debugging Python memory usage
83
+ LIBPYTHON_LOC Absolute path to libpython
84
+
85
+ Regression Manager
86
+ ------------------
87
+ COCOTB_PDB_ON_EXCEPTION Drop into the Python debugger (pdb) on exception
88
+ MODULE Modules to search for test functions (comma-separated)
89
+ TESTCASE Test function(s) to run (comma-separated list)
90
+ COCOTB_RESULTS_FILE File name for xUnit XML tests results
91
+ COVERAGE Report Python coverage (also HDL for some simulators)
92
+
93
+ GPI
94
+ ---
95
+ GPI_EXTRA Extra libraries to load at runtime (comma-separated)
96
+
97
+ Scheduler
98
+ ---------
99
+ COCOTB_SCHEDULER_DEBUG Enable additional output of coroutine scheduler
100
+
101
+ For details, see {}"""
102
+ ).format(doclink)
103
+ return helpmsg
104
+
105
+
106
+ def lib_name(interface: str, simulator: str) -> str:
107
+ """
108
+ Return the name of interface library for given interface (VPI/VHPI/FLI) and simulator.
109
+ """
110
+
111
+ interface_name = interface.lower()
112
+ supported_interfaces = ["vpi", "vhpi", "fli"]
113
+ if interface_name not in supported_interfaces:
114
+ raise ValueError(
115
+ "Wrong interface used. Supported: " + ", ".join(supported_interfaces)
116
+ )
117
+
118
+ simulator_name = simulator.lower()
119
+ supported_sims = [
120
+ "icarus",
121
+ "questa",
122
+ "modelsim",
123
+ "ius",
124
+ "xcelium",
125
+ "vcs",
126
+ "ghdl",
127
+ "riviera",
128
+ "activehdl",
129
+ "cvc",
130
+ "nvc",
131
+ ]
132
+ if simulator not in supported_sims:
133
+ raise ValueError(
134
+ "Wrong simulator name. Supported: " + ", ".join(supported_sims)
135
+ )
136
+
137
+ if simulator_name in ["questa", "cvc"]:
138
+ library_name = "modelsim"
139
+ elif simulator_name == "xcelium":
140
+ library_name = "ius"
141
+ elif simulator_name in ["riviera", "activehdl"]:
142
+ library_name = "aldec"
143
+ else:
144
+ library_name = simulator_name
145
+
146
+ if library_name == "icarus":
147
+ lib_ext = ""
148
+ elif os.name == "nt":
149
+ lib_ext = ".dll"
150
+ else:
151
+ lib_ext = ".so"
152
+
153
+ # check if compiled with msvc
154
+ if os.path.isfile(os.path.join(libs_dir, "cocotb.dll")):
155
+ lib_prefix = ""
156
+ else:
157
+ lib_prefix = "lib"
158
+
159
+ return lib_prefix + "cocotb" + interface_name + "_" + library_name + lib_ext
160
+
161
+
162
+ def lib_name_path(interface, simulator):
163
+ """
164
+ Return the absolute path of interface library for given interface (VPI/VHPI/FLI) and simulator
165
+ """
166
+ library_name_path = os.path.join(libs_dir, lib_name(interface, simulator))
167
+
168
+ return Path(library_name_path).as_posix()
169
+
170
+
171
+ def _findlibpython():
172
+ libpython_path = find_libpython.find_libpython()
173
+ if libpython_path is None:
174
+ sys.exit(1)
175
+ return Path(libpython_path).as_posix()
176
+
177
+
178
+ class PrintAction(argparse.Action):
179
+ def __init__(self, option_strings, dest, text=None, **kwargs):
180
+ super().__init__(option_strings, dest, nargs=0, **kwargs)
181
+ self.text = text
182
+
183
+ def __call__(self, parser, namespace, values, option_string=None):
184
+ print(self.text)
185
+ parser.exit()
186
+
187
+
188
+ class PrintFuncAction(argparse.Action):
189
+ def __init__(self, option_strings, dest, function=None, **kwargs):
190
+ super().__init__(option_strings, dest, **kwargs)
191
+ self.function = function
192
+
193
+ def __call__(self, parser, args, values, option_string=None):
194
+ try:
195
+ print(self.function(*values))
196
+ except ValueError as e:
197
+ parser.error(e)
198
+ parser.exit()
199
+
200
+
201
+ def get_parser():
202
+ prefix_dir = base_dir.parent.resolve().as_posix()
203
+ version = cocotb.__version__
204
+ python_bin = Path(sys.executable).as_posix()
205
+
206
+ parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
207
+ parser.add_argument(
208
+ "--prefix",
209
+ help="echo the package-prefix of cocotb",
210
+ action=PrintAction,
211
+ text=prefix_dir,
212
+ )
213
+ parser.add_argument(
214
+ "--share",
215
+ help="echo the package-share of cocotb",
216
+ action=PrintAction,
217
+ text=share_dir,
218
+ )
219
+ parser.add_argument(
220
+ "--makefiles",
221
+ help="echo the package-makefiles of cocotb",
222
+ action=PrintAction,
223
+ text=makefiles_dir,
224
+ )
225
+ parser.add_argument(
226
+ "--python-bin",
227
+ help="echo the path to the Python binary cocotb is installed for",
228
+ action=PrintAction,
229
+ text=python_bin,
230
+ )
231
+ parser.add_argument(
232
+ "--help-vars",
233
+ help="show help about supported variables",
234
+ action=PrintAction,
235
+ text=help_vars_text(),
236
+ )
237
+ parser.add_argument(
238
+ "--libpython",
239
+ help="Print the absolute path to the libpython associated with the current Python installation",
240
+ nargs=0,
241
+ metavar=(),
242
+ action=PrintFuncAction,
243
+ function=_findlibpython,
244
+ )
245
+ parser.add_argument(
246
+ "--lib-dir",
247
+ help="Print the absolute path to the interface libraries location",
248
+ action=PrintAction,
249
+ text=libs_dir,
250
+ )
251
+ parser.add_argument(
252
+ "--lib-name",
253
+ help="Print the name of interface library for given interface (VPI/VHPI/FLI) and simulator",
254
+ nargs=2,
255
+ metavar=("INTERFACE", "SIMULATOR"),
256
+ action=PrintFuncAction,
257
+ function=lib_name,
258
+ )
259
+ parser.add_argument(
260
+ "--lib-name-path",
261
+ help="Print the absolute path of interface library for given interface (VPI/VHPI/FLI) and simulator",
262
+ nargs=2,
263
+ metavar=("INTERFACE", "SIMULATOR"),
264
+ action=PrintFuncAction,
265
+ function=lib_name_path,
266
+ )
267
+ parser.add_argument(
268
+ "-v",
269
+ "--version",
270
+ help="echo the version of cocotb",
271
+ action=PrintAction,
272
+ text=version,
273
+ )
274
+
275
+ return parser
276
+
277
+
278
+ def main():
279
+ parser = get_parser()
280
+
281
+ if len(sys.argv) == 1:
282
+ parser.print_help(sys.stderr)
283
+ sys.exit(1)
284
+
285
+ parser.parse_args()
286
+
287
+
288
+ if __name__ == "__main__":
289
+ main()