コード例 #1
0
 def test_is_legal_name(self):
     from roslib.names import is_legal_name
     failures = [
         None, 'foo++', 'foo-bar', '#foo', 'hello\n', '\t', ' name',
         'name ', 'f//b', '1name', 'foo\\'
     ]
     for f in failures:
         self.failIf(is_legal_name(f), f)
     tests = [
         '', 'f', 'f1', 'f_', 'f/', 'foo', 'foo_bar', 'foo/bar',
         'foo/bar/baz', '~f', '~a/b/c', '~/f', '/a/b/c/d', '/'
     ]
     for t in tests:
         self.assert_(is_legal_name(t), "[%s]" % t)
コード例 #2
0
ファイル: test_roslib_names.py プロジェクト: lubosz/rosstacks
 def test_is_legal_name(self):
   from roslib.names import is_legal_name
   failures = [None,
               'foo++', 'foo-bar', '#foo',
               'hello\n', '\t', ' name', 'name ',
               'f//b',
               '1name', 'foo\\']
   for f in failures:
     self.failIf(is_legal_name(f), f)
   tests = ['',
            'f', 'f1', 'f_', 'f/', 'foo', 'foo_bar', 'foo/bar', 'foo/bar/baz',
            '~f', '~a/b/c',
            '~/f',
            '/a/b/c/d', '/']
   for t in tests:
     self.assert_(is_legal_name(t), "[%s]"%t)
コード例 #3
0
ファイル: loader.py プロジェクト: spaghetti-/rosh_core
    def add_remap(self, remap):
        """
        Add a new remap setting to the context. if a remap already
        exists with the same from key, it will be removed
        
        @param remap: remap setting
        @type  remap: (str, str)
        """
        remap = [canonicalize_name(x) for x in remap]
        if not remap[0] or not remap[1]:
            raise RLException("remap from/to attributes cannot be empty")
        if not is_legal_name(remap[0]):
            raise RLException("remap from [%s] is not a valid ROS name" % remap[0])
        if not is_legal_name(remap[1]):
            raise RLException("remap to [%s] is not a valid ROS name" % remap[1])

        matches = [r for r in self._remap_args if r[0] == remap[0]]
        for m in matches:
            self._remap_args.remove(m)
        self._remap_args.append(remap)
コード例 #4
0
ファイル: loader.py プロジェクト: lucasw/ros_comm-1
 def add_remap(self, remap):
     """
     Add a new remap setting to the context. if a remap already
     exists with the same from key, it will be removed
     
     @param remap: remap setting
     @type  remap: (str, str)
     """
     remap = [canonicalize_name(x) for x in remap]
     if not remap[0] or not remap[1]:
         raise RLException("remap from/to attributes cannot be empty")
     if not is_legal_name(remap[0]):
         raise RLException("remap from [%s] is not a valid ROS name"%remap[0])
     if not is_legal_name(remap[1]):
         raise RLException("remap to [%s] is not a valid ROS name"%remap[1])
     
     matches = [r for r in self._remap_args if r[0] == remap[0]]
     for m in matches:
         self._remap_args.remove(m)
     self._remap_args.append(remap)