本文整理汇总了Python中mutagen._util.dict_match函数的典型用法代码示例。如果您正苦于以下问题:Python dict_match函数的具体用法?Python dict_match怎么用?Python dict_match使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dict_match函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __delitem__
def __delitem__(self, key):
key = key.lower()
func = dict_match(self.Delete, key, self.DeleteFallback)
if func is not None:
return func(self.__id3, key)
else:
raise EasyID3KeyError("%r is not a valid key" % key)
示例2: __delitem__
def __delitem__(self, key):
key = key.lower()
func = dict_match(self.Delete, key)
if func is not None:
return func(self.__mp4, key)
else:
raise EasyMP4KeyError("%r is not a valid key" % key)
示例3: __setitem__
def __setitem__(self, key, value):
key = key.lower()
if isinstance(value, basestring):
value = [value]
func = dict_match(self.Set, key, self.SetFallback)
if func is not None:
return func(self.__id3, key, value)
else:
raise EasyID3KeyError("%r is not a valid key" % key)
示例4: __setitem__
def __setitem__(self, key, value):
key = key.lower()
if isinstance(value, (str, bytes)):
value = [value]
func = dict_match(self.Set, key)
if func is not None:
return func(self.__mp4, key, value)
else:
raise EasyMP4KeyError("%r is not a valid key" % key)
示例5: __setitem__
def __setitem__(self, key, value):
key = key.lower()
if PY2:
if isinstance(value, basestring):
value = [value]
else:
if isinstance(value, text_type):
value = [value]
func = dict_match(self.Set, key)
if func is not None:
return func(self.__mp4, key, value)
else:
raise EasyMP4KeyError("%r is not a valid key" % key)
示例6: test_nomatch
def test_nomatch(self):
self.assertEqual(dict_match({"*a": 1}, "ab"), None)
self.assertEqual(dict_match({"??": 1}, "a"), None)
self.assertEqual(dict_match({"[ab]": 1}, "c"), None)
self.assertEqual(dict_match({"[ab]": 1}, "[ab]"), None)
示例7: test_match
def test_match(self):
self.assertEqual(dict_match({"*": 1}, "a"), 1)
self.assertEqual(dict_match({"*": 1}, "*"), 1)
self.assertEqual(dict_match({"*a": 1}, "ba"), 1)
self.assertEqual(dict_match({"?": 1}, "b"), 1)
self.assertEqual(dict_match({"[ab]": 1}, "b"), 1)