naeural-client 2.7.26__py3-none-any.whl → 2.7.27__py3-none-any.whl

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.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.7.26"
1
+ __VER__ = "2.7.27"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -1648,8 +1648,7 @@ class BaseLogger(object):
1648
1648
  return result
1649
1649
 
1650
1650
 
1651
- @staticmethod
1652
- def utc_to_local(remote_datetime, remote_utc, fmt='%Y-%m-%d %H:%M:%S', as_string=False):
1651
+ def utc_to_local(self, remote_datetime, remote_utc, fmt='%Y-%m-%d %H:%M:%S', as_string=False):
1653
1652
  """
1654
1653
  Given a "remote" datetime (in datetime or str format) and a string or int denoting an offset
1655
1654
  will return local datetime as a datetime object.
@@ -1668,13 +1667,21 @@ class BaseLogger(object):
1668
1667
  """
1669
1668
  if remote_utc is None:
1670
1669
  remote_utc = 'UTC+3'
1671
- if isinstance(remote_utc, str):
1672
- remote_utc = tz.gettz(remote_utc)
1673
- elif isinstance(remote_utc, int):
1674
- utc_offset = remote_utc
1675
- remote_utc = tz.tzoffset(None, timedelta(hours=utc_offset))
1676
- elif not isinstance(remote_utc, tzinfo):
1677
- raise ValueError("Unknown remote_utc type: {}".format(type(remote_utc)))
1670
+ try:
1671
+ if isinstance(remote_utc, str):
1672
+ remote_utc = tz.gettz(remote_utc)
1673
+ elif isinstance(remote_utc, int):
1674
+ utc_offset = remote_utc
1675
+ remote_utc = tz.tzoffset(None, timedelta(hours=utc_offset))
1676
+ elif not isinstance(remote_utc, tzinfo):
1677
+ raise ValueError("Unknown remote_utc type: {}".format(type(remote_utc)))
1678
+ except Exception as exc:
1679
+ # if it breaks use local time
1680
+ remote_utc = tz.tzlocal()
1681
+ self.P("Error in remote_datetime: {} requested remote_utc: {}, Error: {}. Using local timezone {} for given date.".format(
1682
+ remote_datetime, remote_utc, exc, remote_utc), color='r'
1683
+ )
1684
+
1678
1685
 
1679
1686
  if isinstance(remote_datetime, str):
1680
1687
  remote_datetime = dt.strptime(remote_datetime, fmt)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.26
3
+ Version: 2.7.27
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -1,5 +1,5 @@
1
1
  naeural_client/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- naeural_client/_ver.py,sha256=4aJFznz6iNPoG438iPfI7U7QS5QQHePWmnhay4adMFM,331
2
+ naeural_client/_ver.py,sha256=xPABtqoee7FOJbdkfLEdq81iAPs9A1AH0mTWt03WkkA,331
3
3
  naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
4
4
  naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
@@ -60,7 +60,7 @@ naeural_client/io_formatter/default/a_dummy.py,sha256=qr9eUizQ-NN5jdXVzkaZKMaf9K
60
60
  naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7td5Ri1A,3052
61
61
  naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
62
62
  naeural_client/logging/__init__.py,sha256=b79X45VC6c37u32flKB2GAK9f-RR0ocwP0JDCy0t7QQ,33
63
- naeural_client/logging/base_logger.py,sha256=YxTqqjWpA6GCG_HoKbibSxkMGhVfIxfSPANUDrszzp0,69292
63
+ naeural_client/logging/base_logger.py,sha256=c-ZSMHc_eO84MKrLOJcClxvhQydFD8W0LoWe5_hu2ag,69611
64
64
  naeural_client/logging/small_logger.py,sha256=m12hCb_H4XifJYYfgCAOUDkcXm-h4pSODnFf277OFVI,2937
65
65
  naeural_client/logging/logger_mixins/__init__.py,sha256=yQO7umlRvz63FeWpi-F9GRmC_MOHcNW6R6pwvZZBy3A,600
66
66
  naeural_client/logging/logger_mixins/class_instance_mixin.py,sha256=xUXE2VZgmrlrSrvw0f6GF1jlTnVLeVkIiG0bhlBfq3o,2741
@@ -85,8 +85,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
85
85
  naeural_client/utils/config.py,sha256=IG7-rRYBWCqCiI2kDesFmY8gld0Ku9xWgzNPE1rwVcA,10352
86
86
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
87
87
  naeural_client/utils/oracle_sync/oracle_tester.py,sha256=GmZwu2JM9_UB2K-4rKB3o0RgWLqM-7Im6HwBnQLXmHI,25312
88
- naeural_client-2.7.26.dist-info/METADATA,sha256=OXbhHwmcarRtknEk377dMK7-22QOBTWLRxiEQWm2-Dg,12354
89
- naeural_client-2.7.26.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
90
- naeural_client-2.7.26.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
91
- naeural_client-2.7.26.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
92
- naeural_client-2.7.26.dist-info/RECORD,,
88
+ naeural_client-2.7.27.dist-info/METADATA,sha256=ljUYQkJp_UZZ1YFBTa40yuFvo-DgIAvTQUQJsVnmg50,12354
89
+ naeural_client-2.7.27.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
90
+ naeural_client-2.7.27.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
91
+ naeural_client-2.7.27.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
92
+ naeural_client-2.7.27.dist-info/RECORD,,