Ejemplo n.º 1
0
 def get_commands(self, group=None):
     if group in self.commands_by_group:
         return self.commands_by_group[group]
     else:
         commands = []
         for g in self.get_command_groups():
             for cmd in self.commands_by_group[g]:
                 commands.append(utils.combine_name(g, cmd))
         return commands
Ejemplo n.º 2
0
 def get_plans(self, group=None):
     if group in self.plans_by_group:
         return self.plans_by_group[group]
     else:
         plans = []
         for g in self.get_plan_groups():
             for p in self.plans_by_group[g]:
                 plans.append(utils.combine_name(g, utils.strip_ext(p)))
         return plans
Ejemplo n.º 3
0
    def _expand_plans(self, plans):
        expanded_plans = []
        if not plans or len(plans) == 0 or (len(plans) == 1
                                            and plans[0] is ''):
            return expanded_plans

        for p in plans:
            plan_qname = QualifierName.from_string(p)
            if plan_qname.full:
                expanded_plans.append(p)
            else:
                to_ext = []
                for pname in self.ctx.get_plans(plan_qname.name):
                    to_ext.append(combine_name(plan_qname.name, pname))
                expanded_plans.extend(to_ext)
        return expanded_plans
Ejemplo n.º 4
0
 def qualifier(self):
     return combine_name(self.group, self.name)
Ejemplo n.º 5
0
def test_combine_name():
    assert utils.combine_name('foo', 'bar') == 'foo.bar'