renamed parse_channel_list_file -> load_channels; deprecated slic.utils.channels.Channels
This commit is contained in:
@@ -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):
|
||||
|
||||
+12
-2
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user