Skip to content

Commit 37d8858

Browse files
committed
Fix flake8
1 parent 3f5e0a3 commit 37d8858

File tree

12 files changed

+84
-69
lines changed

12 files changed

+84
-69
lines changed

ansys/dpf/core/generic_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def set_support_of_property(self, property_name: str, field_support) -> None:
8080
----------
8181
property_name: str
8282
Name of the Property.
83-
83+
8484
field_support: Field, PropertyField, StringField
8585
Data supporting this property.
8686
"""

ansys/dpf/core/label_space.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ def __init__(self, label_space=None, obj=None, server=None):
1717
# ############################
1818
# step 1: get server
1919
self._server = server_module.get_or_create_server(server)
20-
20+
2121
# step 2: get api
2222
self._api = self._server.get_api_for_type(
2323
capi=label_space_capi.LabelSpaceCAPI,
2424
grpcapi=label_space_grpcapi.LabelSpaceGRPCAPI
25-
)
25+
)
2626
# step3: init environment
2727
self._api.init_label_space_environment(self) # creates stub when gRPC
2828

@@ -55,7 +55,7 @@ def __dict__(self):
5555
out[self._api.label_space_get_labels_name(self, i)] = \
5656
self._api.label_space_get_labels_value(self, i)
5757
return out
58-
58+
5959
def __del__(self):
6060
try:
6161
self._deleter_func[0](self._deleter_func[1](self))

ansys/dpf/core/result_info.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,9 @@ def _get_result(self, numres):
365365
data_processing_api=self._data_processing_core_api,
366366
internal_obj=self._api.result_info_get_qualifiers_for_result(self, numres)
367367
)
368-
label_space_api = self._server.get_api_for_type(capi=label_space_capi.LabelSpaceCAPI,
369-
grpcapi=label_space_grpcapi.LabelSpaceGRPCAPI)
368+
label_space_api = self._server.get_api_for_type(
369+
capi=label_space_capi.LabelSpaceCAPI, grpcapi=label_space_grpcapi.LabelSpaceGRPCAPI
370+
)
370371
num_qual_obj = label_space_api.list_label_spaces_size(qual_obj)
371372
for ires in range(num_qual_obj):
372373
qualifiers.append(

ansys/dpf/core/server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,13 @@ def get_or_create_server(server):
340340
def _find_port_available_for_docker_bind(port):
341341
run_cmd = "docker ps --all"
342342
if os.name == 'posix':
343-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
343+
process = subprocess.Popen(
344+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
345+
)
344346
else:
345-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
347+
process = subprocess.Popen(
348+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
349+
)
346350
used_ports = []
347351
for line in io.TextIOWrapper(process.stdout, encoding="utf-8"):
348352
if not ("CONTAINER ID" in line):

ansys/dpf/core/server_types.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def _run_launch_server_process(ansys_path, ip, port, docker_name):
123123
if not bShell:
124124
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
125125
else:
126-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
126+
process = subprocess.Popen(
127+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
128+
)
127129
os.chdir(old_dir)
128130
return process
129131

@@ -154,13 +156,13 @@ def launch_dpf(ansys_path, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=10, dock
154156
process : subprocess.Popen
155157
DPF Process.
156158
"""
157-
from ansys.dpf.core.server import port_in_use
158-
159159
process = _run_launch_server_process(ansys_path, ip, port, docker_name)
160160

161161
if docker_name is not None and os.name == 'posix':
162162
run_cmd = "docker ps --all"
163-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
163+
process = subprocess.Popen(
164+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
165+
)
164166
used_ports = []
165167
for line in io.TextIOWrapper(process.stdout, encoding="utf-8"):
166168
if not ("CONTAINER ID" in line):
@@ -653,7 +655,7 @@ def __init__(self,
653655
data_processing_core_load_api(path, "common")
654656
except Exception as e:
655657
if not os.path.isdir(os.path.dirname(path)):
656-
raise NotADirectoryError(
658+
raise NotADirectoryError(
657659
f"DPF directory not found at {os.path.dirname(path)}"
658660
f"Unable to locate the following file: {path}")
659661
raise e
@@ -872,26 +874,34 @@ def local_server(self):
872874

873875
def shutdown(self):
874876
if self._own_process and self.live:
875-
bShell = False
877+
b_shell = False
876878
if os.name == 'posix':
877-
bShell = True
879+
b_shell = True
878880
try:
879881
self._preparing_shutdown_func[0](self._preparing_shutdown_func[1])
880882
except Exception as e:
881883
warnings.warn("couldn't prepare shutdown: " + str(e.args))
882884
if self.on_docker:
883885
run_cmd = f"docker stop {self._server_id}"
884-
if bShell:
885-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
886+
if b_shell:
887+
process = subprocess.Popen(
888+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
889+
)
886890
else:
887-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
891+
process = subprocess.Popen(
892+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
893+
)
888894
run_cmd = f"docker rm {self._server_id}"
889-
for line in io.TextIOWrapper(process.stdout, encoding="utf-8"):
895+
for _ in io.TextIOWrapper(process.stdout, encoding="utf-8"):
890896
pass
891-
if bShell:
892-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
897+
if b_shell:
898+
_ = subprocess.Popen(
899+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
900+
)
893901
else:
894-
process = subprocess.Popen(run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
902+
_ = subprocess.Popen(
903+
run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
904+
)
895905
elif self._remote_instance:
896906
self._remote_instance.delete()
897907
else:

ansys/dpf/core/string_field.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,3 @@ def _set_data(self, data):
214214
)
215215
string_list = integral_types.MutableListString(data)
216216
return self._api.csstring_field_set_data(self, _get_size_of_list(data), string_list)
217-

ansys/dpf/core/support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def string_field_support_by_property(self, property_name: str):
112112
@version_requires("5.0")
113113
def available_field_supported_properties(self):
114114
"""Returns the list of property names supported by a Field.
115-
115+
116116
Returns
117117
-------
118118
list

examples/06-distributed-post/06-distributed_stress_averaging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
#
5959
# subgraph cluster_1 {
6060
# ds01 [label="data_src", shape=box, style=filled, fillcolor=cadetblue2];
61-
# no_extend_to_mid_nodes01 [label="no_extend_to_mid_nodes", shape=box, style=filled, fillcolor=cadetblue2];
61+
# no_extend_to_mid_nodes01 [label="no_extend_to_mid_nodes",
62+
# shape=box, style=filled, fillcolor=cadetblue2];
6263
#
6364
# ds01 -> stress01 [style=dashed];
6465
# no_extend_to_mid_nodes01 -> stress01 [style=dashed];
@@ -71,7 +72,8 @@
7172
#
7273
# subgraph cluster_2 {
7374
# ds02 [label="data_src", shape=box, style=filled, fillcolor=cadetblue2];
74-
# no_extend_to_mid_nodes02 [label="no_extend_to_mid_nodes", shape=box, style=filled, fillcolor=cadetblue2];
75+
# no_extend_to_mid_nodes02 [label="no_extend_to_mid_nodes",
76+
# shape=box, style=filled, fillcolor=cadetblue2];
7577
#
7678
# ds02 -> stress02 [style=dashed];
7779
# no_extend_to_mid_nodes02 -> stress02 [style=dashed];

tests/test_field.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import numpy as np
22
import pytest
33
import copy
4-
import os
54
from ansys import dpf
65
import conftest
76
from ansys.dpf import core

tests/test_fieldscontainer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ def test_collection_update_support():
306306
assert np.allclose(tfq.time_frequencies.data, tfq_check.time_frequencies.data)
307307

308308

309-
310309
@pytest.mark.skipif(os.name == 'posix', reason="linux issue: SEGFAULT to investigate")
311310
def test_deep_copy_over_time_fields_container(velocity_acceleration):
312311
model = dpf.Model(velocity_acceleration)

0 commit comments

Comments
 (0)