mccode-plumber 0.12.0__py3-none-any.whl → 0.13.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.
@@ -51,11 +51,20 @@ class EventFormationUnitConfig:
51
51
 
52
52
  def to_cli_str(self):
53
53
  from json import dumps
54
- return dumps(self.to_dict()).translate(str.maketrans(',',';',' {}"'))
54
+ return dumps(self.to_dict()).translate(str.maketrans('','',' {}"'))
55
55
 
56
56
  @classmethod
57
57
  def from_cli_str(cls, cli_str: str):
58
- data ={k: v for k, v in [z.split(':') for z in [x for x in cli_str.split(';')]]}
58
+ """Split a command-line argument string into a EventFormationUnitConfig
59
+
60
+ Note
61
+ ----
62
+ A command-line argument string is expected to have the following format:
63
+ "arg1:value1,arg2:value2,...,argN:valueN"
64
+ That is, key-value pairs separated from each other by commas and internally
65
+ by a colon. This allows for _values_ which contain colons, but not keys.
66
+ """
67
+ data =dict(z.split(':', maxsplit=1) for z in [x for x in cli_str.split(',')])
59
68
  return cls.from_dict(data)
60
69
 
61
70
 
@@ -170,6 +170,11 @@ def get_instr_name_and_parameters(file: str | Path):
170
170
  from mccode_antlr.loader import load_mcstas_instr
171
171
  instr = load_mcstas_instr(file)
172
172
  return instr.name, instr.parameters
173
+ elif file.suffix.lower() == '.json':
174
+ # No shortcuts, but much faster
175
+ from mccode_antlr.io.json import load_json
176
+ instr = load_json(file)
177
+ return instr.name, instr.parameters
173
178
 
174
179
  raise ValueError('Unsupported file extension')
175
180
 
@@ -177,17 +182,17 @@ def get_instr_name_and_parameters(file: str | Path):
177
182
  def efu_parameter(s: str):
178
183
  if ':' in s:
179
184
  # with any ':' we require fully specified
180
- # name:{name};binary:{binary};config:{config_path};calibration:{calibration_path};topic:{topic};port:{port}
185
+ # name:{name},binary:{binary},config:{config_path},calibration:{calibration_path},topic:{topic},port:{port}
181
186
  # what about spaces? or windows-style paths with C:/...
182
187
  return EventFormationUnitConfig.from_cli_str(s)
183
188
  # otherwise, allow an abbreviated format utilizing guesses
184
189
  # Expected format is now:
185
- # {efu_binary}[;{calibration/file}[;{config/file}]][;{port}]
190
+ # {efu_binary}[,{calibration/file}[,{config/file}]][,{port}]
186
191
  # That is, if you specify --efu, you must give its binary path and should
187
192
  # give its port. The calibration/file determines pixel calculations, so is more
188
193
  # likely to be needed. Finally, the config file can also be supplied to change, e.g.,
189
194
  # number of pixels or rings, etc.
190
- parts = s.split(';')
195
+ parts = s.split(',')
191
196
  data = {'topic': TOPICS['event'], 'port': 9000, 'binary': ensure_executable(parts[0]),}
192
197
  data['name'] = data['binary'].stem
193
198
 
@@ -214,7 +219,7 @@ def make_services_parser():
214
219
  a('-v', '--version', action='version', version=__version__)
215
220
  # No need to specify the broker, or monitor source or topic names
216
221
  a('-b', '--broker', type=str, default=None, help='Kafka broker for all services', metavar='address:port')
217
- a('--efu', type=efu_parameter, action='append', default=None, help='Configuration of one EFU, repeatable', metavar='name;calibration;config;port')
222
+ a('--efu', type=efu_parameter, action='append', default=None, help='Configuration of one EFU, repeatable', metavar='name,calibration,config,port')
218
223
  a('--writer-working-dir', type=str, default=None, help='Working directory for kafka-to-nexus')
219
224
  a('--writer-verbosity', type=str, default=None, help='Verbose output type (trace, debug, warning, error, critical)')
220
225
  a('--forwarder-verbosity', type=str, default=None, help='Verbose output type (trace, debug, warning, error, critical)')
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mccode-plumber
3
- Version: 0.12.0
3
+ Version: 0.13.1
4
4
  Author-email: Gregory Tucker <gregory.tucker@ess.eu>
5
5
  Classifier: License :: OSI Approved :: BSD License
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: p4p
8
8
  Requires-Dist: kafka-python>=2.2.11
9
9
  Requires-Dist: ess-streaming-data-types>=0.14.0
10
- Requires-Dist: restage>=0.7.2
10
+ Requires-Dist: restage>=0.8.1
11
11
  Requires-Dist: mccode-to-kafka>=0.2.2
12
- Requires-Dist: moreniius>=0.4.0
12
+ Requires-Dist: moreniius>=0.5.0
13
13
  Requires-Dist: icecream
14
14
  Requires-Dist: ephemeral-port-reserve
15
15
 
@@ -21,15 +21,15 @@ mccode_plumber/file_writer_control/WorkerStatus.py,sha256=uw1q-Pvf1o2hxpMIPVwdtn
21
21
  mccode_plumber/file_writer_control/WriteJob.py,sha256=-2tQvfajctf6Bn19c9hT9N1lOP0uTo7SZRMnXV1A-aA,2721
22
22
  mccode_plumber/file_writer_control/__init__.py,sha256=Wp8A7JOB0vgpwAbvI9ik5cBlZa6lY-cq8dxYGRTRs0M,285
23
23
  mccode_plumber/manage/__init__.py,sha256=l-ZiKPjvahBP1oG-iwLHWU5m5YbZbyWVtmiZst5Wluo,693
24
- mccode_plumber/manage/efu.py,sha256=NuDwTh3KTlgBcUNSNtLVILQu34oRFIVwE1nMnPVP9WQ,5158
24
+ mccode_plumber/manage/efu.py,sha256=yzsQ4cpsIvh2GbrQ9rwL_cGAW3SEoEBAdWOTnj2ia74,5572
25
25
  mccode_plumber/manage/ensure.py,sha256=0HaxcHYzvcDs6hBvBI39EZsIDt_rVA9CjHm5_yvOZcs,2601
26
26
  mccode_plumber/manage/epics.py,sha256=oQt_hL-7KgtI9Kmwyw8L7a7RxQe7YJWRbmHnKIqMLpQ,1310
27
27
  mccode_plumber/manage/forwarder.py,sha256=YYvHaOJ4djBXM7PFF2NBbnNDO6nnrwNOfSHaVOh16Ro,2876
28
28
  mccode_plumber/manage/manager.py,sha256=zzrduroUL-jwQ9BrPTdAm1IW4dGv5bi8-ieIQ6qiQ6M,4141
29
- mccode_plumber/manage/orchestrate.py,sha256=bGhjbEaiUR__3CtqTGuSyFF5vb4RwvxpznOvJ9cK77k,17460
29
+ mccode_plumber/manage/orchestrate.py,sha256=CH1on_ea7T9xg8dr8E8bwU1Iervuc_5N6X7bsW7mhM0,17668
30
30
  mccode_plumber/manage/writer.py,sha256=SEv1U14L01Y9-BcaJKPei4Ah2LFfwexDy9FTjpvtSEs,2245
31
- mccode_plumber-0.12.0.dist-info/METADATA,sha256=3OT7yTz4EQFQrVzRe5cTT3KoA5ZcO93wByGkz1UKxhE,594
32
- mccode_plumber-0.12.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- mccode_plumber-0.12.0.dist-info/entry_points.txt,sha256=JiuAHxI6YuGgJ4682TCyeBEJnS0ygDWpErrLaKgAicI,844
34
- mccode_plumber-0.12.0.dist-info/top_level.txt,sha256=kCCIpYtKHCKWxiPEqX9J1UaGEm-ze0Qb-cemBCEPhDA,15
35
- mccode_plumber-0.12.0.dist-info/RECORD,,
31
+ mccode_plumber-0.13.1.dist-info/METADATA,sha256=uHeIjeAlfNsCsad4OmyccDK36uxBXOmxpN8Gj3GfJJA,594
32
+ mccode_plumber-0.13.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ mccode_plumber-0.13.1.dist-info/entry_points.txt,sha256=JiuAHxI6YuGgJ4682TCyeBEJnS0ygDWpErrLaKgAicI,844
34
+ mccode_plumber-0.13.1.dist-info/top_level.txt,sha256=kCCIpYtKHCKWxiPEqX9J1UaGEm-ze0Qb-cemBCEPhDA,15
35
+ mccode_plumber-0.13.1.dist-info/RECORD,,