Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docformatter issue #2092

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/styles/Vocab/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ venv
mass_flow
mass_average
mass_integrated_average
caf
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.9.1
hooks:
- id: black

Expand All @@ -11,11 +11,11 @@ repos:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [
'flake8-annotations==2.9.0'
'flake8-annotations==3.0.1'
]
args: [
--exclude, src/ansys/fluent/core/meshing/tui* src/ansys/fluent/core/solver/tui* src/ansys/fluent/core/datamodel_222/* src/ansys/fluent/core/datamodel_231/* src/ansys/fluent/core/datamodel_232/* src/ansys/fluent/core/datamodel_241/* src/ansys/fluent/core/solver/settings_222/* src/ansys/fluent/core/solver/settings_231/* src/ansys/fluent/core/solver/settings_232/* src/ansys/fluent/core/solver/settings_241/*,
Expand All @@ -30,14 +30,14 @@ repos:
]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.6
hooks:
- id: codespell
args: ["--toml", "pyproject.toml"]
additional_dependencies: ["tomli"]

- repo: https://github.com/PyCQA/docformatter
rev: v1.5.1
rev: v1.7.5
hooks:
- id: docformatter
args: ["--config", "pyproject.toml"]
Expand Down
6 changes: 3 additions & 3 deletions doc/settings_rstgen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Provide a module to generate the documentation classes for Fluent settings
tree.
Running this module generates a .rst files for the Fluent
"""Provide a module to generate the documentation classes for Fluent settings tree.
Running this module generates a .rst files for the Fluent.

settings classes. The out is placed at:
- doc/source/api/solver/_autosummary/settings
Process
Expand Down
1 change: 0 additions & 1 deletion examples/00-fluent/radiation_headlamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
lens focuses incoming radiation onto the internal components of the headlamp,
producing thermal hotspots that could cause damage due to thermal stresses or
material degradation.

"""

###############################################################################
Expand Down
19 changes: 16 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,22 @@ exclude = [
"src/ansys/fluent/core/solver/settings_241/",
"src/ansys/fluent/core/datamodel_241/"
]
pre-summary-space = true
wrap-descriptions = 88
wrap-summaries = 88
black = "true"
non-cap = [
"initDatamodel",
"getAttributeValue",
"getState",
"setState",
"updateDict",
"deleteObject",
"executeCommand",
"createCommandArguments",
"deleteCommandArguments",
"getSpecs",
"getStaticInfo",
"subscribeEvents",
"unsubscribeEvents"
]


[tool.coverage.run]
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/fluent/core/data_model_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _dm_path_comp_list(obj):

@staticmethod
def get_state(rules: str, obj: object) -> Any:
"""Retrieve state from datamodel cache
"""Retrieve state from datamodel cache.

Parameters
----------
Expand Down Expand Up @@ -234,7 +234,7 @@ def _set_state_at_path(cache, path, value):

@staticmethod
def set_state(rules: str, obj: object, value: Any):
"""Set datamodel cache state
"""Set datamodel cache state.

Parameters
----------
Expand Down
6 changes: 4 additions & 2 deletions src/ansys/fluent/core/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@


def delete_downloads():
"""Delete all downloaded examples from the default examples folder to free space or update the files.
"""Delete all downloaded examples from the default examples folder to free space or
update the files.

Notes
-----
The default examples path is given by ``pyfluent.EXAMPLES_PATH``."""
The default examples path is given by ``pyfluent.EXAMPLES_PATH``.
"""
shutil.rmtree(pyfluent.EXAMPLES_PATH)
os.makedirs(pyfluent.EXAMPLES_PATH)

Expand Down
8 changes: 4 additions & 4 deletions src/ansys/fluent/core/file_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def __init__(self, file_session, field_info):
def add_surfaces_request(
self, surface_ids, provide_vertices=True, provide_faces=True
) -> None:
"""Add request to get surface data (vertices, face connectivity,
centroids, and normals).
"""Add request to get surface data (vertices, face connectivity, centroids, and
normals).

Parameters
----------
Expand Down Expand Up @@ -665,7 +665,7 @@ def get_surfaces_info(self):

class FileSession:
def __init__(self):
"""__init__ method of FileSession class"""
"""__init__ method of FileSession class."""
self._case_file = None
self._data_file = None
self.field_info = FileFieldInfo(self)
Expand All @@ -678,5 +678,5 @@ def read_case(self, case_filepath):
self._case_file = CaseFile(case_filepath)

def read_data(self, data_filepath):
"""Read Data file"""
"""Read Data file."""
self._data_file = DataFile(data_filepath, case_file_handle=self._case_file)
41 changes: 16 additions & 25 deletions src/ansys/fluent/core/filereader/case_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
>>> reader = CaseFile(case_filepath=case_filepath) # Instantiate a CaseFile class
>>> input_parameters = reader.input_parameters() # Get lists of input parameters
>>> output_parameters = reader.output_parameters() # Get lists of output parameters

"""
import codecs
import gzip
Expand Down Expand Up @@ -345,8 +344,7 @@ def __init__(
self._config_vars = {v[0]: v[1] for v in self._rp_vars["case-config"]}

def input_parameters(self) -> Union[List[InputParameter], List[InputParameterOld]]:
"""
Get the input parameters.
"""Get the input parameters.

Returns
-------
Expand All @@ -369,8 +367,7 @@ def input_parameters(self) -> Union[List[InputParameter], List[InputParameterOld
return [InputParameterOld(param) for param in rp_var_params]

def output_parameters(self) -> List[OutputParameter]:
"""
Get the output parameters.
"""Get the output parameters.

Returns
-------
Expand All @@ -381,8 +378,7 @@ def output_parameters(self) -> List[OutputParameter]:
return [OutputParameter(param) for param in parameters]

def num_dimensions(self) -> int:
"""
Get the dimensionality associated with this case.
"""Get the dimensionality associated with this case.

Returns
-------
Expand All @@ -394,8 +390,7 @@ def num_dimensions(self) -> int:
return 3 if attr[1] is True else 2

def precision(self) -> int:
"""
Get the precision associated with this case (single or double).
"""Get the precision associated with this case (single or double).

Returns
-------
Expand All @@ -407,8 +402,7 @@ def precision(self) -> int:
return 2 if attr[1] is True else 1

def iter_count(self) -> int:
"""
Get the number of iterations associated with this case.
"""Get the number of iterations associated with this case.

Returns
-------
Expand All @@ -418,8 +412,7 @@ def iter_count(self) -> int:
return self._find_rp_var("number-of-iterations")

def rp_vars(self) -> dict:
"""
Get the rpvars associated with this case.
"""Get the rpvars associated with this case.

Returns
-------
Expand All @@ -430,8 +423,7 @@ def rp_vars(self) -> dict:

@property
def rp_var(self) -> CaseVariable:
"""
Access the rpvars associated with this case.
"""Access the rpvars associated with this case.

Returns
-------
Expand All @@ -441,8 +433,7 @@ def rp_var(self) -> CaseVariable:
return CaseVariable(self._rp_vars)

def has_rp_var(self, name: str) -> bool:
"""
Find if this case has the given rpvar.
"""Find if this case has the given rpvar.

Parameters
----------
Expand All @@ -457,8 +448,7 @@ def has_rp_var(self, name: str) -> bool:
return name in self._rp_vars

def config_vars(self) -> dict:
"""
Get the config variables associated with this case.
"""Get the config variables associated with this case.

Returns
-------
Expand All @@ -469,8 +459,7 @@ def config_vars(self) -> dict:

@property
def config_var(self) -> CaseVariable:
"""
Access the config variables associated with this case.
"""Access the config variables associated with this case.

Returns
-------
Expand All @@ -497,7 +486,8 @@ class SettingsFile(RPVarProcessor):
"""Class to read a Fluent Settings file."""

def __init__(self, settings_filepath: Optional[str] = None) -> None:
"""Initialize a SettingsFile object. Exactly one file path argument must be specified.
"""Initialize a SettingsFile object. Exactly one file path argument must be
specified.

Parameters
----------
Expand Down Expand Up @@ -543,7 +533,8 @@ def __init__(
case_filepath: Optional[str] = None,
project_filepath: Optional[str] = None,
) -> None:
"""Initialize a CaseFile object. Exactly one file path argument must be specified.
"""Initialize a CaseFile object. Exactly one file path argument must be
specified.

Parameters
----------
Expand Down Expand Up @@ -612,8 +603,8 @@ def get_mesh(self):


def _get_processed_string(input_string: bytes) -> str:
"""Processes the input string (binary) with help of an identifier to return
it in a format which can be parsed by lispy.parse().
"""Processes the input string (binary) with help of an identifier to return it in a
format which can be parsed by lispy.parse().

Parameters
----------
Expand Down
20 changes: 6 additions & 14 deletions src/ansys/fluent/core/filereader/data_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def __init__(

@property
def case_file(self) -> str:
"""
Returns the name of the associated case file in string format.
"""
"""Returns the name of the associated case file in string format."""
return self._settings["Case File"][0].decode()

def variables(self) -> dict:
Expand All @@ -109,14 +107,11 @@ def variables(self) -> dict:
return {v[0]: v[1] for v in lispy.parse(data_vars_str)[1]}

def get_phases(self) -> list:
"""
Returns list of phases available.
"""
"""Returns list of phases available."""
return list(self._field_data.keys())

def get_face_variables(self, phase_name) -> list:
"""
Extracts face variables available for a particular phase.
"""Extracts face variables available for a particular phase.

Parameters
----------
Expand All @@ -130,8 +125,7 @@ def get_face_variables(self, phase_name) -> list:
return self._field_data[phase_name]["faces"]["fields"][0].decode().split(";")

def get_cell_variables(self, phase_name) -> list:
"""
Extracts cell variables available for a particular phase.
"""Extracts cell variables available for a particular phase.

Parameters
----------
Expand All @@ -147,8 +141,7 @@ def get_cell_variables(self, phase_name) -> list:
def get_face_scalar_field_data(
self, phase_name: str, field_name: str, surface_id: int
) -> np.array:
"""
Gets scalar field data for face.
"""Gets scalar field data for face.

Parameters
----------
Expand Down Expand Up @@ -178,8 +171,7 @@ def get_face_scalar_field_data(
return np.zeros(max_id + 1 - min_id)

def get_face_vector_field_data(self, phase_name: str, surface_id: int) -> np.array:
"""
Gets vector field data for face.
"""Gets vector field data for face.

Parameters
----------
Expand Down
6 changes: 2 additions & 4 deletions src/ansys/fluent/core/filereader/lispy.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def __init__(self, file):
self.line = ""

def next_token(self):
"""Return the next token, reading new text into line buffer if
needed."""
"""Return the next token, reading new text into line buffer if needed."""
while True:
if self.line == "":
self.line = self.file.readline()
Expand Down Expand Up @@ -400,8 +399,7 @@ def eval(x, env=global_env):


def expand(x, toplevel=False):
"""Walk tree of x, making optimizations/fixes, and signaling
SyntaxError."""
"""Walk tree of x, making optimizations/fixes, and signaling SyntaxError."""
# require(x, x!=[]) # () => Error
if x == []:
return x
Expand Down
Loading