~edwargix/git.sr.ht

09607c8917d4b10366527bbb2a2040c027593cde — Drew DeVault 7 years ago 3b66235
Cast editorconfig values to int
1 files changed, 7 insertions(+), 6 deletions(-)

M gitsrht/editorconfig.py
M gitsrht/editorconfig.py => gitsrht/editorconfig.py +7 -6
@@ 46,18 46,19 @@ class EditorConfig:
    def tab_width(self):
        if self._config == None:
            return 8
        val = self._config.get("tab_size", self._config.get("indent_size", 8))
        if not isinstance(val, int):
        try:
            return int(self._config.get("tab_size",
                self._config.get("indent_size", 8)))
        except ValueError:
            return 8
        return val

    def max_line_length(self):
        if self._config == None:
            return 80
        val = self._config.get("max_line_length", 80)
        if not isinstance(val, int):
        try:
            return int(self._config.get("max_line_length", 80))
        except ValueError:
            return 80
        return val

# Via https://github.com/editorconfig/editorconfig-core-py/blob/master/editorconfig/fnmatch.py
# 2-Clause BSD