Skip to content

Commit 2731ee9

Browse files
jorgepilotoPipKat
andauthored
ENH: new Coding Style guide (#95)
* Move coding_style/ -> coding-style/ * Remove beyond_pep8.rst and flake8.rst * Rename pep8_best_practices.rst -> pep8.rst * New formatting-tools.rst section * Fix links and references * Apply code suggestions * Improve pep8.rst tabs * Apply suggestions from code review Co-authored-by: Kathy Pippert <[email protected]> * Add more tabs * Add additional options to flake8 * Improve formatting tools * Add required standard section * Add required standard * Improve pep8.rst * Add code suggestions * Apply blacken-docs * Fix code snippets * Apply suggestions from code review Co-authored-by: Kathy Pippert <[email protected]> Co-authored-by: Kathy Pippert <[email protected]>
1 parent e5d3c62 commit 2731ee9

18 files changed

+1360
-1364
lines changed

doc/source/abstractions/app-interface.rst

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -61,45 +61,49 @@ within this method.
6161

6262
.. code:: python
6363
64-
def create_open_region(self, frequency="1GHz", boundary="Radiation",
65-
apply_infinite_gp=False, gp_axis="-z"):
66-
"""Create an open region on the active editor.
67-
68-
Parameters
69-
----------
70-
frequency : str, optional
71-
Frequency with units. The default is ``"1GHz"``.
72-
boundary : str, optional
73-
Type of the boundary. The default is ``"Radiation"``.
74-
apply_infinite_gp : bool, optional
75-
Whether to apply an infinite ground plane. The default is ``False``.
76-
gp_axis : str, optional
77-
The default is ``"-z"``.
78-
79-
Returns
80-
-------
81-
bool
82-
``True`` when successful, ``False`` when failed.
83-
84-
Examples
85-
--------
86-
Create an open region in the active editor at 1 GHz.
87-
88-
>>> hfss.create_open_region(frequency="1GHz")
89-
90-
"""
91-
vars = [
92-
"NAME:Settings",
93-
"OpFreq:=", frequency,
94-
"Boundary:=", boundary,
95-
"ApplyInfiniteGP:=", apply_infinite_gp
96-
]
97-
if apply_infinite_gp:
98-
vars.append("Direction:=")
99-
vars.append(gp_axis)
100-
101-
self._omodelsetup.CreateOpenRegion(vars)
102-
return True
64+
def create_open_region(
65+
self, frequency="1GHz", boundary="Radiation", apply_infinite_gp=False, gp_axis="-z"
66+
):
67+
"""Create an open region in the active editor.
68+
69+
Parameters
70+
----------
71+
frequency : str, optional
72+
Frequency with units. The default is ``"1GHz"``.
73+
boundary : str, optional
74+
Type of the boundary. The default is ``"Radiation"``.
75+
apply_infinite_gp : bool, optional
76+
Whether to apply an infinite ground plane. The default is ``False``.
77+
gp_axis : str, optional
78+
The default is ``"-z"``.
79+
80+
Returns
81+
-------
82+
bool
83+
``True`` when successful, ``False`` when failed.
84+
85+
Examples
86+
--------
87+
Create an open region in the active editor at 1 GHz.
88+
89+
>>> hfss.create_open_region(frequency="1GHz")
90+
91+
"""
92+
vars = [
93+
"NAME:Settings",
94+
"OpFreq:=",
95+
frequency,
96+
"Boundary:=",
97+
boundary,
98+
"ApplyInfiniteGP:=",
99+
apply_infinite_gp,
100+
]
101+
if apply_infinite_gp:
102+
vars.append("Direction:=")
103+
vars.append(gp_axis)
104+
105+
self._omodelsetup.CreateOpenRegion(vars)
106+
return True
103107
104108
Here, the COM ``CreateOpenRegion`` method is abstracted, encapsulating
105109
the model setup object. There's no reason why a user needs direct
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. code-block:: ini
2+
3+
[tox]
4+
description = Default tox environments list
5+
envlist =
6+
style,{py37,py38,py39,py310}{,-coverage},doc
7+
skip_missing_interpreters = true
8+
isolated_build = true
9+
isolated_build_env = build
10+
11+
[testenv]
12+
description = Checks for project unit tests and coverage (if desired)
13+
basepython =
14+
py37: python3.7
15+
py38: python3.8
16+
py39: python3.9
17+
py310: python3.10
18+
py: python3
19+
{style,reformat,doc,build}: python3
20+
setenv =
21+
PYTHONUNBUFFERED = yes
22+
coverage: PYTEST_EXTRA_ARGS = --cov=ansys.product --cov-report=term --cov-report=xml --cov-report=html
23+
deps =
24+
-r{toxinidir}/requirements/requirements_tests.txt
25+
commands =
26+
pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} {posargs:-vv}
27+
28+
[testenv:style]
29+
description = Checks project code style
30+
skip_install = true
31+
deps =
32+
pre-commit
33+
commands =
34+
pre-commit install
35+
pre-commit run --all-files --show-diff-on-failure
36+
37+
[testenv:doc]
38+
description = Check if documentation generates properly
39+
deps =
40+
-r{toxinidir}/requirements/requirements_doc.txt
41+
commands =
42+
sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxworkdir}/doc_out" --color -vW -bhtml
43+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.. code-block:: ini
2+
3+
[tox]
4+
description = Default tox environments list
5+
envlist =
6+
style,{py37,py38,py39,py310}{,-coverage},doc
7+
skip_missing_interpreters = true
8+
isolated_build = true
9+
10+
[testenv]
11+
description = Checks for project unit tests and coverage (if desired)
12+
basepython =
13+
py37: python3.7
14+
py38: python3.8
15+
py39: python3.9
16+
py310: python3.10
17+
py: python3
18+
{style,reformat,doc,build}: python3
19+
skip_install = true
20+
whitelist_externals =
21+
poetry
22+
setenv =
23+
PYTHONUNBUFFERED = yes
24+
coverage: PYTEST_EXTRA_ARGS = --cov=ansys.product --cov-report=term --cov-report=xml --cov-report=html
25+
deps =
26+
-r{toxinidir}/requirements/requirements_tests.txt
27+
commands =
28+
poetry install
29+
poetry run pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} {posargs:-vv}
30+
31+
[testenv:style]
32+
description = Checks project code style
33+
skip_install = true
34+
deps =
35+
pre-commit
36+
commands =
37+
pre-commit install
38+
pre-commit run --all-files --show-diff-on-failure
39+
40+
[testenv:doc]
41+
description = Check if documentation generates properly
42+
deps =
43+
-r{toxinidir}/requirements/requirements_doc.txt
44+
commands =
45+
poetry run sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxworkdir}/doc_out" --color -vW -bhtml
46+

0 commit comments

Comments
 (0)