Skip to content

Commit 90d5486

Browse files
authored
Formatting - remove trailing whitespace (#31)
* Remove trailing whitespace * Update flake8 config
1 parent 6ebe243 commit 90d5486

28 files changed

+95
-95
lines changed

.flake8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[flake8]
2-
# To be added once code is refactored: E501, W291, W293, F401
3-
select = W191, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, F403
2+
# To be added once code is refactored: E501, W293, F401
3+
select = W191, W291, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, F403
44
count = True
55
max-complexity = 10
66
max-line-length = 100

ansys/dpf/post/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
--------
1313
>>> from ansys.dpf import post
1414
>>> solution = post.solution("file.rst")
15-
>>> disp = solution.nodal_displacement()
15+
>>> disp = solution.nodal_displacement()
1616
1717
"""
1818

ansys/dpf/post/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
# class ElShapes(Enum):
7-
# """Class with Enum inheritance. Must be used to
7+
# """Class with Enum inheritance. Must be used to
88
# describe the element shape when API allows it.
99

1010
# Example
@@ -22,7 +22,7 @@
2222

2323

2424
class Grouping():
25-
"""Class with Enum inheritance. Must be used to
25+
"""Class with Enum inheritance. Must be used to
2626
describe a grouping command when the API allows it.
2727
2828
Examples
@@ -37,8 +37,8 @@ class Grouping():
3737

3838

3939
class _AvailableKeywords():
40-
"""Contains all the keywords that can be used inside of
41-
a method from a post.solution(file_path) object.
40+
"""Contains all the keywords that can be used inside of
41+
a method from a post.solution(file_path) object.
4242
4343
In order to view the complete list of available keywords, use:
4444
post.print_available_keywords()

ansys/dpf/post/dpf_solution.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@
2323

2424
from ansys.dpf.post.misc_results import Misc, MecanicMisc, ComplexMecanicMisc, ThermalMisc
2525

26-
from ansys.dpf.post.errors import NodalLocationError
26+
from ansys.dpf.post.errors import NodalLocationError
2727

2828
class DpfSolution:
2929
"""Main class of post result API."""
3030
def __init__(self, data_sources, model):
31-
"""Initialization of the solution using data_sources
31+
"""Initialization of the solution using data_sources
3232
and dpf.core.Model object."""
3333
self._data_sources = data_sources
3434
self._model = model
3535

3636
@property
3737
def mesh(self):
38-
"""Mesh representation of the model.
38+
"""Mesh representation of the model.
3939
Based on the dpf.core.MeshedRegion class."""
4040
return self._model.metadata.meshed_region
4141

4242
@property
4343
def time_freq_support(self):
44-
"""Description of the temporal/frequency
44+
"""Description of the temporal/frequency
4545
analysis of the model."""
4646
return self._model.metadata.time_freq_support
4747

@@ -52,7 +52,7 @@ def get_result_info(self):
5252
--------
5353
>>> from ansys.dpf import post
5454
>>> result = post.result("file.rst")
55-
>>> print(result.get_result_info())
55+
>>> print(result.get_result_info())
5656
"""
5757
return self._model.metadata.result_info
5858

@@ -78,7 +78,7 @@ def __init__(self, data_sources, model):
7878
super().__init__(data_sources, model)
7979
self.misc = MecanicMisc(model, data_sources)
8080

81-
#result classes
81+
#result classes
8282
def stress(self, **kwargs):
8383
"""Returns a stress object from which it is possible to get ResultData.
8484

ansys/dpf/post/electric_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ def __str__(self):
3939
txt = super().__str__()
4040
txt += "\n"
4141
txt += "This is an electric potential object."
42-
return txt
42+
return txt

ansys/dpf/post/harmonic_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55

66
class HarmonicAnalysisSolution(DpfMecanicComplexSolution):
7-
"""Harmonic solution class, which will provide all the API for Harmonic analysis."""
7+
"""Harmonic solution class, which will provide all the API for Harmonic analysis."""

ansys/dpf/post/misc_results.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, model, data_sources):
1818

1919
#tools
2020
def _get_result_data_function_of_operator(self, name, instance, data_sources, b_elem_average: bool = False, **kwargs):
21-
"""This method check which are the used keywords, then retusn a ResultData instance
21+
"""This method check which are the used keywords, then retusn a ResultData instance
2222
computed with all available keywords."""
2323
location = None
2424
element_scoping = None
@@ -55,9 +55,9 @@ def _get_result_data_function_of_operator(self, name, instance, data_sources, b_
5555
subresult = kwargs[_AvailableKeywords._subresult]
5656
if _AvailableKeywords.time_scoping in kwargs:
5757
time_scoping = kwargs[_AvailableKeywords.time_scoping]
58-
return ResultData(name, data_sources, self._model, b_elem_average, location=location, element_scoping=element_scoping,
58+
return ResultData(name, data_sources, self._model, b_elem_average, location=location, element_scoping=element_scoping,
5959
node_scoping = node_scoping, named_selection = named_selection,
60-
time = time, grouping = grouping, phase = phase, subresult=subresult, mapdl_grouping=mapdl_grouping,
60+
time = time, grouping = grouping, phase = phase, subresult=subresult, mapdl_grouping=mapdl_grouping,
6161
set=set, time_scoping=time_scoping)
6262

6363
def _check_elemental_location(self, **kwargs):
@@ -438,9 +438,9 @@ def elemental_thermal_dissipation_energy(self, **kwargs):
438438

439439
#special results
440440
def von_mises_stress(self, **kwargs):
441-
"""von_mises_stress output default location is Nodal.
442-
Use the location keyword with 'ElementalNodal' value to
443-
get an ElementalNodal result, and the 'Elemental' value
441+
"""von_mises_stress output default location is Nodal.
442+
Use the location keyword with 'ElementalNodal' value to
443+
get an ElementalNodal result, and the 'Elemental' value
444444
to get Elemental result.
445445
"""
446446
return self._get_result_data_function_of_operator("S_eqv", self, self._data_sources, **kwargs)
@@ -454,7 +454,7 @@ def _get_amplitude_evaluation(self, result_data):
454454
# resultData = self._get_result_data_function_of_operator(name, self, self._data_sources, **kwargs)
455455
resultData = result_data
456456
modulus_op = _Operator("modulus")
457-
modulus_op.inputs.fields_container.connect(resultData._evaluator._result_operator.outputs.fields_container)
457+
modulus_op.inputs.fields_container.connect(resultData._evaluator._result_operator.outputs.fields_container)
458458
resultData._evaluator._chained_operators[modulus_op.name] = """This operator will compute the amplitude of the result (when result has complex values)."""
459459
# resultData.result_fields_container = modulus_op.get_output(0, types.fields_container)
460460
resultData._evaluator._result_operator = modulus_op
@@ -472,7 +472,7 @@ def elemental_stress_amplitude(self, **kwargs):
472472

473473
def nodal_stress_amplitude(self, **kwargs):
474474
result_data = self.nodal_stress(**kwargs)
475-
return self._get_amplitude_evaluation(result_data)
475+
return self._get_amplitude_evaluation(result_data)
476476

477477

478478
class ThermalMisc(Misc):
@@ -493,4 +493,4 @@ def nodal_temperature(self, **kwargs):
493493
self._check_nodal_location(**kwargs)
494494
return self._get_result_data_function_of_operator("TEMP", self, self._data_sources, **kwargs)
495495

496-
496+

ansys/dpf/post/modal_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55

66
class ModalAnalysisSolution(DpfMecanicComplexSolution):
7-
"""Modal solution class, which will provide all the API for Modal analysis."""
7+
"""Modal solution class, which will provide all the API for Modal analysis."""

ansys/dpf/post/result_data.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ class ResultData:
4141
>>> disp_on_named_selection = solution.nodal_displacement(named_selection="SELECTION")
4242
"""
4343

44-
def __init__(self, operator_name: str, data_sources, model,
45-
elem_average: bool,
46-
location: str = None, element_scoping = None,
47-
node_scoping = None, named_selection = None,
48-
time = None,
49-
grouping = None, phase = None, subresult = None,
44+
def __init__(self, operator_name: str, data_sources, model,
45+
elem_average: bool,
46+
location: str = None, element_scoping = None,
47+
node_scoping = None, named_selection = None,
48+
time = None,
49+
grouping = None, phase = None, subresult = None,
5050
mapdl_grouping = None, set = None, time_scoping = None):
5151

52-
self._evaluator = ResultEvaluator(operator_name, data_sources, model, elem_average,
53-
location, element_scoping, node_scoping, named_selection, time,
52+
self._evaluator = ResultEvaluator(operator_name, data_sources, model, elem_average,
53+
location, element_scoping, node_scoping, named_selection, time,
5454
grouping, phase, subresult, mapdl_grouping, set, time_scoping)
5555
self.result_fields_container = None
5656

@@ -82,13 +82,13 @@ def _evaluate_result_forced(self):
8282
self.result_fields_container = self._evaluator.evaluate_result()
8383

8484
def get_all_label_spaces(self):
85-
"""Returns all the label spaces contained in a result
85+
"""Returns all the label spaces contained in a result
8686
as a string.
8787
Labels can be used to select fields to plot.
8888
8989
Returns
9090
-------
91-
list
91+
list
9292
List of dictionary (list of label space)
9393
"""
9494
self._evaluate_result()
@@ -111,8 +111,8 @@ def get_data_at_field(self, field_index: int = 0):
111111
return self.result_fields_container[field_index].data
112112

113113
def __getitem__(self, field_index: int = 0):
114-
"""Override of the result item getter. Implements the fields_container_result
115-
item getter. Return the field at the field_index position in the result fields
114+
"""Override of the result item getter. Implements the fields_container_result
115+
item getter. Return the field at the field_index position in the result fields
116116
container.
117117
"""
118118
self._evaluate_result()
@@ -132,54 +132,54 @@ def _min_max(self, pin):
132132
result = max_operator.get_output(pin, types.field)
133133
return result
134134

135-
@property
135+
@property
136136
def max(self):
137-
"""Returns the maximum values field.
138-
Chains the result operator to the "min_max_fc" operator,
137+
"""Returns the maximum values field.
138+
Chains the result operator to the "min_max_fc" operator,
139139
returns its result (output from pin 1).
140140
"""
141141
return self._min_max(1)
142142

143143
@property
144144
def max_data(self):
145-
"""Returns the maximum values field data.
146-
Chains the result operator to the "min_max_fc" operator,
145+
"""Returns the maximum values field data.
146+
Chains the result operator to the "min_max_fc" operator,
147147
returns its result (output from pin 1).
148148
"""
149149
return self._min_max(1).data
150150

151151
def get_max_data_at_field(self, field_index: int = 0):
152-
"""Returns the maximum values field data at field_index.
153-
Chains the result operator to the "min_max_fc" operator,
152+
"""Returns the maximum values field data at field_index.
153+
Chains the result operator to the "min_max_fc" operator,
154154
returns its result (output from pin 1).
155155
"""
156156
return self._min_max(1).data[field_index]
157157

158158
@property
159159
def min(self):
160-
"""Returns the minimum values field.
161-
Chains the result operator to the "min_max_fc" operator,
160+
"""Returns the minimum values field.
161+
Chains the result operator to the "min_max_fc" operator,
162162
returns its result (output from pin 0).
163163
"""
164164
return self._min_max(0)
165165

166166
@property
167167
def min_data(self):
168-
"""Returns the minimum values field data.
169-
Chains the result operator to the "min_max_fc" operator,
168+
"""Returns the minimum values field data.
169+
Chains the result operator to the "min_max_fc" operator,
170170
returns its result (output from pin 0).
171171
"""
172172
return self._min_max(0).data
173173

174174
def get_min_data_at_field(self, field_index: int = 0):
175-
"""Returns the minimum values field data at field_index.
176-
Chains the result operator to the "min_max_fc" operator,
175+
"""Returns the minimum values field data at field_index.
176+
Chains the result operator to the "min_max_fc" operator,
177177
returns its result (output from pin 0).
178178
"""
179179
return self._min_max(0).data[field_index]
180180

181181
def _plot_contour_with_vtk_file(self):
182-
"""Plot the contour result on its mesh support. The obtained figure depends on the
182+
"""Plot the contour result on its mesh support. The obtained figure depends on the
183183
support (can be a meshed_region or a time_freq_support).
184184
If transient analysis, plot the last result.
185185

ansys/dpf/post/result_evaluation.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Module containing the ResultEvaluation class that
2-
will compute the information collected in the ResultData
2+
will compute the information collected in the ResultData
33
class (which is a fields container wrapper).
44
5-
This class will only be dedicated to the fields container
5+
This class will only be dedicated to the fields container
66
computation."""
77

88
import numpy as np
@@ -18,10 +18,10 @@ class ResultEvaluator:
1818
"""This object will make the evaluation of the fields container
1919
wrapped in the ResultData object."""
2020
def __init__(self, operator_name: str, data_sources, model,
21-
elem_average,
22-
location: str = None, element_scoping = None,
23-
node_scoping = None, named_selection = None,
24-
time = None, grouping = None, phase = None, subresult = None,
21+
elem_average,
22+
location: str = None, element_scoping = None,
23+
node_scoping = None, named_selection = None,
24+
time = None, grouping = None, phase = None, subresult = None,
2525
mapdl_grouping = None, set = None, time_scoping = None):
2626

2727
self._model = model
@@ -41,7 +41,7 @@ def __init__(self, operator_name: str, data_sources, model,
4141
# raise Exception(msg)
4242
# if (element_scoping is not None and node_scoping is not None):
4343
# raise Exception("Impossible to use both element_scoping and node_scoping.")
44-
self._check_if_several_mesh_scoping(node_scoping, element_scoping,
44+
self._check_if_several_mesh_scoping(node_scoping, element_scoping,
4545
grouping, mapdl_grouping, named_selection)
4646
if (set is not None and time is not None) or (set is not None and time_scoping is not None) or (time is not None and time_scoping is not None):
4747
raise Exception("Set, time and time_scoping keyword arguments must be used independently.")
@@ -53,7 +53,7 @@ def __init__(self, operator_name: str, data_sources, model,
5353
self._result_operator.inputs.mesh_scoping.connect(scoping)
5454
if (time_scoping is not None):
5555
t_scoping = self._compute_scoping(time_scoping)
56-
self._result_operator.inputs.time_scoping.connect(t_scoping)
56+
self._result_operator.inputs.time_scoping.connect(t_scoping)
5757
#chained before the result_operator
5858
if (named_selection is not None):
5959
self._check_if_scoping(node_scoping, element_scoping)
@@ -79,7 +79,7 @@ def __init__(self, operator_name: str, data_sources, model,
7979
if (grouping == Grouping.by_material) or (grouping == Grouping.by_body):
8080
scop_op.inputs.label1.connect("mat")
8181
elif(grouping == Grouping.by_el_shape):
82-
scop_op.inputs.label1.connect("elshape")
82+
scop_op.inputs.label1.connect("elshape")
8383
else:
8484
raise Exception("Grouping impossible. Use the keyword argument as: grouping = grouping.by_el_shape, grouping = grouping.by_material...")
8585
self._result_operator.inputs.mesh_scoping.connect(scop_op.outputs.mesh_scoping)
@@ -138,7 +138,7 @@ def __init__(self, operator_name: str, data_sources, model,
138138
forward_op = Operator("forward_fc")
139139
forward_op.inputs.fields.connect(centroid_op.outputs.field)
140140
self._result_operator = forward_op
141-
# outside post-processing instruction
141+
# outside post-processing instruction
142142
if elem_average:
143143
self._elemental_nodal_to_elemental_result()
144144

@@ -169,7 +169,7 @@ def _check_if_several_grouping(self, grouping, mapdl_grouping):
169169
if (grouping is not None) and (mapdl_grouping is not None):
170170
raise Exception("Both keywords grouping and mapdl_grouping can not be used simultaneously.")
171171

172-
def _check_if_several_mesh_scoping(self, node_scoping, element_scoping,
172+
def _check_if_several_mesh_scoping(self, node_scoping, element_scoping,
173173
grouping, mapdl_grouping, named_selection):
174174
count = 0
175175
if (node_scoping is not None):
@@ -193,7 +193,7 @@ def _get_evaluation_with_sweeping_phase(self, phase):
193193
sweeping_phase_op.inputs.angle.connect(phase)
194194
sweeping_phase_op.inputs.unit_name.connect("deg")
195195
self._chained_operators[sweeping_phase_op.name] = """This operator will compute the result at a given phase (when result has complex values)."""
196-
self._result_operator = sweeping_phase_op
196+
self._result_operator = sweeping_phase_op
197197

198198
def _elemental_nodal_to_elemental_result(self):
199199
avg = Operator("to_elemental_fc")

0 commit comments

Comments
 (0)