Skip to content

Commit

Permalink
flake8/pylint -> ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
awoimbee committed Apr 15, 2024
1 parent 1e72320 commit 5cdd16c
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 216 deletions.
19 changes: 1 addition & 18 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,7 @@ tasks:
desc: Lints the code and reports on issues.
cmds:
- poetry run black --check lasso
# E501:
# We disable too long lines in ArrayType since the docstrings for arrays
# must be behind the arrays for sphinx, thus lines cannot be shortened.
# Anyhow if you find any way to change feel free to submit a PR.
# E203:
# We ignore E203 since allowing whitespace around ':' makes slicing
# more understandable when doing complex slicing.
# W503:
# Allowing operators such as '+' after a new line instead of putting it
# on the previous one, complex condition chains are more understandable.
- |
poetry run flake8 lasso \
--ignore="E203,W503" \
--per-file-ignores="lasso/dyna/ArrayType.py:E501" \
--show-source \
--statistics \
--count
- poetry run pylint lasso
- poetry run ruff check

build:
desc: Builds the python package
Expand Down
6 changes: 0 additions & 6 deletions lasso/dyna/femzip_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@
(FemzipArrayType.STRAIN_XY, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_YZ, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_XZ, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_X, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_Y, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_Z, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_XY, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_YZ, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
(FemzipArrayType.STRAIN_XZ, FemzipVariableCategory.SOLID): {ArrayType.element_solid_strain},
# AIRBAG
(FemzipArrayType.AIRBAG_STATE_GEOM, FemzipVariableCategory.CPM_AIRBAG): {
ArrayType.airbag_n_active_particles,
Expand Down
6 changes: 3 additions & 3 deletions lasso/dyna/lsda_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def writecd(self, dir):
length = self.lengthsize + self.commandsize + len(dir)
s = struct.pack(self.lcunpack, length, Lsda.CD)
self.fp.write(s)
if type(dir) is str:
if isinstance(dir, str):
self.fp.write(bytes(dir, "utf-8"))
else:
self.fp.write(dir)
Expand All @@ -118,7 +118,7 @@ def writestentry(self, r):
)
s = struct.pack(self.lcunpack, length, Lsda.VARIABLE)
self.fp.write(s)
if type(r.name) is str:
if isinstance(r.name, str):
self.fp.write(bytes(r.name, "utf-8"))
else:
self.fp.write(r.name)
Expand Down Expand Up @@ -525,7 +525,7 @@ def cd(self, path, create=2): # change CWD
self.cwd = self.root
# path = string.split(path,"/")
# print(type(path))
if type(path) is bytes:
if isinstance(path, bytes):
path = str(path, "utf-8").split("/")
else:
path = path.split("/")
Expand Down
209 changes: 51 additions & 158 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5cdd16c

Please sign in to comment.