def list_all_interfaces(self): """List all interfaces in the cache. @rtype: [str] """ all = set() for d in basedir.load_cache_paths(config_site, 'interfaces'): for leaf in os.listdir(d): if not leaf.startswith('.'): all.add(unescape(leaf)) for d in basedir.load_config_paths(config_site, config_prog, 'user_overrides'): for leaf in os.listdir(d): if not leaf.startswith('.'): all.add(unescape(leaf)) return list(all) # Why not just return the set?
def testUnescape(self): self.assertEqual("", model.unescape("")) self.assertEqual("hello", model.unescape("hello")) self.assertEqual(" ", model.unescape("%20")) self.assertEqual("file://foo~bar", model.unescape("file%3a%2f%2ffoo%7ebar")) self.assertEqual("file://foo%bar", model.unescape("file%3a%2f%2ffoo%25bar")) self.assertEqual("file://foo", model.unescape("file:##foo")) self.assertEqual("file://foo~bar", model.unescape("file:##foo%7ebar")) self.assertEqual("file://foo%bar", model.unescape("file:##foo%25bar"))
def check(str): self.assertEqual(str, model.unescape(model.escape(str))) self.assertEqual(str, model.unescape(model._pretty_escape(str))) self.assertEqual(str, escaping.ununderscore_escape(escaping.underscore_escape(str)))
def check(str): self.assertEqual(str, model.unescape(model.escape(str))) self.assertEqual(str, model.unescape(model._pretty_escape(str)))