Add ZIP archives support
2 unresolved threads
2 unresolved threads
I create this MR to have your help. There are some issues with the CI. Can you help me to correct them ?
Merge request reports
Activity
well, the CI messages are pretty clear:
$ pylint3 --extension-pkg-whitelist=cairo,gi ./libmat2 ./mat2 ************* Module libmat2.archive W: 53, 4: Static method with 'self' as first argument (bad-staticmethod-argument) R: 74, 4: Too many branches (15/12) (too-many-branches) ************* Module mat2 W: 91,52: Using possibly undefined loop variable 'k' (undefined-loop-variable)
64 65 if zipinfo.date_time != (1980, 1, 1, 0, 0, 0): 65 66 metadata['date_time'] = str(datetime.datetime(*zipinfo.date_time)) 66 67 68 ret = self._parse_files() 69 metadata_files = ret[0] 70 for name, _ in metadata_files.items(): 71 metadata[name] = metadata_files 67 72 return metadata 68 73 69 def remove_all(self) -> bool: 70 # pylint: disable=too-many-branches 71 74 def _parse_files(self) -> tuple: 75 metadata = {} # type: dict 76 caller = sys._getframe(1).f_code.co_name Ouch, please don't do that. Feel free to copy/paste code instead of using this kind of black magic
Edited by jvoisinYou didn't say to avoid c/c code ? So you prefer to have twice the code to remove and show metadata?
Edited by Simon MagninAbsolutely :)
We can always refactor later, but if the code is too, well, magic, refactoring can become pretty hard.
Side notes:
- You're not really supposed to call methods prefixed by
_
outside of the class implementing them - Runtime introspection of the callstack isn't something that should be done in normal Python programs. This feature is mostly here to build debuggers.
- Runtime introspection makes it harder to reason about program; static analyzers are already struggling with regular Python, no need to make their job harder :D
Edited by jvoisin- You're not really supposed to call methods prefixed by
Aw, you did a single MR for both archive support, and recursive metadata :/ What about only adding zip support, and then, in an other PR, recursive metadata?
Edited by jvoisinImplemented in 3a070b0a, feel free to add more archive formats ;)
Please register or sign in to reply