py3: use raw strings while accessing class.__dict__
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 28 Apr 2017 01:13:07 +0530
changeset 32148 2cfdf5241096
parent 32147 a77e61b45384
child 32149 9a9d54ae9963
py3: use raw strings while accessing class.__dict__ The keys of class.__dict__ are unicodes on Python 3.
mercurial/context.py
mercurial/smartset.py
--- a/mercurial/context.py	Tue Apr 25 01:52:30 2017 +0530
+++ b/mercurial/context.py	Fri Apr 28 01:13:07 2017 +0530
@@ -257,13 +257,13 @@
         return changectx(self._repo, nullrev)
 
     def _fileinfo(self, path):
-        if '_manifest' in self.__dict__:
+        if r'_manifest' in self.__dict__:
             try:
                 return self._manifest[path], self._manifest.flags(path)
             except KeyError:
                 raise error.ManifestLookupError(self._node, path,
                                                 _('not found in manifest'))
-        if '_manifestdelta' in self.__dict__ or path in self.files():
+        if r'_manifestdelta' in self.__dict__ or path in self.files():
             if path in self._manifestdelta:
                 return (self._manifestdelta[path],
                         self._manifestdelta.flags(path))
@@ -697,11 +697,11 @@
 
     @propertycache
     def _changeid(self):
-        if '_changeid' in self.__dict__:
+        if r'_changeid' in self.__dict__:
             return self._changeid
-        elif '_changectx' in self.__dict__:
+        elif r'_changectx' in self.__dict__:
             return self._changectx.rev()
-        elif '_descendantrev' in self.__dict__:
+        elif r'_descendantrev' in self.__dict__:
             # this file context was created from a revision with a known
             # descendant, we can (lazily) correct for linkrev aliases
             return self._adjustlinkrev(self._descendantrev)
@@ -710,7 +710,7 @@
 
     @propertycache
     def _filenode(self):
-        if '_fileid' in self.__dict__:
+        if r'_fileid' in self.__dict__:
             return self._filelog.lookup(self._fileid)
         else:
             return self._changectx.filenode(self._path)
@@ -1396,7 +1396,7 @@
         return []
 
     def flags(self, path):
-        if '_manifest' in self.__dict__:
+        if r'_manifest' in self.__dict__:
             try:
                 return self._manifest.flags(path)
             except KeyError:
--- a/mercurial/smartset.py	Tue Apr 25 01:52:30 2017 +0530
+++ b/mercurial/smartset.py	Fri Apr 28 01:13:07 2017 +0530
@@ -245,7 +245,7 @@
     @util.propertycache
     def _list(self):
         # _list is only lazily constructed if we have _set
-        assert '_set' in self.__dict__
+        assert r'_set' in self.__dict__
         return list(self._set)
 
     def __iter__(self):