Skip to content

Commit

Permalink
Upgrade from python 2 to 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Mar 13, 2023
1 parent 7bcfc3b commit 5d1c590
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 71 deletions.
2 changes: 1 addition & 1 deletion commonlib
Submodule commonlib updated from 599c81 to 57a3dc
8 changes: 4 additions & 4 deletions scripts/future-fetch.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/python
#!/usr/bin/env python3
# encoding: utf-8

import json
import os
import sys
import re
import urllib2
import urllib.request
import MySQLdb

import datetime
Expand All @@ -32,7 +32,7 @@

def fetch_url(date):
data = CALENDAR_BASE % {'date': date}
data = urllib2.urlopen(data)
data = urllib.request.urlopen(data)
data = json.load(data)
return data

Expand Down Expand Up @@ -272,7 +272,7 @@ def update(self):
if old_tuple != new_tuple:
new_entry.update()

old_entries.discard((long(id),))
old_entries.discard((int(id),))
else:
new_entry.add()

Expand Down
10 changes: 5 additions & 5 deletions scripts/photo-attribution-import.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# encoding: utf-8

import json
Expand Down Expand Up @@ -31,13 +31,13 @@
)
db_cursor = db_connection.cursor()

data_blank = filter(lambda r: not r["data_value"], data)
data_blank = map(lambda r: (r["person_id"], r["data_key"]), data_blank)
data_blank = [r for r in data if not r["data_value"]]
data_blank = [(r["person_id"], r["data_key"]) for r in data_blank]
db_cursor.executemany("""DELETE FROM personinfo
WHERE person_id=%s AND data_key=%s""", data_blank)

data = filter(lambda r: r["data_value"], data)
data = map(lambda r: (r["person_id"], r["data_key"], r["data_value"]), data)
data = [r for r in data if r["data_value"]]
data = [(r["person_id"], r["data_key"], r["data_value"]) for r in data]
db_cursor.executemany("""INSERT INTO personinfo
(person_id, data_key, data_value) VALUES (%s, %s, %s)
ON DUPLICATE KEY UPDATE data_value = VALUES(data_value)""", data)
Expand Down
61 changes: 0 additions & 61 deletions scripts/wikipedia-backlinks.py

This file was deleted.

0 comments on commit 5d1c590

Please sign in to comment.