Skip to content

Commit

Permalink
docs: fixing documentation string
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima committed Apr 1, 2022
1 parent acc3f59 commit d5fb5ff
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 92 deletions.
10 changes: 7 additions & 3 deletions docs/source/modules/converts.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Module `converts`
# Module {bdg-success-line}`converts`

```{eval-rst}
.. automodule:: mdsanima_dev.utils.converts
```

## Function `frames_to_timecode`
```{eval-rst}
.. versionadded:: 0.2.0
```

## Function {bdg-primary-line}`frames_to_timecode`

```{eval-rst}
.. autofunction:: mdsanima_dev.utils.converts.frames_to_timecode
```

## Function `timecode_to_frames`
## Function {bdg-primary-line}`timecode_to_frames`

```{eval-rst}
.. autofunction:: mdsanima_dev.utils.converts.timecode_to_frames
Expand Down
144 changes: 55 additions & 89 deletions src/mdsanima_dev/utils/converts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def get_seconds() -> int:


def frames_to_timecode(frames: int, fps: float) -> str:
"""Converting frames number to timecode ``00:00:00:00`` format.
"""Converting frames number to timecode :bdg-warning-line:`00:00:00:00`
format.
:param frames: Total frames number.
:type frames: int
Expand All @@ -35,33 +36,24 @@ def frames_to_timecode(frames: int, fps: float) -> str:
:return: Timecode format.
:rtype: str
.. admonition:: USAGE PYTHON
:class: hint
:usage: Assigning a function to a variable:
*Assigning a function to a variable:*
.. code:: python
.. code:: python
from mdsanima_dev.utils.converts import frames_to_timecode
timecode = frames_to_timecode(240, 24)
print(timecode)
from mdsanima_dev.utils.converts import frames_to_timecode
timecode = frames_to_timecode(240, 24)
print(timecode)
:shell: Command line console script:
.. admonition:: USAGE SHELL
:class: seealso
.. code:: shell
*Command line shell console script:*
mdsanima-dev-converts frames-to-timecode --frames 240 --fps 24
mdsanima-dev-converts frames-to-timecode --help
.. code:: shell
mdsanima-dev-converts frames-to-timecode --frames 240 --fps 24
mdsanima-dev-converts frames-to-timecode --help
.. admonition:: SEE ALSO
:class: note
Shell console script
`mdsanima-dev-converts <../console/shell-converts.html#converts-frames-to-timecode>`_ converting
directly on the command line.
.. seealso::
Shell console script :bdg-link-secondary-line:`frames-to-timecode <../console/shell-converts.html#converts-frames-to-timecode>`
converting directly on the command line.
"""
# assigning a function to a variable setup seconds
sec_in_min, sec_in_hrs = get_seconds()
Expand All @@ -84,7 +76,8 @@ def frames_to_timecode(frames: int, fps: float) -> str:


def timecode_to_frames(timecode: str, fps: float) -> int:
"""Converting timecode ``00:00:00:00`` format to frames number.
"""Converting timecode :bdg-warning-line:`00:00:00:00` format to
frames number.
:param timecode: Timecode format.
:type timecode: str
Expand All @@ -93,33 +86,24 @@ def timecode_to_frames(timecode: str, fps: float) -> int:
:return: Total frames number.
:rtype: int
.. admonition:: USAGE PYTHON
:class: hint
:usage: Assigning a function to a variable:
*Assigning a function to a variable:*
.. code:: python
.. code:: python
from mdsanima_dev.utils.converts import timecode_to_frames
frames = timecode_to_frames("00:00:10:00", 24)
print(frames)
from mdsanima_dev.utils.converts import timecode_to_frames
frames = timecode_to_frames("00:00:10:00", 24)
print(frames)
:shell: Command line console script:
.. admonition:: USAGE SHELL
:class: seealso
.. code:: shell
*Command line shell console script:*
mdsanima-dev-converts timecode-to-frames --timecode 00:00:10:00 --fps 24
mdsanima-dev-converts timecode-to-frames --help
.. code:: shell
mdsanima-dev-converts timecode-to-frames --timecode 00:00:10:00 --fps 24
mdsanima-dev-converts timecode-to-frames --help
.. admonition:: SEE ALSO
:class: note
Shell console script
`mdsanima-dev-converts <../console/shell-converts.html#converts-timecode-to-frames>`_ converting
directly on the command line.
.. seealso::
Shell console script :bdg-link-secondary-line:`timecode-to-frames <../console/shell-converts.html#converts-timecode-to-frames>`
converting directly on the command line.
"""
# assigning a function to a variable setup seconds
sec_in_min, sec_in_hrs = get_seconds()
Expand All @@ -142,7 +126,7 @@ def timecode_to_frames(timecode: str, fps: float) -> int:

def shell_frames_to_timecode(frames: int, fps: float) -> str:
"""Shell console script converting frames number to timecode
``00:00:00:00`` format.
:bdg-warning-line:`00:00:00:00` format.
:param --frames: Total frames number.
:type --frames: int
Expand All @@ -151,42 +135,33 @@ def shell_frames_to_timecode(frames: int, fps: float) -> str:
:return: Timecode format.
:rtype: str
.. admonition:: USAGE SHELL
:class: seealso
*Command line shell console script:*
:shell: Command line console script:
.. code:: shell
.. code:: shell
mdsanima-dev-converts frames-to-timecode --frames 240 --fps 24
mdsanima-dev-converts frames-to-timecode --help
mdsanima-dev-converts frames-to-timecode --frames 240 --fps 24
mdsanima-dev-converts frames-to-timecode --help
.. admonition:: USAGE PYTHON
:class: hint
:usage: Assigning a function to a variable:
*Assigning a function to a variable:*
.. code:: python
.. code:: python
from mdsanima_dev.utils.converts import frames_to_timecode
timecode = frames_to_timecode(240, 24)
print(timecode)
from mdsanima_dev.utils.converts import frames_to_timecode
timecode = frames_to_timecode(240, 24)
print(timecode)
.. admonition:: SEE ALSO
:class: note
Invoke function `frames_to_timecode <../modules/converts.html#function-frames-to-timecode>`_
with a given arguments values.
.. seealso::
Invoke function :bdg-link-primary-line:`frames_to_timecode <../modules/converts.html#function-frames-to-timecode>`
with a given arguments values.
"""
# run calculation
timecode = frames_to_timecode(frames, fps)
print(timecode)


def shell_timecode_to_frames(timecode: str, fps: float) -> str:
"""Shell console script converting timecode ``00:00:00:00`` format to
frames number.
"""Shell console script converting timecode :bdg-warning-line:`00:00:00:00`
format to frames number.
:param --timecode: Timecode format.
:type --timecode: str
Expand All @@ -195,33 +170,24 @@ def shell_timecode_to_frames(timecode: str, fps: float) -> str:
:return: Total frames number.
:rtype: str
.. admonition:: USAGE SHELL
:class: seealso
*Command line shell console script:*
.. code:: shell
mdsanima-dev-converts timecode-to-frames --time-code 00:00:10:00 --fps 24
mdsanima-dev-converts timecode-to-frames --help
.. admonition:: USAGE PYTHON
:class: hint
:shell: Command line shell console script:
*Assigning a function to a variable:*
.. code:: shell
.. code:: python
mdsanima-dev-converts timecode-to-frames --time-code 00:00:10:00 --fps 24
mdsanima-dev-converts timecode-to-frames --help
from mdsanima_dev.utils.converts import timecode_to_frames
frames = timecode_to_frames("00:00:10:00", 24)
print(frames)
:usage: Assigning a function to a variable:
.. code:: python
.. admonition:: SEE ALSO
:class: note
from mdsanima_dev.utils.converts import timecode_to_frames
frames = timecode_to_frames("00:00:10:00", 24)
print(frames)
Invoke function `timecode_to_frames <../modules/converts.html#function-timecode-to-frames>`_
with a given arguments values.
.. seealso::
Invoke function :bdg-link-primary-line:`timecode_to_frames <../modules/converts.html#function-timecode-to-frames>`
with a given arguments values.
"""
# run calculation
frames = timecode_to_frames(timecode, fps)
Expand Down

0 comments on commit d5fb5ff

Please sign in to comment.