From 12c1577cd4b11615c70915da77befc0a8c35d90a Mon Sep 17 00:00:00 2001 From: Genarito Date: Sun, 1 Aug 2021 20:08:26 -0300 Subject: [PATCH] + Version 1.4.1 + Cleaned some stuff --- gura/GuraParser.py | 11 +++++------ gura/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gura/GuraParser.py b/gura/GuraParser.py index 4072218..f8ee188 100644 --- a/gura/GuraParser.py +++ b/gura/GuraParser.py @@ -696,8 +696,7 @@ def literal_string(self) -> MatchResult: return MatchResult(MatchResultType.PRIMITIVE, ''.join(chars)) - @staticmethod - def dumps(value: Dict) -> str: + def dumps(self, value: Dict) -> str: """ Generates a Gura string from a dictionary (aka. stringify). Takes a value, check its type and returns its correct value in a recursive way @@ -731,7 +730,7 @@ def dumps(value: Dict) -> str: # If the value is an object, splits the stringified value by # newline and indents each line before adding it to the result if type(dict_value) == dict: - stringified_value = dumps(dict_value).rstrip() + stringified_value = self.dumps(dict_value).rstrip() if len(dict_value) > 0: result += '\n' @@ -742,21 +741,21 @@ def dumps(value: Dict) -> str: result += ' ' + stringified_value + '\n' # Otherwise adds the stringified value else: - result += f' {dumps(dict_value)}\n' + result += f' {self.dumps(dict_value)}\n' return result if value_type == list: should_multiline = any((type(e) == dict or type(e) == list) and len(e) > 0 for e in value) if not should_multiline: - stringify_values = list(map(dumps, value)) + stringify_values = list(map(self.dumps, value)) return f'[{", ".join(stringify_values)}]' result = '[' last_idx = len(value) - 1 for idx, entry in enumerate(value): - stringified_value = dumps(entry).rstrip() + stringified_value = self.dumps(entry).rstrip() result += '\n' diff --git a/gura/__init__.py b/gura/__init__.py index 5ba59a7..c4e3fd2 100644 --- a/gura/__init__.py +++ b/gura/__init__.py @@ -2,7 +2,7 @@ VariableNotDefinedError, DuplicatedImportError, loads, dumps from gura.Parser import ParseError -__version__ = "1.4.0" +__version__ = "1.4.1" loads = loads dumps = dumps diff --git a/setup.py b/setup.py index de7f936..444353d 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ author='JWare', author_email='jware.organization@gmail.com', url='https://github.com/gura-conf/gura-python-parser', - download_url='https://github.com/gura-conf/gura-python-parser/archive/refs/tags/1.4.0.tar.gz', + download_url='https://github.com/gura-conf/gura-python-parser/archive/refs/tags/1.4.1.tar.gz', keywords=['Gura', 'parser', 'loads', 'dumps', 'encode', 'decode'], install_requires=[ 'wheel'