@@ -351,7 +351,7 @@ def configure(self, config):
351
351
* capacity
352
352
* sequential
353
353
"""
354
- assert config ['name' ] == self . fullname
354
+ assert self . fullname . endswith ( config ['name' ])
355
355
self .capacity = config .get ('capacity' , None )
356
356
self .sequential = bool (config .get ('sequential' , False ))
357
357
if self .sequential and self .capacity != 1 :
@@ -556,7 +556,7 @@ def parse_simple_config(cls, config_string):
556
556
>>> pp(ChannelManager.parse_simple_config('root'))
557
557
[{'capacity': 1, 'name': 'root'}]
558
558
>>> pp(ChannelManager.parse_simple_config('sub:2'))
559
- [{'capacity': 2, 'name': 'root. sub'}]
559
+ [{'capacity': 2, 'name': 'sub'}]
560
560
"""
561
561
res = []
562
562
for channel_config_string in config_string .split (',' ):
@@ -566,8 +566,6 @@ def parse_simple_config(cls, config_string):
566
566
if not name :
567
567
raise ValueError ('Invalid channel config %s: '
568
568
'missing channel name' % config_string )
569
- if not name .startswith ('root.' ) and name != 'root' :
570
- name = 'root.' + name
571
569
config ['name' ] = name
572
570
if len (config_items ) > 1 :
573
571
capacity = config_items [1 ]
@@ -610,6 +608,8 @@ def simple_configure(self, config_string):
610
608
>>> cm.get_channel_by_name('root.autosub').capacity
611
609
>>> cm.get_channel_by_name('root.autosub.sub').capacity
612
610
2
611
+ >>> cm.get_channel_by_name('autosub.sub').capacity
612
+ 2
613
613
"""
614
614
for config in ChannelManager .parse_simple_config (config_string ):
615
615
self .get_channel_from_config (config )
@@ -676,9 +676,7 @@ def get_channel_by_name(self, channel_name, autocreate=False):
676
676
if not autocreate :
677
677
raise ChannelNotFound ('Channel %s not found' % channel_name )
678
678
parent = self ._root_channel
679
- for subchannel_name in channel_name .split ('.' ):
680
- if subchannel_name == 'root' :
681
- continue
679
+ for subchannel_name in channel_name .split ('.' )[1 :]:
682
680
subchannel = parent .get_subchannel_by_name (subchannel_name )
683
681
if not subchannel :
684
682
subchannel = Channel (subchannel_name , parent , capacity = None )
0 commit comments