Skip to content

Commit 055324c

Browse files
committed
changed docstrings to use numpy style to match most other docstrings in repo
1 parent 42159c6 commit 055324c

File tree

5 files changed

+253
-96
lines changed

5 files changed

+253
-96
lines changed

src/alhambra_mixes/mixes.py

Lines changed: 81 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,15 @@ def _tube_map_from_mixline(self, mixline: MixLine) -> str:
631631

632632
def tubes_markdown(self, tablefmt: str | TableFormat = "pipe") -> str:
633633
"""
634-
:param tablefmt:
634+
635+
Parameters
636+
----------
637+
638+
tablefmt:
635639
table format (see :meth:`PlateMap.to_table` for description)
636-
:return:
640+
641+
Returns
642+
-------
637643
a Markdown (or other format according to `tablefmt`)
638644
string indicating which strands in test tubes to pipette, grouped by the volume
639645
of each
@@ -660,14 +666,20 @@ def display_instructions(
660666
"""
661667
Displays in a Jupyter notebook the result of calling :meth:`Mix.instructions()`.
662668
663-
:param plate_type:
669+
Parameters
670+
----------
671+
672+
plate_type:
664673
96-well or 384-well plate; default is 96-well.
665-
:param raise_failed_validation:
674+
675+
raise_failed_validation:
666676
If validation fails (volumes don't make sense), raise an exception.
667-
:param combine_plate_actions:
677+
678+
combine_plate_actions:
668679
If True, then if multiple actions in the Mix take the same volume from the same plate,
669680
they will be combined into a single :class:`PlateMap`.
670-
:param well_marker:
681+
682+
well_marker:
671683
By default the strand's name is put in the relevant plate entry. If `well_marker` is specified
672684
and is a string, then that string is put into every well with a strand in the plate map instead.
673685
This is useful for printing plate maps that just put,
@@ -678,22 +690,28 @@ def display_instructions(
678690
that takes as input a string representing the well (such as ``"B3"`` or ``"E11"``),
679691
and outputs a string. For example, giving the identity function
680692
``mix.to_table(well_marker=lambda x: x)`` puts the well address itself in the well.
681-
:param title_level:
693+
694+
title_level:
682695
The "title" is the first line of the returned string, which contains the plate's name
683696
and volume to pipette. The `title_level` controls the size, with 1 being the largest size,
684697
(header level 1, e.g., # title in Markdown or <h1>title</h1> in HTML).
685-
:param warn_unsupported_title_format:
698+
699+
warn_unsupported_title_format:
686700
If True, prints a warning if `tablefmt` is a currently unsupported option for the title.
687701
The currently supported formats for the title are 'github', 'html', 'unsafehtml', 'rst',
688702
'latex', 'latex_raw', 'latex_booktabs', "latex_longtable". If `tablefmt` is another valid
689703
option, then the title will be the Markdown format, i.e., same as for `tablefmt` = 'github'.
690-
:param tablefmt:
704+
705+
tablefmt:
691706
By default set to `'github'` to create a Markdown table. For other options see
692707
https://github.com/astanin/python-tabulate#readme
693-
:param include_plate_maps:
708+
709+
include_plate_maps:
694710
If True, include plate maps as part of displayed instructions, otherwise only include the
695711
more compact mixing table (which is always displayed regardless of this parameter).
696-
:return:
712+
713+
Returns
714+
-------
697715
pipetting instructions in the form of strings combining results of :meth:`Mix.table` and
698716
:meth:`Mix.plate_maps`
699717
"""
@@ -714,9 +732,14 @@ def display_instructions(
714732

715733
def generate_picklist(self, experiment: Experiment | None, _cache_key=None) -> PickList | None:
716734
"""
717-
:param experiment:
735+
Parameters
736+
----------
737+
738+
experiment:
718739
experiment to use for generating picklist
719-
:return:
740+
741+
Returns
742+
-------
720743
picklist for the mix
721744
"""
722745

@@ -747,14 +770,21 @@ def instructions(
747770
Returns string combiniing the string results of calling :meth:`Mix.table` and
748771
:meth:`Mix.plate_maps` (then calling :meth:`PlateMap.to_table` on each :class:`PlateMap`).
749772
750-
:param plate_type:
773+
Parameters
774+
----------
775+
776+
plate_type:
751777
96-well or 384-well plate; default is 96-well.
752-
:param raise_failed_validation:
778+
779+
780+
raise_failed_validation:
753781
If validation fails (volumes don't make sense), raise an exception.
754-
:param combine_plate_actions:
782+
783+
combine_plate_actions:
755784
If True, then if multiple actions in the Mix take the same volume from the same plate,
756785
they will be combined into a single :class:`PlateMap`.
757-
:param well_marker:
786+
787+
well_marker:
758788
By default the strand's name is put in the relevant plate entry. If `well_marker` is specified
759789
and is a string, then that string is put into every well with a strand in the plate map instead.
760790
This is useful for printing plate maps that just put,
@@ -765,22 +795,28 @@ def instructions(
765795
that takes as input a string representing the well (such as ``"B3"`` or ``"E11"``),
766796
and outputs a string. For example, giving the identity function
767797
``mix.to_table(well_marker=lambda x: x)`` puts the well address itself in the well.
768-
:param title_level:
798+
799+
title_level:
769800
The "title" is the first line of the returned string, which contains the plate's name
770801
and volume to pipette. The `title_level` controls the size, with 1 being the largest size,
771802
(header level 1, e.g., # title in Markdown or <h1>title</h1> in HTML).
772-
:param warn_unsupported_title_format:
803+
804+
warn_unsupported_title_format:
773805
If True, prints a warning if `tablefmt` is a currently unsupported option for the title.
774806
The currently supported formats for the title are 'github', 'html', 'unsafehtml', 'rst',
775807
'latex', 'latex_raw', 'latex_booktabs', "latex_longtable". If `tablefmt` is another valid
776808
option, then the title will be the Markdown format, i.e., same as for `tablefmt` = 'github'.
777-
:param tablefmt:
809+
810+
tablefmt:
778811
By default set to `'github'` to create a Markdown table. For other options see
779812
https://github.com/astanin/python-tabulate#readme
780-
:param include_plate_maps:
813+
814+
include_plate_maps:
781815
If True, include plate maps as part of displayed instructions, otherwise only include the
782816
more compact mixing table (which is always displayed regardless of this parameter).
783-
:return:
817+
818+
Returns
819+
-------
784820
pipetting instructions in the form of strings combining results of :meth:`Mix.table` and
785821
:meth:`Mix.plate_maps`
786822
"""
@@ -1122,7 +1158,10 @@ def to_table(
11221158
which creates a Markdown format. To create other formats such as HTML, change the value of
11231159
`tablefmt`; see https://github.com/astanin/python-tabulate#readme for other possible formats.
11241160
1125-
:param well_marker:
1161+
Parameters
1162+
----------
1163+
1164+
well_marker:
11261165
By default the strand's name is put in the relevant plate entry. If `well_marker` is specified
11271166
and is a string, then that string is put into every well with a strand in the plate map instead.
11281167
This is useful for printing plate maps that just put,
@@ -1133,29 +1172,39 @@ def to_table(
11331172
that takes as input a string representing the well (such as ``"B3"`` or ``"E11"``),
11341173
and outputs a string. For example, giving the identity function
11351174
``mix.to_table(well_marker=lambda x: x)`` puts the well address itself in the well.
1136-
:param title_level:
1175+
1176+
title_level:
11371177
The "title" is the first line of the returned string, which contains the plate's name
11381178
and volume to pipette. The `title_level` controls the size, with 1 being the largest size,
11391179
(header level 1, e.g., # title in Markdown or <h1>title</h1> in HTML).
1140-
:param warn_unsupported_title_format:
1180+
1181+
warn_unsupported_title_format:
11411182
If True, prints a warning if `tablefmt` is a currently unsupported option for the title.
11421183
The currently supported formats for the title are 'github', 'html', 'unsafehtml', 'rst',
11431184
'latex', 'latex_raw', 'latex_booktabs', "latex_longtable". If `tablefmt` is another valid
11441185
option, then the title will be the Markdown format, i.e., same as for `tablefmt` = 'github'.
1145-
:param tablefmt:
1186+
1187+
tablefmt:
11461188
By default set to `'github'` to create a Markdown table. For other options see
11471189
https://github.com/astanin/python-tabulate#readme
1148-
:param stralign:
1190+
1191+
stralign:
11491192
See https://github.com/astanin/python-tabulate#readme
1150-
:param missingval:
1193+
1194+
missingval:
11511195
See https://github.com/astanin/python-tabulate#readme
1152-
:param showindex:
1196+
1197+
showindex:
11531198
See https://github.com/astanin/python-tabulate#readme
1154-
:param disable_numparse:
1199+
1200+
disable_numparse:
11551201
See https://github.com/astanin/python-tabulate#readme
1156-
:param colalign:
1202+
1203+
colalign:
11571204
See https://github.com/astanin/python-tabulate#readme
1158-
:return:
1205+
1206+
Returns
1207+
-------
11591208
a string representation of this plate map
11601209
"""
11611210
if title_level not in [1, 2, 3, 4, 5, 6]:

src/alhambra_mixes/printing.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ def emphasize(text: str, tablefmt: str | TableFormat, strong: bool = False) -> s
1919
surrounds with pair of *'s; if `strong` is True, with double *'s. For `tablefmt` = `'html'`,
2020
uses ``<emph>`` or ``<strong>``.
2121
22-
:param text:
22+
Parameters
23+
----------
24+
25+
text:
2326
text to emphasize
24-
:param tablefmt:
27+
28+
tablefmt:
2529
format in which to add emphasis markup
26-
:return:
30+
31+
Returns
32+
-------
2733
emphasized version of `text`
2834
"""
2935
# formats a title for a table produced using tabulate,

0 commit comments

Comments
 (0)