Esempio n. 1
0
 def medium_format(self):
     formats = []
     for medium in self._mbrelease["medium-list"]:
         format_ = medium.get("format", u"")
         if format_:
             formats.append(format_)
     formats = util.list_unique(formats)
     return u"/".join(formats)
Esempio n. 2
0
 def medium_format(self):
     formats = []
     for medium in self._mbrelease["medium-list"]:
         format_ = medium.get("format", u"")
         if format_:
             formats.append(format_)
     formats = util.list_unique(formats)
     return u"/".join(formats)
Esempio n. 3
0
def gd3_filter_entries(entries):
    # First, filter out empty strings...
    filtered = list(filter(None, entries))
    if len(filtered) == 0:
        return filtered

    # Then, filter out any duplicate strings...
    filtered = list_unique(filtered)
    return sorted(filtered)
Esempio n. 4
0
    def options(self, section):
        """Returns a list of options available in the specified section."""

        try:
            options = self._config.options(section)
        except NoSectionError:
            if self.defaults:
                return self.defaults.options(section)
            raise
        else:
            if self.defaults:
                try:
                    options.extend(self.defaults.options(section))
                    options = list_unique(options)
                except NoSectionError:
                    pass
            return options
Esempio n. 5
0
    def options(self, section):
        """Returns a list of options available in the specified section."""

        try:
            options = self._config.options(section)
        except NoSectionError:
            if self.defaults:
                return self.defaults.options(section)
            raise
        else:
            if self.defaults:
                try:
                    options.extend(self.defaults.options(section))
                    options = list_unique(options)
                except NoSectionError:
                    pass
            return options
Esempio n. 6
0
 def test_main(self):
     self.assertEqual(util.list_unique([]), [])
     self.assertEqual(util.list_unique(iter([])), [])
     self.assertEqual(util.list_unique([1, 2, 3]), [1, 2, 3])
     self.assertEqual(util.list_unique([1, 2, 1, 4]), [1, 2, 4])
     self.assertEqual(util.list_unique([1, 1, 1, 2]), [1, 2])
Esempio n. 7
0
 def __init__(self, func, list_func, tags):
     self.__func = func
     self.__list_func = list_func
     self.tags = util.list_unique(tags)
     self.format(self.Dummy())  # Validate string
Esempio n. 8
0
 def test_main(self):
     self.assertEqual(util.list_unique([]), [])
     self.assertEqual(util.list_unique(iter([])), [])
     self.assertEqual(util.list_unique([1, 2, 3]), [1, 2, 3])
     self.assertEqual(util.list_unique([1, 2, 1, 4]), [1, 2, 4])
     self.assertEqual(util.list_unique([1, 1, 1, 2]), [1, 2])
Esempio n. 9
0
 def __init__(self, func, list_func, tags):
     self.__func = func
     self.__list_func = list_func
     self.tags = util.list_unique(tags)
     self.format(self.Dummy())  # Validate string