python-sdk-remote 0.0.133__tar.gz → 0.0.135__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of python-sdk-remote might be problematic. Click here for more details.
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/PKG-INFO +1 -1
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/our_object.py +16 -4
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/setup.py +1 -1
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/README.md +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/constants.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/http_response.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/mini_logger.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/unified_json.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/utilities.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/setup.cfg +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from abc import ABC # , abstractmethod
|
|
3
|
+
from datetime import datetime
|
|
3
4
|
|
|
4
5
|
from .mini_logger import MiniLogger as logger
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
# TODO Where are we using it? Shall we extend the usage of OurObject as the father of all our entities?
|
|
8
9
|
class OurObject(ABC):
|
|
9
|
-
def __init__(self, **kwargs):
|
|
10
|
+
def __init__(self, id_column_name, **kwargs):
|
|
10
11
|
INIT_METHOD_NAME = '__init__'
|
|
11
12
|
logger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
|
|
12
|
-
|
|
13
|
+
setattr(self, 'id_column_name', id_column_name)
|
|
13
14
|
for field, value in kwargs.items():
|
|
14
15
|
# if field in event_fields:
|
|
15
16
|
setattr(self, field, value)
|
|
@@ -17,12 +18,16 @@ class OurObject(ABC):
|
|
|
17
18
|
# self.kwargs = kwargs
|
|
18
19
|
logger.end(INIT_METHOD_NAME, object={'kwargs': kwargs})
|
|
19
20
|
|
|
21
|
+
def get_id_column_name(self):
|
|
22
|
+
"""Returns the id of the object"""
|
|
23
|
+
return self.get('id_column_name')
|
|
24
|
+
|
|
20
25
|
# Commented so we can use it in database foreach()
|
|
21
26
|
# @abstractmethod
|
|
22
27
|
def get_name(self):
|
|
23
28
|
"""Returns the name of the object"""
|
|
24
29
|
# raise NotImplementedError(
|
|
25
|
-
|
|
30
|
+
# "Subclasses must implement the 'get_name' method.")
|
|
26
31
|
|
|
27
32
|
def get(self, attr_name: str):
|
|
28
33
|
"""Returns the value of the attribute with the given name"""
|
|
@@ -41,7 +46,14 @@ class OurObject(ABC):
|
|
|
41
46
|
|
|
42
47
|
def to_json(self) -> str:
|
|
43
48
|
"""Returns a json string representation of this object"""
|
|
44
|
-
return json.dumps(self.__dict__)
|
|
49
|
+
return json.dumps(self.__dict__, default=self._serialize)
|
|
50
|
+
|
|
51
|
+
@staticmethod
|
|
52
|
+
def _serialize(obj):
|
|
53
|
+
"""Custom serialization function for unsupported types. Used by json.dumps"""
|
|
54
|
+
if isinstance(obj, datetime):
|
|
55
|
+
return obj.isoformat() # Converts datetime to ISO 8601 string
|
|
56
|
+
raise TypeError(f"Type {type(obj)} not serializable")
|
|
45
57
|
|
|
46
58
|
def from_json(self, json_string: str) -> 'OurObject':
|
|
47
59
|
"""Returns an instance of the class from a json string"""
|
|
@@ -7,7 +7,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
|
|
|
7
7
|
# python -m build needs pyproject.toml or setup.py
|
|
8
8
|
setuptools.setup(
|
|
9
9
|
name=PACKAGE_NAME,
|
|
10
|
-
version='0.0.
|
|
10
|
+
version='0.0.135', # https://pypi.org/project/python-sdk-remote/
|
|
11
11
|
author="Circles",
|
|
12
12
|
author_email="info@circlez.ai",
|
|
13
13
|
description="PyPI Package for Circles Python SDK Local Python",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/http_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/mini_logger.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/unified_json.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.133 → python_sdk_remote-0.0.135}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|