mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Errors fetch scripts ported to Python 3
This commit is contained in:
parent
195b254937
commit
58c6a07e43
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
"""Generate the errorcodes module starting from PostgreSQL documentation.
|
"""Generate the errorcodes module starting from PostgreSQL documentation.
|
||||||
|
|
||||||
The script can be run at a new PostgreSQL release to refresh the module.
|
The script can be run at a new PostgreSQL release to refresh the module.
|
||||||
|
@ -20,7 +20,7 @@ from __future__ import print_function
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
from urllib.request import urlopen
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,10 +57,10 @@ def parse_errors_txt(url):
|
||||||
classes = {}
|
classes = {}
|
||||||
errors = defaultdict(dict)
|
errors = defaultdict(dict)
|
||||||
|
|
||||||
page = urllib2.urlopen(url)
|
page = urlopen(url)
|
||||||
for line in page:
|
for line in page:
|
||||||
# Strip comments and skip blanks
|
# Strip comments and skip blanks
|
||||||
line = line.split('#')[0].strip()
|
line = line.decode("ascii").split('#')[0].strip()
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
"""Generate the errors module from PostgreSQL source code.
|
"""Generate the errors module from PostgreSQL source code.
|
||||||
|
|
||||||
The script can be run at a new PostgreSQL release to refresh the module.
|
The script can be run at a new PostgreSQL release to refresh the module.
|
||||||
|
@ -21,7 +21,7 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
from urllib.request import urlopen
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ def parse_errors_txt(url):
|
||||||
classes = {}
|
classes = {}
|
||||||
errors = defaultdict(dict)
|
errors = defaultdict(dict)
|
||||||
|
|
||||||
page = urllib2.urlopen(url)
|
page = urlopen(url)
|
||||||
for line in page:
|
for line in page:
|
||||||
# Strip comments and skip blanks
|
# Strip comments and skip blanks
|
||||||
line = line.split('#')[0].strip()
|
line = line.decode('ascii').split('#')[0].strip()
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user