fix: [flake8] Addressed flake8 warnings.

This commit is contained in:
Cédric Bonhomme 2022-11-20 21:49:02 +01:00
parent 0f8b0cef1f
commit fb4b596726
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
8 changed files with 17 additions and 13 deletions

View file

@ -31,7 +31,7 @@ tasks:
# stop the build if there are Python syntax errors or undefined names # stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. # exit-zero treats all errors as warnings.
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics poetry run flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- test: | - test: |
export PATH="$PATH:/home/build/.local/bin" export PATH="$PATH:/home/build/.local/bin"
cd ${project} cd ${project}

View file

@ -29,7 +29,7 @@ jobs:
# stop the build if there are Python syntax errors or undefined names # stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=15 --max-line-length=127 --statistics poetry run flake8 . --count --max-complexity=15 --max-line-length=127 --statistics
- name: Test with pytest - name: Test with pytest
run: | run: |

View file

@ -56,7 +56,8 @@ class ValidateGenerator(argparse.Action):
def main(): def main():
parser = argparse.ArgumentParser(prog="stegano-lsb") parser = argparse.ArgumentParser(prog="stegano-lsb")
subparsers = parser.add_subparsers( subparsers = parser.add_subparsers(
help="sub-command help", dest="command", required=True) help="sub-command help", dest="command", required=True
)
# Subparser: Hide # Subparser: Hide
parser_hide = subparsers.add_parser("hide", help="hide help") parser_hide = subparsers.add_parser("hide", help="hide help")
@ -155,9 +156,7 @@ def main():
) )
# Subparser: List generators # Subparser: List generators
parser_list_generators = subparsers.add_parser( subparsers.add_parser("list-generators", help="list-generators help")
"list-generators", help="list-generators help"
)
arguments = parser.parse_args() arguments = parser.parse_args()

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .exifHeader import * from .exifHeader import hide, reveal
__all__ = ["hide", "reveal"]

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .lsb import * from .lsb import hide, reveal
__all__ = ["hide", "reveal"]

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .red import * from .red import hide, reveal
__all__ = ["hide", "reveal"]

View file

@ -1,5 +1,2 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .parity import *
from .statistics import *

View file

@ -209,7 +209,9 @@ class Revealer:
raise IndexError("Impossible to detect message.") raise IndexError("Impossible to detect message.")
if len(self._bitab) - len(str(self._limit)) - 1 == self._limit: if len(self._bitab) - len(str(self._limit)) - 1 == self._limit:
self.secret_message = "".join(self._bitab)[len(str(self._limit)) + 1 :] self.secret_message = "".join(self._bitab)[
len(str(self._limit)) + 1 : # noqa: E203
]
self.encoded_image.close() self.encoded_image.close()
return True return True