Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Commit eceebd5

Browse files
committed
Port to python3 with help from @agargiulo
1 parent ce2dc1a commit eceebd5

File tree

14 files changed

+35
-20
lines changed

14 files changed

+35
-20
lines changed

docs/conf.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# serve to show the default.
1313

1414
import sys, os
15+
import six
1516

1617
# If extensions (or modules to document with autodoc) are in another directory,
1718
# add these directories to sys.path here. If the directory is relative to the
@@ -41,8 +42,8 @@
4142
master_doc = 'index'
4243

4344
# General information about the project.
44-
project = u'pygithub3'
45-
copyright = u'2012, David Medina'
45+
project = six.u('pygithub3')
46+
copyright = six.u('2012, David Medina')
4647

4748
# The version info for the project you're documenting, acts as replacement for
4849
# |version| and |release|, also used in various other places throughout the
@@ -189,8 +190,8 @@
189190
# Grouping the document tree into LaTeX files. List of tuples
190191
# (source start file, target name, title, author, documentclass [howto/manual]).
191192
latex_documents = [
192-
('index', 'pygithub3.tex', u'pygithub3 Documentation',
193-
u'David Medina', 'manual'),
193+
('index', 'pygithub3.tex', six.u('pygithub3 Documentation'),
194+
six.u('David Medina'), 'manual'),
194195
]
195196

196197
# The name of an image file (relative to this directory) to place at the top of
@@ -219,8 +220,8 @@
219220
# One entry per manual page. List of tuples
220221
# (source start file, name, description, authors, manual section).
221222
man_pages = [
222-
('index', 'pygithub3', u'pygithub3 Documentation',
223-
[u'David Medina'], 1)
223+
('index', 'pygithub3', six.u('pygithub3 Documentation'),
224+
[six.u('David Medina')], 1)
224225
]
225226

226227
# If true, show URL addresses after external links.
@@ -233,8 +234,8 @@
233234
# (source start file, target name, title, author,
234235
# dir menu entry, description, category)
235236
texinfo_documents = [
236-
('index', 'pygithub3', u'pygithub3 Documentation',
237-
u'David Medina', 'pygithub3', 'One line description of project.',
237+
('index', 'pygithub3', six.u('pygithub3 Documentation'),
238+
six.u('David Medina'), 'pygithub3', 'One line description of project.',
238239
'Miscellaneous'),
239240
]
240241

pygithub3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
__license__ = 'ISC'
99
__copyright__ = 'Copyright 2012 David Medina'
1010

11-
from github import Github
11+
from .github import Github

pygithub3/core/result/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- encoding: utf-8 -*-
33

44
import functools
5+
import six
56

67

78
class Method(object):
@@ -72,7 +73,7 @@ def wrapper(self):
7273
@get_content
7374
def __next__(self):
7475
try:
75-
return self.iterable.next()
76+
return six.advance_iterator(self.iterable)
7677
except StopIteration:
7778
self.iterable = iter(self.getter(self.page))
7879
raise StopIteration

pygithub3/core/result/link.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
33

4-
from urlparse import urlparse, parse_qs
4+
try:
5+
# Python 3
6+
from urllib.parse import urlparse, parse_qs
7+
except ImportError:
8+
from urlparse import urlparse, parse_qs
9+
510

611
from pygithub3.core.third_libs.link_header import parse_link_value
712

pygithub3/core/result/smart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ def get_page(self, page):
105105
106106
:param int page: Page number
107107
"""
108-
if page in xrange(1, self.pages + 1):
108+
if page in range(1, self.pages + 1):
109109
return base.Page(self.getter, page)
110110
return None

pygithub3/core/third_libs/link_header.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
Simple routines to parse and manipulate Link headers.
77
"""
8+
from __future__ import print_function
89

910
__license__ = """
1011
Copyright (c) 2009 Mark Nottingham
@@ -86,4 +87,4 @@ def parse_link_value(instr):
8687
if __name__ == '__main__':
8788
import sys
8889
if len(sys.argv) > 1:
89-
print parse_link_value(sys.argv[1])
90+
print(parse_link_value(sys.argv[1]))

pygithub3/core/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import json
99

1010
from collections import MutableMapping
11+
from six.moves import map
12+
from six.moves import zip
1113

1214

1315
def _import_module(module_uri):

pygithub3/requests/users/emails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def is_email(email):
3030
raise ValidationError("'%s' request needs emails"
3131
% (self.__class__.__name__))
3232

33-
return filter(is_email, self.body)
33+
return tuple([ele for ele in self.body if is_email(ele)])
3434

3535

3636
class Delete(Request):

pygithub3/services/gists/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- encoding: utf-8 -*-
33

44
from pygithub3.services.base import Service
5-
from comments import Comments
5+
from .comments import Comments
66

77

88
class Gist(Service):

pygithub3/services/issues/labels.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# -*- encoding: utf-8 -*-
33

44
from pygithub3.services.base import Service
5+
from six.moves import map
6+
from six.moves import zip
57

68

79
class Labels(Service):

0 commit comments

Comments
 (0)