Minor cosmetical and readability suggestions
A few tips for code organisation:
- Between functions, keep two empty lines to make the code more readable (avoid https://gitlab.idiap.ch/bob/bob.db.drive/blob/master/bob/db/drive/query.py#L37)
- If a class has no inheritance, just say
class X
instead ofclass X()
(avoid https://gitlab.idiap.ch/bob/bob.db.drive/blob/master/bob/db/drive/query.py#L14) - Instead of explicitly using
open
/close
constructs in Python, usewith
(as withwith open(db_json,'r') as f: #use f
). That makes your code more readable and safe, as the file will always be closed no matter what happens, even if any of the lines within that context raise an exception! No need to close the file withwith
, it is done automagically for you.