[MediaWiki-commits] [Gerrit] [IMPROV] Fix the summary line in generate_user_files for use... - change (pywikibot/compat)

2015-05-14 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: [IMPROV] Fix the summary line in generate_user_files for 
user-fixes.py
..


[IMPROV] Fix the summary line in generate_user_files for user-fixes.py

Also update some doc strings and code parts from core.

Change-Id: Iac59759cbd08ff373879db0cddc3a333c5e4d9d2
---
M generate_user_files.py
1 file changed, 8 insertions(+), 7 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/generate_user_files.py b/generate_user_files.py
index d51f0fa..741f9fd 100644
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -1,9 +1,9 @@
 # -*- coding: utf-8  -*-
- Script to create user files (user-config.py, user-fixes.py) 
+Script to create user files (user-config.py, user-fixes.py).
 #
-# (C) Pywikibot team, 2008-2013
+# (C) Pywikibot team, 2008-2015
 #
-# Distributed under the terms of the MIT license
+# Distributed under the terms of the MIT license.
 #
 __version__ = '$Id$'
 #
@@ -54,6 +54,7 @@
 
 
 def file_exists(filename):
+Return whether the file exists and print a message if it exists.
 if os.path.exists(filename):
 print('%s' already exists. % filename)
 return True
@@ -149,10 +150,11 @@
 
 
 def create_user_fixes(base_dir):
+Create a basic user-fixes.py in base_dir.
 _fnf = os.path.join(base_dir, user-fixes.py)
 if not file_exists(_fnf):
-f = codecs.open(_fnf, w, utf-8)
-f.write(r# -*- coding: utf-8  -*-
+with codecs.open(_fnf, w, utf-8) as f:
+f.write(r# -*- coding: utf-8  -*-
 
 #
 # This is only an example. Don't use it.
@@ -161,7 +163,7 @@
 fixes['example'] = {
 'regex': True,
 'msg': {
-'_default':u'no summary specified',
+'_default': u'no summary specified',
 },
 'replacements': [
 (ur'\bword\b', u'two words'),
@@ -169,7 +171,6 @@
 }
 
 )
-f.close()
 print('%s' written. % _fnf)
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/210866
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac59759cbd08ff373879db0cddc3a333c5e4d9d2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt i...@gno.de
Gerrit-Reviewer: John Vandenberg jay...@gmail.com
Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPROV] Fix the summary line in generate_user_files for use... - change (pywikibot/compat)

2015-05-14 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/210866

Change subject: [IMPROV] Fix the summary line in generate_user_files for 
user-fixes.py
..

[IMPROV] Fix the summary line in generate_user_files for user-fixes.py

Also update some doc strings and code parts from core.

Change-Id: Iac59759cbd08ff373879db0cddc3a333c5e4d9d2
---
M generate_user_files.py
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/66/210866/1

diff --git a/generate_user_files.py b/generate_user_files.py
index d51f0fa..741f9fd 100644
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -1,9 +1,9 @@
 # -*- coding: utf-8  -*-
- Script to create user files (user-config.py, user-fixes.py) 
+Script to create user files (user-config.py, user-fixes.py).
 #
-# (C) Pywikibot team, 2008-2013
+# (C) Pywikibot team, 2008-2015
 #
-# Distributed under the terms of the MIT license
+# Distributed under the terms of the MIT license.
 #
 __version__ = '$Id$'
 #
@@ -54,6 +54,7 @@
 
 
 def file_exists(filename):
+Return whether the file exists and print a message if it exists.
 if os.path.exists(filename):
 print('%s' already exists. % filename)
 return True
@@ -149,10 +150,11 @@
 
 
 def create_user_fixes(base_dir):
+Create a basic user-fixes.py in base_dir.
 _fnf = os.path.join(base_dir, user-fixes.py)
 if not file_exists(_fnf):
-f = codecs.open(_fnf, w, utf-8)
-f.write(r# -*- coding: utf-8  -*-
+with codecs.open(_fnf, w, utf-8) as f:
+f.write(r# -*- coding: utf-8  -*-
 
 #
 # This is only an example. Don't use it.
@@ -161,7 +163,7 @@
 fixes['example'] = {
 'regex': True,
 'msg': {
-'_default':u'no summary specified',
+'_default': u'no summary specified',
 },
 'replacements': [
 (ur'\bword\b', u'two words'),
@@ -169,7 +171,6 @@
 }
 
 )
-f.close()
 print('%s' written. % _fnf)
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/210866
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac59759cbd08ff373879db0cddc3a333c5e4d9d2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt i...@gno.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits