From 7a1ca51c4951a249baae64d194aa66035c2d7c03 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Mon, 30 May 2016 03:17:28 -0400 Subject: [PATCH] remove b' from platform checks --- beets/ui/__init__.py | 2 +- beets/util/__init__.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index a75036c33..291f93208 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -43,7 +43,7 @@ from beets.autotag import mb from beets.dbcore import query as db_query # On Windows platforms, use colorama to support "ANSI" terminal colors. -if sys.platform == b'win32': +if sys.platform == 'win32': try: import colorama except ImportError: diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 327b312fa..2e4c4de15 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -303,13 +303,13 @@ def _fsencoding(): UTF-8 (not MBCS). """ encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() - if encoding == b'mbcs': + if encoding == 'mbcs': # On Windows, a broken encoding known to Python as "MBCS" is # used for the filesystem. However, we only use the Unicode API # for Windows paths, so the encoding is actually immaterial so # we can avoid dealing with this nastiness. We arbitrarily # choose UTF-8. - encoding = b'utf8' + encoding = 'utf8' return encoding @@ -324,7 +324,7 @@ def bytestring_path(path): # On Windows, remove the magic prefix added by `syspath`. This makes # ``bytestring_path(syspath(X)) == X``, i.e., we can safely # round-trip through `syspath`. - if os.path.__name__ == b'ntpath' and path.startswith(WINDOWS_MAGIC_PREFIX): + if os.path.__name__ == 'ntpath' and path.startswith(WINDOWS_MAGIC_PREFIX): path = path[len(WINDOWS_MAGIC_PREFIX):] # Try to encode with default encodings, but fall back to UTF8. @@ -361,7 +361,7 @@ def syspath(path, prefix=True): *really* know what you're doing. """ # Don't do anything if we're not on windows - if os.path.__name__ != b'ntpath': + if os.path.__name__ != 'ntpath': return path if not isinstance(path, unicode): @@ -654,19 +654,19 @@ def cpu_count(): """ # Adapted from the soundconverter project: # https://github.com/kassoulet/soundconverter - if sys.platform == b'win32': + if sys.platform == 'win32': try: num = int(os.environ['NUMBER_OF_PROCESSORS']) except (ValueError, KeyError): num = 0 - elif sys.platform == b'darwin': + elif sys.platform == 'darwin': try: num = int(command_output([b'/usr/sbin/sysctl', b'-n', b'hw.ncpu'])) except (ValueError, OSError, subprocess.CalledProcessError): num = 0 else: try: - num = os.sysconf(b'SC_NPROCESSORS_ONLN') + num = os.sysconf('SC_NPROCESSORS_ONLN') except (ValueError, OSError, AttributeError): num = 0 if num >= 1: @@ -693,7 +693,7 @@ def command_output(cmd, shell=False): cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - close_fds=platform.system() != b'Windows', + close_fds=platform.system() != 'Windows', shell=shell ) stdout, stderr = proc.communicate()