Rev 5319: Don't use python builtins as variable names. in file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Jun 25 14:23:34 BST 2010


At file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

------------------------------------------------------------
revno: 5319
revision-id: v.ladeuil+lp at free.fr-20100625132334-ruz24bfb9t3drcqb
parent: pqm at pqm.ubuntu.com-20100624111149-o3crzmivr896yafb
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 525571-lock-bazaar-conf-files
timestamp: Fri 2010-06-25 15:23:34 +0200
message:
  Don't use python builtins as variable names.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2010-06-02 04:50:35 +0000
+++ b/bzrlib/config.py	2010-06-25 13:23:34 +0000
@@ -356,15 +356,15 @@
         self._get_filename = get_filename
         self._parser = None
 
-    def _get_parser(self, file=None):
+    def _get_parser(self, infile=None):
         if self._parser is not None:
             return self._parser
-        if file is None:
-            input = self._get_filename()
+        if infile is None:
+            fname_or_content = self._get_filename()
         else:
-            input = file
+            fname_or_content = infile
         try:
-            self._parser = ConfigObj(input, encoding='utf-8')
+            self._parser = ConfigObj(fname_or_content, encoding='utf-8')
         except configobj.ConfigObjError, e:
             raise errors.ParseConfigError(e.errors, e.config.filename)
         return self._parser

=== modified file 'bzrlib/tests/test_commands.py'
--- a/bzrlib/tests/test_commands.py	2010-05-27 21:16:48 +0000
+++ b/bzrlib/tests/test_commands.py	2010-06-25 13:23:34 +0000
@@ -97,7 +97,7 @@
     def _get_config(self, config_text):
         my_config = config.GlobalConfig()
         config_file = StringIO(config_text.encode('utf-8'))
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         return my_config
 
     def test_simple(self):

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2010-04-23 07:15:23 +0000
+++ b/bzrlib/tests/test_config.py	2010-06-25 13:23:34 +0000
@@ -371,7 +371,7 @@
 
     def make_config_parser(self, s):
         conf = config.IniBasedConfig(None)
-        parser = conf._get_parser(file=StringIO(s.encode('utf-8')))
+        parser = conf._get_parser(infile=StringIO(s.encode('utf-8')))
         return conf, parser
 
 
@@ -384,13 +384,13 @@
         config_file = StringIO(sample_config_text.encode('utf-8'))
         my_config = config.IniBasedConfig(None)
         self.failUnless(
-            isinstance(my_config._get_parser(file=config_file),
+            isinstance(my_config._get_parser(infile=config_file),
                         configobj.ConfigObj))
 
     def test_cached(self):
         config_file = StringIO(sample_config_text.encode('utf-8'))
         my_config = config.IniBasedConfig(None)
-        parser = my_config._get_parser(file=config_file)
+        parser = my_config._get_parser(infile=config_file)
         self.failUnless(my_config._get_parser() is parser)
 
 
@@ -583,26 +583,26 @@
     def test_user_id(self):
         config_file = StringIO(sample_config_text.encode('utf-8'))
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         self.assertEqual(u"Erik B\u00e5gfors <erik at bagfors.nu>",
                          my_config._get_user_id())
 
     def test_absent_user_id(self):
         config_file = StringIO("")
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         self.assertEqual(None, my_config._get_user_id())
 
     def test_configured_editor(self):
         config_file = StringIO(sample_config_text.encode('utf-8'))
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         self.assertEqual("vim", my_config.get_editor())
 
     def test_signatures_always(self):
         config_file = StringIO(sample_always_signatures)
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         self.assertEqual(config.CHECK_NEVER,
                          my_config.signature_checking())
         self.assertEqual(config.SIGN_ALWAYS,
@@ -612,7 +612,7 @@
     def test_signatures_if_possible(self):
         config_file = StringIO(sample_maybe_signatures)
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         self.assertEqual(config.CHECK_NEVER,
                          my_config.signature_checking())
         self.assertEqual(config.SIGN_WHEN_REQUIRED,
@@ -622,7 +622,7 @@
     def test_signatures_ignore(self):
         config_file = StringIO(sample_ignore_signatures)
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         self.assertEqual(config.CHECK_ALWAYS,
                          my_config.signature_checking())
         self.assertEqual(config.SIGN_NEVER,
@@ -632,7 +632,7 @@
     def _get_sample_config(self):
         config_file = StringIO(sample_config_text.encode('utf-8'))
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         return my_config
 
     def test_gpg_signing_command(self):
@@ -643,7 +643,7 @@
     def _get_empty_config(self):
         config_file = StringIO("")
         my_config = config.GlobalConfig()
-        my_config._parser = my_config._get_parser(file=config_file)
+        my_config._parser = my_config._get_parser(infile=config_file)
         return my_config
 
     def test_gpg_signing_command_unset(self):



More information about the bazaar-commits mailing list