From e8a6623d2b586e2f8a22c8f984536883ec99071b Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sun, 25 Jul 2021 18:53:42 +0200 Subject: [PATCH] renamed parse_channel_list_file -> load_channels; deprecated slic.utils.channels.Channels --- slic/core/acquisition/channels.py | 4 ++-- slic/utils/channels.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/slic/core/acquisition/channels.py b/slic/core/acquisition/channels.py index 7d1b3367e..8f8de5e33 100644 --- a/slic/core/acquisition/channels.py +++ b/slic/core/acquisition/channels.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod from collections import namedtuple from slic.utils.printing import format_header, itemize -from slic.utils.channels import parse_channel_list_file +from slic.utils.channels import load_channels import colorama @@ -21,7 +21,7 @@ class Channels(list, ABC): @classmethod def from_file(cls, fname): - channels = parse_channel_list_file(fname) + channels = load_channels(fname) return cls(*channels) def __repr__(self): diff --git a/slic/utils/channels.py b/slic/utils/channels.py index d9964a1ae..303c89ca1 100644 --- a/slic/utils/channels.py +++ b/slic/utils/channels.py @@ -1,5 +1,7 @@ +import warnings -def parse_channel_list_file(fname): + +def load_channels(fname): out = set() with open(fname, "r") as f: for line in f: @@ -11,10 +13,18 @@ def parse_channel_list_file(fname): return sorted(out) + +message = """\ +The class slic.utils.Channels is deprecated. +Please use, whichever appropriate, slic.core.acquisition.BSChannel, slic.core.acquisition.PVChannel or slic.utils.load_channels instead. +""" + + class Channels(list): def __init__(self, fname): - chs = parse_channel_list_file(fname) + warnings.warn(message, DeprecationWarning, stacklevel=2) + chs = load_channels(fname) self.extend(chs)