From db26ec5d1fc70f2c68b0c6b2c089f932c3e1be8d Mon Sep 17 00:00:00 2001 From: Ahmed Bilal Khalid Date: Thu, 12 Sep 2019 13:49:06 +0500 Subject: [PATCH] now compatible with Python >=3.5 --- etcd3_wrapper/__init__.py | 2 +- etcd3_wrapper/etcd3_wrapper.py | 11 +++-------- setup.py | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/etcd3_wrapper/__init__.py b/etcd3_wrapper/__init__.py index 1b57050..8e039f7 100755 --- a/etcd3_wrapper/__init__.py +++ b/etcd3_wrapper/__init__.py @@ -1,2 +1,2 @@ -from .etcd3_wrapper import Etcd3Wrapper, EtcdEntry +from etcd3_wrapper import Etcd3Wrapper, EtcdEntry name = "etcd3_wrapper" \ No newline at end of file diff --git a/etcd3_wrapper/etcd3_wrapper.py b/etcd3_wrapper/etcd3_wrapper.py index cef57ba..1c4df52 100755 --- a/etcd3_wrapper/etcd3_wrapper.py +++ b/etcd3_wrapper/etcd3_wrapper.py @@ -4,25 +4,20 @@ import queue import copy from collections import namedtuple -from dataclasses import dataclass PseudoEtcdMeta = namedtuple("PseudoEtcdMeta", ["key"]) -@dataclass(init=False) class EtcdEntry: - key: str - value: str + # key: str + # value: str def __init__(self, meta, value, value_in_json=False): self.key = meta.key.decode("utf-8") self.value = value.decode("utf-8") if value_in_json: - try: - self.value = json.loads(self.value) - except json.JSONDecodeError as e: - print(f"Json Error: {e}, value={value}") + self.value = json.loads(self.value) class Etcd3Wrapper: diff --git a/setup.py b/setup.py index 921d7fd..6ced2cc 100644 --- a/setup.py +++ b/setup.py @@ -19,5 +19,5 @@ setuptools.setup( classifiers=[ 'Programming Language :: Python :: 3', ], - python_requires='>=3.6', + python_requires='>=3.5', )