From 92c5069868114d4961992894992844b4ffb6c475 Mon Sep 17 00:00:00 2001 From: "Joab Leite S. Neto" Date: Sun, 5 Sep 2021 21:29:04 -0300 Subject: [PATCH] V1.5.6 (#159) * fixes: use builtin func * fixes: csv --- cereja/__init__.py | 2 +- cereja/file/_io.py | 4 ++-- cereja/utils/_utils.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cereja/__init__.py b/cereja/__init__.py index 7e91301..10b0dc3 100644 --- a/cereja/__init__.py +++ b/cereja/__init__.py @@ -47,7 +47,7 @@ from . import experimental from ._requests import request -VERSION = "1.5.5.final.0" +VERSION = "1.5.6.final.0" __version__ = get_version_pep440_compliant(VERSION) diff --git a/cereja/file/_io.py b/cereja/file/_io.py index 6444ae2..54b3fc4 100644 --- a/cereja/file/_io.py +++ b/cereja/file/_io.py @@ -621,7 +621,7 @@ def __init__(self, *args, cols: Union[Tuple[str], List[str]] = (), fill_with=Non self._str_to_literal = str_to_literal self._fill_with = fill_with self._n_values = 0 - self._has_col = has_col or cols + self._has_col = has_col super().__init__(*args, **kwargs) @property @@ -675,7 +675,7 @@ def parse(self, data: Union[Iterable[Iterable[Any]], str, int, float, complex], if not is_sequence(data): data = [data] for row in data: - if not self._cols and self._has_col: + if not self._cols: # set cols on first iter self._cols = fill(value=list(row), max_size=len(row), with_=fill_with) continue diff --git a/cereja/utils/_utils.py b/cereja/utils/_utils.py index 1a8cd97..945413a 100644 --- a/cereja/utils/_utils.py +++ b/cereja/utils/_utils.py @@ -370,10 +370,10 @@ def list_methods(klass) -> List[str]: return methods -def string_to_literal(val: str): - if isinstance(val, str): +def string_to_literal(val: Union[str, bytes]): + if isinstance(val, (str, bytes)): try: - return ast.literal_eval(val) + return eval(val) except: pass return val