changeset 8010:b0c75d6f8f32

py3: use explicit octal literals From 2to3 numliterals.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 23 Nov 2019 22:17:54 +0100
parents a58320dc50a9
children 4fcf63512b77
files kallithea/lib/vcs/backends/hg/changeset.py kallithea/lib/vcs/nodes.py kallithea/model/scm.py kallithea/tests/vcs/test_git.py kallithea/tests/vcs/test_nodes.py
diffstat 5 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/changeset.py	Mon Nov 25 03:23:42 2019 +0100
+++ b/kallithea/lib/vcs/backends/hg/changeset.py	Sat Nov 23 22:17:54 2019 +0100
@@ -246,9 +246,9 @@
         """
         fctx = self._get_filectx(path)
         if 'x' in fctx.flags():
-            return 0100755
+            return 0o100755
         else:
-            return 0100644
+            return 0o100644
 
     def get_file_content(self, path):
         """
--- a/kallithea/lib/vcs/nodes.py	Mon Nov 25 03:23:42 2019 +0100
+++ b/kallithea/lib/vcs/nodes.py	Sat Nov 23 22:17:54 2019 +0100
@@ -255,7 +255,7 @@
         super(FileNode, self).__init__(path, kind=NodeKind.FILE)
         self.changeset = changeset
         self._content = content
-        self._mode = mode or 0100644
+        self._mode = mode or 0o100644
 
     @LazyProperty
     def mode(self):
--- a/kallithea/model/scm.py	Mon Nov 25 03:23:42 2019 +0100
+++ b/kallithea/model/scm.py	Sat Nov 23 22:17:54 2019 +0100
@@ -750,7 +750,7 @@
                     with open(_hook_file, 'wb') as f:
                         tmpl = tmpl.replace('_TMPL_', kallithea.__version__)
                         f.write(tmpl)
-                    os.chmod(_hook_file, 0755)
+                    os.chmod(_hook_file, 0o755)
                 except IOError as e:
                     log.error('error writing %s: %s', _hook_file, e)
             else:
--- a/kallithea/tests/vcs/test_git.py	Mon Nov 25 03:23:42 2019 +0100
+++ b/kallithea/tests/vcs/test_git.py	Sat Nov 23 22:17:54 2019 +0100
@@ -657,7 +657,7 @@
                 'added': [
                     FileNode('foobar/static/js/admin/base.js', content='base'),
                     FileNode('foobar/static/admin', content='admin',
-                        mode=0120000), # this is a link
+                        mode=0o120000), # this is a link
                     FileNode('foo', content='foo'),
                 ],
             },
--- a/kallithea/tests/vcs/test_nodes.py	Mon Nov 25 03:23:42 2019 +0100
+++ b/kallithea/tests/vcs/test_nodes.py	Sat Nov 23 22:17:54 2019 +0100
@@ -144,13 +144,13 @@
         assert not mode & stat.S_IXOTH
 
     def test_file_node_is_executable(self):
-        node = FileNode('foobar', 'empty... almost', mode=0100755)
+        node = FileNode('foobar', 'empty... almost', mode=0o100755)
         assert node.is_executable
 
-        node = FileNode('foobar', 'empty... almost', mode=0100500)
+        node = FileNode('foobar', 'empty... almost', mode=0o100500)
         assert node.is_executable
 
-        node = FileNode('foobar', 'empty... almost', mode=0100644)
+        node = FileNode('foobar', 'empty... almost', mode=0o100644)
         assert not node.is_executable
 
     def test_mimetype(self):