Skip to content

Commit

Permalink
Add type hint example function (#137)
Browse files Browse the repository at this point in the history
* Add function using type hinting  to be used in the dev-guide as an example

* Update src/ansys_sphinx_theme/type_hint_example.py

Co-authored-by: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com>

* Code style

* Apply suggestions from code review

Co-authored-by: Maxime Rey <87315832+MaxJPRey@users.noreply.github.com>

* Fix docstyle

Co-authored-by: Roberto Pastor Muela <roberto.pastormuela@ansys.com>
Co-authored-by: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com>
Co-authored-by: Maxime Rey <87315832+MaxJPRey@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 17, 2022
1 parent afdf4d1 commit 3bb681b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/ansys_sphinx_theme/type_hint_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Module containing an example function using type hinting."""
from typing import Union


def type_hint_func(param1: int = 1, param2: str = "test", param3: Union[int, float] = 1) -> bool:
"""Summary containing the function description.
Extended description of the function. Can span multiple lines and
provides a general overview of the function.
Parameters
----------
param1 :
Description of an integer parameter.
param2 :
Description of a string parameter.
param3 :
Parameter that can be either int or float using Union (typing).
Returns
-------
bool
Description of the returned value.
Examples
--------
>>> func(1, 'foo', 1)
True
"""
return True

0 comments on commit 3bb681b

Please sign in to comment.