python-sdk-local 0.0.145__tar.gz → 0.0.147__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.
Files changed (20) hide show
  1. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/PKG-INFO +1 -1
  2. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/unified_json.py +0 -1
  3. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/utilities.py +25 -7
  4. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local.egg-info/PKG-INFO +1 -1
  5. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/setup.py +1 -1
  6. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/README.md +0 -0
  7. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/pyproject.toml +0 -0
  8. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/__init__.py +0 -0
  9. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/constants.py +0 -0
  10. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/http_response.py +0 -0
  11. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/item.py +0 -0
  12. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/our_object.py +0 -0
  13. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/service_response.py +0 -0
  14. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/valid_json_versions.py +0 -0
  15. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local/src/validate_environment.py +0 -0
  16. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local.egg-info/SOURCES.txt +0 -0
  17. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local.egg-info/dependency_links.txt +0 -0
  18. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local.egg-info/requires.txt +0 -0
  19. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/python_sdk_local.egg-info/top_level.txt +0 -0
  20. {python_sdk_local-0.0.145 → python_sdk_local-0.0.147}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sdk-local
3
- Version: 0.0.145
3
+ Version: 0.0.147
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-local-python-package
6
6
  Author: Circles
@@ -2,7 +2,6 @@ from .valid_json_versions import valid_json_versions
2
2
  from logger_local.MetaLogger import MetaLogger
3
3
 
4
4
 
5
- #
6
5
  # TODO Shall we merge it with the machine-learning-unified-json?
7
6
  class UnifiedJson(metaclass=MetaLogger):
8
7
  def __init__(self, data: dict, json_version: str):
@@ -1,4 +1,4 @@
1
- import inspect
1
+ import inspect # noqa
2
2
  import json
3
3
  import os
4
4
  import random
@@ -35,7 +35,7 @@ def append_if_not_exist(lst: list, item: object) -> None:
35
35
  lst.append(item)
36
36
 
37
37
 
38
- def to_dict(data: json or dict or None) -> dict:
38
+ def to_dict(data: dict | None) -> dict:
39
39
  if data is None:
40
40
  return {}
41
41
  if isinstance(data, dict):
@@ -43,11 +43,12 @@ def to_dict(data: json or dict or None) -> dict:
43
43
  return json.loads(data)
44
44
 
45
45
 
46
- def to_json(data: json or dict or None) -> json:
46
+ def to_json(data: dict | None) -> json:
47
47
  if data is None:
48
48
  data = {}
49
49
  if isinstance(data, dict):
50
- return json.dumps(data)
50
+ json_data = json.dumps(data, default=str)
51
+ return json_data
51
52
  return data
52
53
 
53
54
 
@@ -142,7 +143,7 @@ def is_valid_date_range(date_range: tuple) -> bool:
142
143
  return True
143
144
 
144
145
 
145
- def is_valid_datetime_range(datetime_range: (datetime, datetime)) -> bool:
146
+ def is_valid_datetime_range(datetime_range: tuple[datetime, datetime]) -> bool:
146
147
  """
147
148
  Validate that the datetime range is in the format 'YYYY-MM-DD HH:MM:SS'.
148
149
  """
@@ -250,7 +251,7 @@ def is_date_in_date_range(check_date: date, date_range: tuple) -> bool:
250
251
  return start_date <= check_date <= end_date
251
252
 
252
253
 
253
- def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (datetime, datetime)) -> bool:
254
+ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: tuple[datetime, datetime]) -> bool:
254
255
  """
255
256
  Check if the given datetime is within the specified datetime range.
256
257
 
@@ -334,7 +335,7 @@ def reformat_time_string(input_str: str) -> str:
334
335
  minutes = "00" if len(input_str) < 4 else input_str[2:4]
335
336
  seconds = "00" if len(input_str) < 6 else input_str[4:6]
336
337
  milliseconds = "00" if len(input_str) < 8 else input_str[6:8]
337
- # TODO Shall we use DEFAULT_DATETIME_FORMAT and have the formats in the central
338
+ # TODO Shall we use DEFAULT_DATETIME_FORMAT and have the formats in the central
338
339
  time_format = f"{hours}:{minutes}:{seconds}:{milliseconds}"
339
340
  return time_format
340
341
 
@@ -360,3 +361,20 @@ def camel_to_snake(camel_str: str) -> str:
360
361
  """Converts camelCase to snake_case."""
361
362
  snake_str = re.sub(r'(?<!^)(?=[A-Z])', '_', camel_str).lower()
362
363
  return snake_str
364
+
365
+
366
+ def strtobool(val):
367
+ """Convert a string representation of truth to true (1) or false (0).
368
+ True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
369
+ are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
370
+ 'val' is anything else.
371
+ """
372
+ if val is None:
373
+ return 0
374
+ val = val.lower()
375
+ if val in ('y', 'yes', 't', 'true', 'on', '1'):
376
+ return 1
377
+ elif val in ('n', 'no', 'f', 'false', 'off', '0'):
378
+ return 0
379
+ else:
380
+ raise ValueError("invalid truth value %r" % (val,))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sdk-local
3
- Version: 0.0.145
3
+ Version: 0.0.147
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-local-python-package
6
6
  Author: Circles
@@ -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.145', # https://pypi.org/project/python-sdk-local/
10
+ version='0.0.147', # https://pypi.org/project/python-sdk-local/
11
11
  author="Circles",
12
12
  author_email="info@circlez.ai",
13
13
  description="PyPI Package for Circles Python SDK Local Python",