From 1a591a6ee59ad59b2107fe113fcbfd3cb30879aa Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 7 Mar 2009 19:40:18 +0000 Subject: Always use basestring instead of str with isinstance(). svn path=/main/trunk/; revision=12775 --- pym/_emerge/__init__.py | 2 +- pym/portage/cache/template.py | 2 +- pym/portage/mail.py | 2 +- pym/portage/process.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index f643cc3df..0b60e0fd2 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -9728,7 +9728,7 @@ class JobStatusDisplay(object): object.__setattr__(self, "_term_codes", term_codes) encoding = sys.getdefaultencoding() for k, v in self._term_codes.items(): - if not isinstance(v, str): + if not isinstance(v, basestring): self._term_codes[k] = v.decode(encoding, 'replace') def _init_term(self): diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py index 7fce8ef17..e78216338 100644 --- a/pym/portage/cache/template.py +++ b/pym/portage/cache/template.py @@ -169,7 +169,7 @@ class database(object): for key,match in match_dict.iteritems(): # XXX this sucks. try: - if isinstance(match, str): + if isinstance(match, basestring): restricts[key] = re.compile(match).match else: restricts[key] = re.compile(match[0],match[1]).match diff --git a/pym/portage/mail.py b/pym/portage/mail.py index cf6ebd134..72b411264 100644 --- a/pym/portage/mail.py +++ b/pym/portage/mail.py @@ -17,7 +17,7 @@ def create_message(sender, recipient, subject, body, attachments=None): for x in attachments: if isinstance(x, BaseMessage): mymessage.attach(x) - elif isinstance(x, str): + elif isinstance(x, basestring): mymessage.attach(TextMessage(x)) else: raise portage.exception.PortageException("Can't handle type of attachment: %s" % type(x)) diff --git a/pym/portage/process.py b/pym/portage/process.py index 7c0fb342f..6f449c3d6 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -175,7 +175,7 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, """ # mycommand is either a str or a list - if isinstance(mycommand, str): + if isinstance(mycommand, basestring): mycommand = mycommand.split() # If an absolute path to an executable file isn't given -- cgit v1.2.3-1-g7c22