Skip to content

Commit

Permalink
Advance deprecation cycle for MDB aliases/aliases_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
fqqb committed Aug 20, 2024
1 parent 36e8dcc commit 8e58b09
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
33 changes: 10 additions & 23 deletions yamcs-client/src/yamcs/mdb/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,19 @@ def qualified_name(self) -> str:
return self._proto.qualifiedName

@property
def aliases(self) -> List[Tuple[str, str]]:
"""
List of (namespace, name) pairs, as 2-tuples
.. deprecated:: 1.9.2
Use :attr:`aliases_dict` instead, which returns a dictionary instead of
a list of 2-tuples.
In a future release, the ``aliases`` property will be changed to match the
return type of :attr:`aliases_dict`.
"""
warnings.warn(
"Use 'aliases_dict' instead of 'aliases'. This returns "
"a dictionary instead of a list of 2-tuples. In a future release, "
"the 'aliases' property will be changed to match the return type "
"of 'aliases_dict'.",
category=FutureWarning,
)
return list(
{alias.namespace: alias.name for alias in self._proto.alias}.items()
)
def aliases(self) -> Dict[str, str]:
"""Aliases, keyed by namespace"""
return {alias.namespace: alias.name for alias in self._proto.alias}

@property
def aliases_dict(self) -> Dict[str, str]:
"""Aliases, keyed by namespace"""
return {alias.namespace: alias.name for alias in self._proto.alias}
"""
Aliases, keyed by namespace
This method shall be deprecated in a future release. Use
:attr:`aliases` instead.
"""
return self.aliases

@property
def description(self) -> Optional[str]:
Expand Down
1 change: 0 additions & 1 deletion yamcs-client/src/yamcs/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from yamcs.core.helpers import parse_server_time
from yamcs.protobuf.events import events_pb2
from yamcs.protobuf.instances import instances_pb2
from yamcs.protobuf.links import links_pb2
from yamcs.protobuf.services import services_pb2


Expand Down
2 changes: 1 addition & 1 deletion yamcs-client/src/yamcs/storage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def create_bucket(self, bucket_name: str):
"""
req = buckets_pb2.CreateBucketRequest()
req.name = bucket_name
url = f"/storage/buckets"
url = "/storage/buckets"
self.ctx.post_proto(url, data=req.SerializeToString())

def remove_bucket(self, bucket_name: str):
Expand Down

0 comments on commit 8e58b09

Please sign in to comment.