Skip to content
Snippets Groups Projects
Commit df73e065 authored by smagnin's avatar smagnin
Browse files

Correct pylint

parent ec784ff1
No related branches found
No related tags found
No related merge requests found
Pipeline #19498 failed
...@@ -70,6 +70,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): ...@@ -70,6 +70,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
metadata[name] = metadata_files metadata[name] = metadata_files
return metadata return metadata
# pylint: disable=too-many-branches
def _parse_files(self) -> tuple: def _parse_files(self) -> tuple:
metadata = {} # type: dict metadata = {} # type: dict
caller = sys._getframe(1).f_code.co_name caller = sys._getframe(1).f_code.co_name
...@@ -132,7 +133,6 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): ...@@ -132,7 +133,6 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
if abort: if abort:
os.remove(self.output_filename) os.remove(self.output_filename)
return metadata, abort return metadata, abort
# pylint: disable=too-many-branches
def remove_all(self) -> bool: def remove_all(self) -> bool:
ret = self._parse_files() ret = self._parse_files()
......
...@@ -74,11 +74,12 @@ def show_meta(filename: str): ...@@ -74,11 +74,12 @@ def show_meta(filename: str):
for k, v in metadata: for k, v in metadata:
zipmeta = v zipmeta = v
zipmeta_name = v
try: # FIXME this is ugly. try: # FIXME this is ugly.
if not isinstance(zipmeta, dict): if not isinstance(zipmeta, dict):
print(" %s: %s" % (k, v)) print(" %s: %s" % (k, v))
except UnicodeEncodeError: except UnicodeEncodeError:
print(" %s: harmful content" % k) print(" %s: harmful content" % zipmeta_name)
if mtype == "application/zip": if mtype == "application/zip":
print("[+] Metadata for files inside the archive :") print("[+] Metadata for files inside the archive :")
if isinstance(zipmeta, dict): if isinstance(zipmeta, dict):
...@@ -88,7 +89,7 @@ def show_meta(filename: str): ...@@ -88,7 +89,7 @@ def show_meta(filename: str):
for meta_name, meta in metas.items(): for meta_name, meta in metas.items():
print(" %s: %s" % (meta_name, meta)) print(" %s: %s" % (meta_name, meta))
except UnicodeEncodeError: except UnicodeEncodeError:
print(" %s: harmful content" % k) print(" %s: harmful content" % zipmeta_name)
def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool: def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool:
if not __check_file(filename, os.R_OK|os.W_OK): if not __check_file(filename, os.R_OK|os.W_OK):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment