Jean-Frédéric has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390969 )

Change subject: [WIP] Fix unsafe operation on str that should use unicode
......................................................................

[WIP] Fix unsafe operation on str that should use unicode

As detected by flake8 extension `unicode-string-literal`.
https://github.com/cogniteev/flake8-unicode-string-literal

Change-Id: I2cebd0dfae63ce0022013ee9b010ccc4e4a540d9
---
M erfgoedbot/categorize_images.py
M erfgoedbot/monument_tables.py
M tox.ini
3 files changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage 
refs/changes/69/390969/1

diff --git a/erfgoedbot/categorize_images.py b/erfgoedbot/categorize_images.py
index f7c61e0..b20a754 100644
--- a/erfgoedbot/categorize_images.py
+++ b/erfgoedbot/categorize_images.py
@@ -531,7 +531,7 @@
             total_images = '---'
 
         if row.get('cat'):
-            cat_link = '[[:Category:{0}]]'.format(row['cat'])
+            cat_link = u'[[:Category:{0}]]'.format(row['cat'])
             pages_in_cat = '{{PAGESINCATEGORY:%s|files}}' % row['cat']
 
         if row.get('template'):
@@ -586,7 +586,7 @@
 def skip(country_code, lang, country_config):
     """Return a outputStatistics compatible summary for a skipped country."""
     site = pywikibot.Site(u'commons', u'commons')
-    commons_category_base = pywikibot.Category(site, "{ns}:{cat}".format(
+    commons_category_base = pywikibot.Category(site, u"{ns}:{cat}".format(
         ns=site.namespace(14), cat=country_config.get('commonsCategoryBase')))
     commons_template = country_config.get('commonsTemplate')
     return {
diff --git a/erfgoedbot/monument_tables.py b/erfgoedbot/monument_tables.py
index a6fd148..940bdca 100755
--- a/erfgoedbot/monument_tables.py
+++ b/erfgoedbot/monument_tables.py
@@ -28,11 +28,11 @@
             sql = process_classic_config(country_config)
     except Exception as e:
         raise Exception(
-            '{exception} for countrycode: {country}, lang: {lang}'.format(
+            u'{exception} for countrycode: {country}, lang: {lang}'.format(
                 exception=e, country=country_code, lang=lang))
 
     f = open(os.path.join(
-        get_sql_dir(), 'create_table_{}.sql'.format(table)), 'w')
+        get_sql_dir(), u'create_table_{}.sql'.format(table)), 'w')
     f.write(sql)
     f.close()
 
@@ -70,7 +70,7 @@
                     typ += ' NOT NULL DEFAULT 0'
             elif typ.startswith("varchar("):
                 if field.get('default'):
-                    typ += " NOT NULL DEFAULT '{}'".format(
+                    typ += u" NOT NULL DEFAULT '{}'".format(
                         field.get('default'))
                 else:
                     typ += " NOT NULL DEFAULT ''"
diff --git a/tox.ini b/tox.ini
index 2aa74a9..81c9cf6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -12,7 +12,9 @@
     bash
 
 [testenv:flake8]
-deps = flake8==3.2.1
+deps =
+  flake8==3.2.1
+  unicode-string-literal==1.1
 commands = flake8
 
 [testenv:bashate]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cebd0dfae63ce0022013ee9b010ccc4e4a540d9
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Jean-Frédéric <jeanfrederic.w...@gmail.com>

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

Reply via email to