Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
ac7a87fe
Commit
ac7a87fe
authored
Dec 03, 2013
by
Fantix King
Committed by
Denis Bilenko
Dec 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace basestring with string_types (mostly), refs #38.
parent
e997754e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
8 deletions
+24
-8
gevent/ares.pyx
gevent/ares.pyx
+5
-0
gevent/monkey.py
gevent/monkey.py
+7
-1
greentest/six.py
greentest/six.py
+2
-0
greentest/test__socket_dns.py
greentest/test__socket_dns.py
+3
-2
greentest/testrunner.py
greentest/testrunner.py
+2
-1
greentest/util.py
greentest/util.py
+5
-4
No files found.
gevent/ares.pyx
View file @
ac7a87fe
...
...
@@ -8,6 +8,11 @@ from _socket import gaierror
__all__
=
[
'channel'
]
if
sys
.
version_info
[
0
]
>=
3
:
basestring
=
(
bytes
,
str
)
else
:
basestring
=
__builtins__
.
basestring
TIMEOUT
=
1
DEF
EV_READ
=
1
...
...
gevent/monkey.py
View file @
ac7a87fe
...
...
@@ -15,6 +15,12 @@ __all__ = ['patch_all',
'patch_sys'
]
if
sys
.
version_info
[
0
]
>=
3
:
string_types
=
str
,
else
:
string_types
=
basestring
,
# maps module name -> attribute name -> original item
# e.g. "time" -> "sleep" -> built-in function sleep
saved
=
{}
...
...
@@ -35,7 +41,7 @@ def _get_original(name, items):
def
get_original
(
name
,
item
):
if
isinstance
(
item
,
basestring
):
if
isinstance
(
item
,
string_types
):
return
_get_original
(
name
,
[
item
])[
0
]
else
:
return
_get_original
(
name
,
item
)
...
...
greentest/six.py
View file @
ac7a87fe
...
...
@@ -19,6 +19,7 @@ if PY3:
del
builtins
xrange
=
range
string_types
=
str
,
else
:
def
exec_
(
code
,
globs
=
None
,
locs
=
None
):
...
...
@@ -34,3 +35,4 @@ else:
exec
(
"""exec code in globs, locs"""
)
xrange
=
xrange
string_types
=
basestring
,
greentest/test__socket_dns.py
View file @
ac7a87fe
#!/usr/bin/python
# -*- coding: utf-8 -*-
import
six
import
re
import
greentest
import
socket
...
...
@@ -122,7 +123,7 @@ def relaxed_is_equal(a, b):
return
False
if
a
==
b
:
return
True
if
isinstance
(
a
,
basestring
):
if
isinstance
(
a
,
six
.
string_types
):
return
compare_relaxed
(
a
,
b
)
if
len
(
a
)
!=
len
(
b
):
return
False
...
...
@@ -306,7 +307,7 @@ class TestFamily(TestCase):
result = function(*args)
raise AssertionError('
%
s
:
Expected
to
raise
%
s
,
instead
returned
%
r' % (function, error, result))
except Exception as ex:
if isinstance(error,
basestring
):
if isinstance(error,
six.string_types
):
repr_error = error
else:
repr_error = repr(error)
...
...
greentest/testrunner.py
View file @
ac7a87fe
...
...
@@ -3,6 +3,7 @@ from __future__ import print_function
import
gevent
gevent
.
get_hub
(
'select'
)
# this is just to make sure we don't pass any fds to children
from
gevent
import
monkey
;
monkey
.
patch_all
()
import
six
import
sys
import
os
import
glob
...
...
@@ -84,7 +85,7 @@ def run_many(tests, expected=None, failfast=False):
def
discover
(
tests
=
None
,
ignore
=
None
):
if
isinstance
(
ignore
,
basestring
):
if
isinstance
(
ignore
,
six
.
string_types
):
ignore
=
load_list_from_file
(
ignore
)
ignore
=
set
(
ignore
or
[])
...
...
greentest/util.py
View file @
ac7a87fe
import
sys
import
os
import
re
import
six
import
traceback
import
unittest
import
threading
...
...
@@ -108,7 +109,7 @@ def getname(command, env=None, setenv=None):
if
key
.
startswith
(
'GEVENT_'
)
or
key
.
startswith
(
'GEVENTARES_'
):
result
.
append
(
'%s=%s'
%
(
key
,
value
))
if
isinstance
(
command
,
basestring
):
if
isinstance
(
command
,
six
.
string_types
):
result
.
append
(
command
)
else
:
result
.
extend
(
command
)
...
...
@@ -197,7 +198,7 @@ def run(command, **kwargs):
def
parse_command
(
parts
):
if
isinstance
(
parts
,
basestring
):
if
isinstance
(
parts
,
six
.
string_types
):
parts
=
parts
.
split
()
environ
=
[]
if
parts
[
0
]
==
'-'
:
...
...
@@ -259,9 +260,9 @@ def match_environ(expected_environ, actual_environ):
"""
if
expected_environ
is
None
:
return
True
if
isinstance
(
expected_environ
,
basestring
):
if
isinstance
(
expected_environ
,
six
.
string_types
):
expected_environ
=
expected_environ
.
split
()
if
isinstance
(
actual_environ
,
basestring
):
if
isinstance
(
actual_environ
,
six
.
string_types
):
actual_environ
=
actual_environ
.
split
()
expected_environ
=
dict
(
x
.
split
(
'='
)
for
x
in
expected_environ
)
actual_environ
=
dict
(
x
.
split
(
'='
)
for
x
in
actual_environ
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment