mopidy/tests/__init__.py
Stein Magnus Jodal 77128e4b68 flake8: Fix new warnings after flake8 upgrade
(cherry picked from commit a693993905)

Conflicts:
	mopidy/audio/actor.py
	mopidy/audio/playlists.py
2015-02-12 23:14:17 +01:00

35 lines
743 B
Python

from __future__ import unicode_literals
import os
def path_to_data_dir(name):
if not isinstance(name, bytes):
name = name.encode('utf-8')
path = os.path.dirname(__file__)
path = os.path.join(path, b'data')
path = os.path.abspath(path)
return os.path.join(path, name)
class IsA(object):
def __init__(self, klass):
self.klass = klass
def __eq__(self, rhs):
try:
return isinstance(rhs, self.klass)
except TypeError:
return type(rhs) == type(self.klass) # flake8: noqa
def __ne__(self, rhs):
return not self.__eq__(rhs)
def __repr__(self):
return str(self.klass)
any_int = IsA(int)
any_str = IsA(str)
any_unicode = IsA(unicode)