[PATCH 7 of 7] py3: use raw strings while accessing class.__dict__
Pulkit Goyal
7895pulkit at gmail.com
Wed May 3 23:16:49 EDT 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1493322187 -19800
# Fri Apr 28 01:13:07 2017 +0530
# Node ID ff616356fbc6b17ed80ceaf81df3bca79fd5c6c5
# Parent ce1a68eb8ccfaccd9c0786f4c46eeba768f27f21
py3: use raw strings while accessing class.__dict__
The keys of class.__dict__ are unicodes on Python 3.
diff -r ce1a68eb8ccf -r ff616356fbc6 mercurial/context.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:
diff -r ce1a68eb8ccf -r ff616356fbc6 mercurial/smartset.py
--- 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):
More information about the Mercurial-devel
mailing list