Skip to content

Commit

Permalink
Further linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gfrn committed Sep 1, 2022
1 parent 6b36696 commit f2facb1
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ max-line-length = 88
max-complexity = 18
ignore =
E203, # See https://github.com/PyCQA/pycodestyle/issues/373
E266, E501, W503, E241, E722, W504
E501,
F601 #E266, E501, W503, E241, E722, W504
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
args: ["--config", ".black", "-v"]

- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ where = ["src"]

[project.optional-dependencies]
dev = [
"bandit==1.7.0",
"bandit==1.7.4",
"black==22.8.0",
"flake8==4.0.1",
"flake8-bandit==2.1.2",
"flake8-bugbear==21.9.2",
"flake8-implicit-str-concat==0.2.0",
"mypy==0.812",
"flake8==5.0.4",
"flake8-bandit==4.1.1",
"flake8-bugbear==22.8.23",
"flake8-implicit-str-concat==0.3.0",
"mypy==0.971",
"mypy-extensions==0.4.3",
"pyflakes==2.4.0",
"types-setuptools",
Expand Down
29 changes: 19 additions & 10 deletions src/pydrs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def set_param_bank(self, param_file: str) -> list:
ps_param_list[param][n],
param_hex.encode("latin-1"),
]
except:
except Exception:
break
return ps_param_list
# self.save_param_bank()
Expand All @@ -565,7 +565,7 @@ def read_csv_param_bank(self, param_csv_file: str):
for n in range(64):
try:
param_values.append(float(csv_param_list[param][n]))
except:
except Exception:
break
csv_param_list[param] = param_values

Expand All @@ -574,7 +574,7 @@ def read_csv_param_bank(self, param_csv_file: str):
@print_deprecated
def get_param_bank(
self,
list_param: list = common.params.keys(),
list_param: list = None,
timeout: float = 0.5,
print_modules: bool = True,
return_floathex: bool = False,
Expand All @@ -593,6 +593,9 @@ def get_param_bank(
return_floathex
Include hexadecimal representation of floats in returned value
"""
if list_param is None:
list_param = common.params.keys()

timeout_old = self.timeout
param_bank = {}

Expand Down Expand Up @@ -645,8 +648,11 @@ def set_dsp_coeffs(
self,
dsp_class: int,
dsp_id: int,
coeffs_list: list = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
coeffs_list: list = None,
) -> bytes:
if coeffs_list is None:
coeffs_list = [0] * 12

coeffs_list_full = format_list_size(coeffs_list, NUM_MAX_COEFFS_DSP)
payload_size = size_to_hex(1 + 2 + 2 + 4 * NUM_MAX_COEFFS_DSP)
hex_dsp_class = double_to_hex(dsp_class)
Expand Down Expand Up @@ -1281,7 +1287,7 @@ def recv_samples_buffer(self) -> list:
try:
for k in range(7, len(recv_msg) - 1, 4):
val.extend(struct.unpack("f", recv_msg[k : k + 4]))
except:
except Exception:
pass
return val

Expand Down Expand Up @@ -1688,7 +1694,7 @@ def read_vars_fac_dcdc(self, n=1, dt=0.5, iib=1):

prettier_print(vars_dict)
time.sleep(dt)
except:
except Exception:
pass

@print_deprecated
Expand Down Expand Up @@ -1738,7 +1744,7 @@ def read_vars_fac_dcdc_ema(self, n=1, dt=0.5, iib=0):
prettier_print(vars_dict)
time.sleep(dt)
return vars_dict
except:
except Exception:
pass

def _read_fac_2s_acdc_module(self, iib: bool) -> dict:
Expand Down Expand Up @@ -2364,7 +2370,7 @@ def check_param_bank(self, param_file: str):
try:
print(str(param[0]) + "[" + str(n) + "]: " + str(param[n + 1]))
print(self.set_param(str(param[0]), n, float(param[n + 1])))
except:
except Exception:
break

# TODO: Fix siriuspy dependency
Expand Down Expand Up @@ -2440,7 +2446,7 @@ def set_prbs_sampling_freq(self, freq, type_memory):
@print_deprecated
def get_dsp_modules_bank(
self,
list_dsp_classes=[1, 2, 3, 4, 5, 6],
list_dsp_classes=None,
print_modules=True,
return_floathex=False,
) -> dict:
Expand All @@ -2461,6 +2467,9 @@ def get_dsp_modules_bank(
dict
Dict containing DSP modules parameter bank
"""
if list_dsp_classes is None:
list_dsp_classes = [1, 2, 3, 4, 5, 6]

dsp_modules_bank = {}
for dsp_class in list_dsp_classes:
dsp_modules_bank[dsp_classes_names[dsp_class]] = {
Expand Down Expand Up @@ -2995,7 +3004,7 @@ def test_bid_board(self, password):
else:
print("\n Placa BID reprovada!\n")

except:
except Exception:
print(" Placa BID reprovada!\n")

def upload_parameters_bid(self, password):
Expand Down
7 changes: 0 additions & 7 deletions src/pydrs/consts/common.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
"""""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """''
======================================================================
Listas de Entidades BSMP
A posição da entidade na lista corresponde ao seu ID BSMP
======================================================================
""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" ""

ps_models = [
"Empty",
"FBP",
Expand Down
7 changes: 0 additions & 7 deletions src/pydrs/consts/fac.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
"""""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """''
======================================================================
Listas de Entidades BSMP
A posição da entidade na lista corresponde ao seu ID BSMP
======================================================================
""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" ""

# FAC ACDC
list_acdc_soft_interlocks = []

Expand Down
7 changes: 0 additions & 7 deletions src/pydrs/consts/fap.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
"""""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """''
======================================================================
Listas de Entidades BSMP
A posição da entidade na lista corresponde ao seu ID BSMP
======================================================================
""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" ""

# FAP
list_soft_interlocks = [
"DCCT 1 Fault",
Expand Down
7 changes: 0 additions & 7 deletions src/pydrs/consts/fbp.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
"""""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """''
======================================================================
Listas de Entidades BSMP
A posição da entidade na lista corresponde ao seu ID BSMP
======================================================================
""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" ""

# FBP
soft_interlocks = ["Heat-Sink Overtemperature"]

Expand Down

0 comments on commit f2facb1

Please sign in to comment.