Skip to content

Commit 95884e6

Browse files
committed
Improve docs rendering
1 parent 9cfec82 commit 95884e6

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

src/genie_python/genie.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def get_block_units(block_name: str) -> str | None:
177177
Args:
178178
block_name: name of the block
179179
180-
Returns
180+
Returns:
181181
string: units of the block
182182
"""
183183
return _genie_api.get_block_units(block_name)
@@ -1162,10 +1162,10 @@ def get_time_since_begin(get_timedelta: bool = False) -> float | datetime.timede
11621162
get_timedelta (bool): If true return the value as a datetime object,
11631163
otherwise return seconds (defaults to false)
11641164
1165-
Returns
1166-
integer: the time since start in seconds if get_datetime is False,
1167-
or timedelta, the time since begin as a datetime.timedelta object
1168-
(Year-Month-Day Hour:Minute:Second) if get_datetime is True
1165+
Returns:
1166+
integer: The time since start in seconds if get_datetime is False,
1167+
or timedelta, the time since begin as a datetime.timedelta object
1168+
(Year-Month-Day Hour:Minute:Second) if get_datetime is True
11691169
"""
11701170
assert _genie_api.dae is not None
11711171
return _genie_api.dae.get_time_since_begin(get_timedelta)
@@ -1460,7 +1460,7 @@ def load_script(name: str, check_script: bool = True, warnings_as_error: bool =
14601460
14611461
Args:
14621462
name (string): the name of the file to load. If this is not a
1463-
full path the file is assumed to be in C:\\scripts
1463+
full path, the file is assumed to be in `C:\\\\scripts`
14641464
check_script: When True run the script checker on the script;
14651465
False otherwise (default True)
14661466
warnings_as_error: When true throw an exception on a warning;
@@ -1665,7 +1665,9 @@ def change_tables(
16651665
) -> None:
16661666
"""
16671667
Load the wiring, detector and/or spectra tables.
1668+
16681669
Checks that the file paths are valid, throws exception if not.
1670+
16691671
Args:
16701672
wiring (string, optional): the filename of the wiring table file
16711673
detector (string, optional): the filename of the detector table file
@@ -1729,7 +1731,7 @@ def change_sync(source: str) -> None:
17291731
'muon cerenkov',
17301732
'muon ms',
17311733
'isis (first ts1)'
1732-
)
1734+
)
17331735
"""
17341736
assert _genie_api.dae is not None
17351737
_genie_api.dae.change_sync(source)
@@ -1765,7 +1767,7 @@ def change_tcb(
17651767
Change the time channel boundaries.
17661768
If None is specified for low, high or step then the values are left unchanged.
17671769
1768-
Args
1770+
Args:
17691771
low (float, optional): the lower limit. Default is no change from the current value.
17701772
high (float, optional): the upper limit. Default is no change from the current value.
17711773
step (float,optional): the step size. Default is no change from the current value.
@@ -2314,7 +2316,8 @@ def change_beamline_par(name: str, value: PVValue) -> None:
23142316
def send_sms(phone_num: str, message: str) -> None:
23152317
"""
23162318
Sends an SMS message to a phone number.
2317-
If you are sending to messages to the same number often consider using g.alerts.send()
2319+
2320+
If you are sending to messages to the same number often, consider using `g.alerts.send()`
23182321
23192322
Args:
23202323
phone_num (string): the phone number to send the SMS to
@@ -2497,6 +2500,7 @@ def set_dae_simulation_mode(mode: bool, skip_required_runstates: bool = False) -
24972500
def get_dae_simulation_mode() -> bool:
24982501
"""
24992502
Gets the DAE simulation mode.
2503+
25002504
Returns:
25012505
True if the DAE is in simulation mode, False otherwise.
25022506
"""
@@ -2523,7 +2527,7 @@ def load(name: str) -> None:
25232527
@usercommand
25242528
@log_command_and_handle_exception
25252529
def get_wiring_table() -> str | None:
2526-
"""Gets the current wiring table path"
2530+
"""Gets the current wiring table path.
25272531
25282532
Returns:
25292533
The file path of the current wiring table.
@@ -2535,7 +2539,7 @@ def get_wiring_table() -> str | None:
25352539
@usercommand
25362540
@log_command_and_handle_exception
25372541
def get_spectra_table() -> str | None:
2538-
"""Gets the current spectra table path"
2542+
"""Gets the current spectra table path.
25392543
25402544
Returns:
25412545
The file path of the current spectra table.
@@ -2547,7 +2551,7 @@ def get_spectra_table() -> str | None:
25472551
@usercommand
25482552
@log_command_and_handle_exception
25492553
def get_detector_table() -> str | None:
2550-
"""Gets the current detector table path"
2554+
"""Gets the current detector table path.
25512555
25522556
Returns:
25532557
The file path of the current detector table.
@@ -2571,6 +2575,9 @@ def get_dae_autosave_freq() -> int | None:
25712575
def set_dae_autosave_freq(freq: int) -> None:
25722576
"""
25732577
Sets the ICP autosave frequency (Frames).
2578+
2579+
Args:
2580+
freq: The autosave frequency in frames.
25742581
"""
25752582
assert _genie_api.dae is not None
25762583
return _genie_api.dae.set_autosave_freq(freq)

src/genie_python/genie_advanced.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_manager_mode() -> bool:
3434
Returns whether you are in manager mode or not.
3535
3636
Returns:
37-
manager_mode (Bool): Manager mode on or off.
37+
manager_mode (bool): Manager mode on or off.
3838
3939
"""
4040

@@ -47,9 +47,8 @@ def assert_in_manager_mode() -> None:
4747
"""
4848
Checks that the user is in manager mode so can use advanced functions.
4949
50-
Args:
51-
52-
Returns:
50+
Raises:
51+
RuntimeError: If the user is not in manager mode.
5352
5453
"""
5554

@@ -67,7 +66,6 @@ def motor_in_set_mode(pv_name: str) -> Iterator[None]:
6766
Args:
6867
pv_name: pv of motor on which to set the mode
6968
70-
Returns:
7169
"""
7270

7371
if not __api.pv_exists(pv_name):
@@ -101,8 +99,6 @@ def redefine_motor_position(name: str, value: float | int) -> None:
10199
name: Name of the motor. e.g MTR0101
102100
value: The new value of Move Abs.
103101
104-
Returns:
105-
106102
"""
107103

108104
assert_in_manager_mode()
@@ -144,7 +140,7 @@ def pv_exists(pv: str, is_local: bool = False) -> bool:
144140
"""
145141
Check if PV exists.
146142
147-
Params:
143+
Args:
148144
pv (str): The address of the PV
149145
is_local (bool, optional): is it a local PV i.e. needs prefix adding
150146
"""
@@ -160,7 +156,7 @@ def wait_for_pv(
160156
"""
161157
Wait until a PV has reached a given value.
162158
163-
Params:
159+
Args:
164160
pv (str): The address of the PV
165161
value: The value to wait for
166162
maxwait (int, optional): The maximum time to wait for in seconds
@@ -305,7 +301,8 @@ def open_plot_window(
305301
) -> None:
306302
"""
307303
Open the plot window in a locally running client
308-
(even if this is called in a standalone genie_python)
304+
(even if this is called in a standalone genie_python).
305+
309306
Args:
310307
is_primary: True to open primary plotting window; False open secondaty window
311308
host: host to open plot from; Default None is localhost

src/genie_python/genie_alerts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def _print_block(block: str, only_if_enabled: bool = False) -> None:
167167
def status(block: str | None = None, all: bool = False) -> None:
168168
"""
169169
Prints the emails and mobiles used for alerts and the current status of specified block.
170+
170171
Args:
171172
block (string): The block to print information about
172173
all (bool): If True information about all the blocks is printed

0 commit comments

Comments
 (0)