ImperialCollegeLondon / safedata_validator

Python tools to validate and publish datasets using the safedata metadata format.
https://safedata-validator.readthedocs.io/
MIT License
2 stars 4 forks source link

Easier `FORMATTER` indenting with context manager? #90

Open davidorme opened 9 months ago

davidorme commented 9 months ago

We could potentially avoid all the:

FORMATTER.push()
...
FORMATTER.pop()

By defining a context manager:

with FORMATTER.indent_by():
    ...

I think this is clearer, although makes indentation in the code deeper.

jacobcook1995 commented 9 months ago

I think the switch makes sense (provided that it doesn't entail too much work). Just in the sense that a context managers are standard python syntax, whereas I lost a bit of time due to not paying enough attention to the exact placement of FORMATTER.push() and pop() statements