bosdyn-core 3.3.2__py3-none-any.whl → 4.0.1__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.
- bosdyn/bddf/file_indexer.py +2 -2
- bosdyn/deprecated.py +47 -0
- bosdyn/util.py +19 -12
- {bosdyn_core-3.3.2.dist-info → bosdyn_core-4.0.1.dist-info}/METADATA +2 -2
- {bosdyn_core-3.3.2.dist-info → bosdyn_core-4.0.1.dist-info}/RECORD +7 -6
- {bosdyn_core-3.3.2.dist-info → bosdyn_core-4.0.1.dist-info}/WHEEL +1 -1
- {bosdyn_core-3.3.2.dist-info → bosdyn_core-4.0.1.dist-info}/top_level.txt +0 -0
bosdyn/bddf/file_indexer.py
CHANGED
|
@@ -83,7 +83,7 @@ class FileIndexer:
|
|
|
83
83
|
|
|
84
84
|
Args:
|
|
85
85
|
series_type: the kind of spec, corresponding to the set of keys expected in series_spec.
|
|
86
|
-
series_spec: dict of {key (string) -> value (string)
|
|
86
|
+
series_spec: dict of {key (string) -> value (string)} describing the series.
|
|
87
87
|
message_type: MessageTypeDescriptor (need EITHER this OR pod_type)
|
|
88
88
|
pod_type: PodTypeDescriptor (need EITHER this OR pod_type)
|
|
89
89
|
annotations: optional dict of key (string) -> value (string) pairs to
|
|
@@ -138,7 +138,7 @@ class FileIndexer:
|
|
|
138
138
|
|
|
139
139
|
def index_data_block( # pylint: disable=too-many-arguments
|
|
140
140
|
self, series_index, timestamp_nsec, file_offset, nbytes, additional_indexes):
|
|
141
|
-
"""Add
|
|
141
|
+
"""Add an entry to the data block index of the series identified by series_index."""
|
|
142
142
|
series_block_index = self._series_block_indexes[series_index]
|
|
143
143
|
block_entry = series_block_index.block_entries.add(file_offset=file_offset)
|
|
144
144
|
block_entry.timestamp.FromNanoseconds(timestamp_nsec)
|
bosdyn/deprecated.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Copyright (c) 2023 Boston Dynamics, Inc. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# Downloading, reproducing, distributing or otherwise using the SDK Software
|
|
4
|
+
# is subject to the terms and conditions of the Boston Dynamics Software
|
|
5
|
+
# Development Kit License (20191101-BDSDK-SL).
|
|
6
|
+
|
|
7
|
+
from functools import wraps
|
|
8
|
+
|
|
9
|
+
from deprecated.sphinx import deprecated
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def moved_to(new_func, **deprecation_kwargs):
|
|
13
|
+
"""Deprecate a function because it was moved to another location."""
|
|
14
|
+
deprecation_kwargs.setdefault(
|
|
15
|
+
'reason', f'This has been moved to {new_func.__module__}. '
|
|
16
|
+
f'Please use {new_func.__module__}.{new_func.__name__} instead.')
|
|
17
|
+
return _deprecate_to_new(new_func, **deprecation_kwargs)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def renamed_to(new_func, **deprecation_kwargs):
|
|
21
|
+
"""Deprecate a function because it was renamed."""
|
|
22
|
+
deprecation_kwargs.setdefault(
|
|
23
|
+
'reason',
|
|
24
|
+
f'This has been renamed to {new_func.__name__}. Please use {new_func.__name__} instead.')
|
|
25
|
+
return _deprecate_to_new(new_func, **deprecation_kwargs)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _deprecate_to_new(new_func, **deprecation_kwargs):
|
|
29
|
+
"""Deprecation helper that creates a wrapper with a new docstring that deprecated() can modify.
|
|
30
|
+
When using deprecated.sphinx.deprecated, it modifies the docstring of the wrapped function.
|
|
31
|
+
For cases where we have moved a function and want to deprecate the old location, we would often
|
|
32
|
+
write
|
|
33
|
+
|
|
34
|
+
old_name = deprecated(reason = ...)(new_name)
|
|
35
|
+
|
|
36
|
+
which has the unfortunate side effect of modifying the new name to say in its docstring that it
|
|
37
|
+
is deprecated.
|
|
38
|
+
|
|
39
|
+
This alternate version will prevent the original's docstring from being modified, only modifying
|
|
40
|
+
the wrapper's docstring."""
|
|
41
|
+
deprecation_kwargs.setdefault('action', 'always')
|
|
42
|
+
|
|
43
|
+
@wraps(new_func)
|
|
44
|
+
def wrapper(*args, **kwargs):
|
|
45
|
+
return new_func(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
return deprecated(**deprecation_kwargs)(wrapper)
|
bosdyn/util.py
CHANGED
|
@@ -5,27 +5,34 @@
|
|
|
5
5
|
# Development Kit License (20191101-BDSDK-SL).
|
|
6
6
|
|
|
7
7
|
"""Common utilities for API Python code."""
|
|
8
|
-
from __future__ import division
|
|
9
|
-
|
|
10
8
|
import datetime
|
|
9
|
+
import os
|
|
11
10
|
import re
|
|
12
11
|
import sys
|
|
13
12
|
import time
|
|
13
|
+
from typing import Callable
|
|
14
14
|
|
|
15
15
|
from google.protobuf.duration_pb2 import Duration
|
|
16
16
|
from google.protobuf.timestamp_pb2 import Timestamp
|
|
17
17
|
|
|
18
|
-
if sys.version_info[0] >= 3:
|
|
19
|
-
LONG = int
|
|
20
|
-
else:
|
|
21
|
-
LONG = long
|
|
22
|
-
|
|
23
18
|
THOUSAND = 10**3
|
|
24
19
|
MILLION = 10**6
|
|
25
20
|
BILLION = 10**9
|
|
26
21
|
|
|
27
22
|
NSEC_PER_SEC = BILLION
|
|
28
23
|
|
|
24
|
+
# Returns the time in seconds.
|
|
25
|
+
ClockFn = Callable[[], float]
|
|
26
|
+
|
|
27
|
+
# Global variable representing the current clock source.
|
|
28
|
+
_clock_source_fn: ClockFn = time.time
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def set_clock_source(clock_fn: ClockFn) -> None:
|
|
32
|
+
"""Set the clock source to use the input clock source."""
|
|
33
|
+
global _clock_source_fn
|
|
34
|
+
_clock_source_fn = clock_fn
|
|
35
|
+
|
|
29
36
|
|
|
30
37
|
def duration_str(duration):
|
|
31
38
|
"""Return a formatted string for a duration proto.
|
|
@@ -95,14 +102,14 @@ def timestamp_str(timestamp):
|
|
|
95
102
|
|
|
96
103
|
|
|
97
104
|
def sec_to_nsec(secs):
|
|
98
|
-
"""Convert time in seconds as from
|
|
105
|
+
"""Convert time in seconds as from _clock_source_fn() to a timestamp in nanoseconds.
|
|
99
106
|
|
|
100
107
|
Args:
|
|
101
108
|
secs: Time in seconds
|
|
102
109
|
Returns:
|
|
103
110
|
The time in nanoseconds, as an integer.
|
|
104
111
|
"""
|
|
105
|
-
return
|
|
112
|
+
return int(secs * NSEC_PER_SEC)
|
|
106
113
|
|
|
107
114
|
|
|
108
115
|
def nsec_to_sec(secs):
|
|
@@ -118,12 +125,12 @@ def nsec_to_sec(secs):
|
|
|
118
125
|
|
|
119
126
|
def now_nsec():
|
|
120
127
|
"""Returns nanoseconds from dawn of unix epoch until when this is called."""
|
|
121
|
-
return sec_to_nsec(
|
|
128
|
+
return sec_to_nsec(now_sec())
|
|
122
129
|
|
|
123
130
|
|
|
124
131
|
def now_sec():
|
|
125
132
|
"""Returns seconds from dawn of unix epoch until when this is called."""
|
|
126
|
-
return
|
|
133
|
+
return _clock_source_fn()
|
|
127
134
|
|
|
128
135
|
|
|
129
136
|
def set_timestamp_from_now(timestamp_proto):
|
|
@@ -221,7 +228,7 @@ def secs_to_hms(seconds):
|
|
|
221
228
|
|
|
222
229
|
|
|
223
230
|
def distance_str(meters):
|
|
224
|
-
"""Convert a distance in meters to
|
|
231
|
+
"""Convert a distance in meters to either xxx.xx m or xxx.xx km
|
|
225
232
|
|
|
226
233
|
Args:
|
|
227
234
|
meters (float/int): distance in meters
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bosdyn-core
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: Boston Dynamics API Core code and interfaces
|
|
5
5
|
Home-page: https://dev.bostondynamics.com/
|
|
6
6
|
Author: Boston Dynamics
|
|
@@ -15,7 +15,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Requires-Python: >=3.6
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: bosdyn-api (==
|
|
18
|
+
Requires-Dist: bosdyn-api (==4.0.1)
|
|
19
19
|
Requires-Dist: Deprecated (~=1.2.10)
|
|
20
20
|
|
|
21
21
|
<!--
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
bosdyn/__init__.py,sha256=CMQioQKK1NlMk3kZuY49b_Aw-JyvDeOtuqOCAul1I0s,330
|
|
2
|
+
bosdyn/deprecated.py,sha256=ND0eBVsxvEhosH1IN-IhQu5lCDO4_OXtWVUG53uutGI,1889
|
|
2
3
|
bosdyn/geometry.py,sha256=usWzbOUc_NgqtBdEZSnMklTO5CmxNAuiaGQjgp6ZY24,2384
|
|
3
|
-
bosdyn/util.py,sha256=
|
|
4
|
+
bosdyn/util.py,sha256=M29e8lFxGT2w5WxRAexYtmYkRRl0tBVzzDDqSMpeGDw,13218
|
|
4
5
|
bosdyn/bddf/__init__.py,sha256=m-3eQsJOfmkTN7h5g_hcPZOLcFocLAxbaQVHLM8NTYw,1828
|
|
5
6
|
bosdyn/bddf/base_data_reader.py,sha256=GXCkUni96550zIeRQ7CgBI6ToPMZimjQ-s3XEo3TlCE,7665
|
|
6
7
|
bosdyn/bddf/block_writer.py,sha256=OB5Qu6syp6TDD72mFxTBLsuYY7O_KNv53YrdZPS-qJw,3300
|
|
@@ -8,7 +9,7 @@ bosdyn/bddf/bosdyn.py,sha256=WZBouAEu9kQ5zXayv9S0wM7NeJMVaNoIQaXlk34LY-4,1439
|
|
|
8
9
|
bosdyn/bddf/common.py,sha256=sGi96F7e1-JuQo3KG7qTs-Uh3S61QL8jxNFTAYljhPk,2498
|
|
9
10
|
bosdyn/bddf/data_reader.py,sha256=jhDF_i2EZ7DZXQFXtRjnAsyuGgL4wjooI7nn0-ePTGg,4732
|
|
10
11
|
bosdyn/bddf/data_writer.py,sha256=c1576ZZ0XsCf0mhnZOuu41jUYSMK2xtDxD_j8rzanss,6464
|
|
11
|
-
bosdyn/bddf/file_indexer.py,sha256
|
|
12
|
+
bosdyn/bddf/file_indexer.py,sha256=NE-rxVHM_ILz_O48LBfxk24OId1I5HraZK-hW6UK7BM,8435
|
|
12
13
|
bosdyn/bddf/grpc_proto_reader.py,sha256=F7KXOD1IQdCsvaZA3YRiL2_mM7UCH6KRe0fs1xqG1lE,1527
|
|
13
14
|
bosdyn/bddf/grpc_reader.py,sha256=XenmqrlHCdvgerGYAYNmDNw4rhYuod-nJJEafVa2XgE,3446
|
|
14
15
|
bosdyn/bddf/grpc_service_reader.py,sha256=ZE8QNiL60xji5-eNTyJb8kl-k22zoRzORqcvJZszn0I,1412
|
|
@@ -20,7 +21,7 @@ bosdyn/bddf/protobuf_channel_reader.py,sha256=mf1VnVZe28CMoLLWQ0hs8HKGBeaCNYTAaV
|
|
|
20
21
|
bosdyn/bddf/protobuf_reader.py,sha256=nHY5hTJ7HVAvLmKu0jtkEvkxLuo5LX5nNH7T0ZTaZcE,1356
|
|
21
22
|
bosdyn/bddf/protobuf_series_writer.py,sha256=TnbBHwG-xxPnOLAbKqsC0ea_ULd-BW-FJylnyTg9J5Q,2361
|
|
22
23
|
bosdyn/bddf/stream_data_reader.py,sha256=RC_5wf_xfFMtvTeYXy0oaUbNup06uHc76SRwYYAMis8,4374
|
|
23
|
-
bosdyn_core-
|
|
24
|
-
bosdyn_core-
|
|
25
|
-
bosdyn_core-
|
|
26
|
-
bosdyn_core-
|
|
24
|
+
bosdyn_core-4.0.1.dist-info/METADATA,sha256=E1DGBXEPJrE2mpDiC4Iu-N0G2D-3w6azqrxMQqdugrA,1704
|
|
25
|
+
bosdyn_core-4.0.1.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
|
|
26
|
+
bosdyn_core-4.0.1.dist-info/top_level.txt,sha256=an2OWgx1ej2jFjmBjPWNQ68ZglvUfKhmXWW-WhTtDmA,7
|
|
27
|
+
bosdyn_core-4.0.1.dist-info/RECORD,,
|
|
File without changes
|