Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
transaction
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
transaction
Commits
92cd3a9b
Commit
92cd3a9b
authored
Dec 17, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't work too hard to cover _compat.
parent
12a9b1ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
transaction/_compat.py
transaction/_compat.py
+11
-16
No files found.
transaction/_compat.py
View file @
92cd3a9b
...
@@ -18,33 +18,28 @@ else:
...
@@ -18,33 +18,28 @@ else:
binary_type
=
str
binary_type
=
str
long
=
long
long
=
long
def
text_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
def
bytes_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
#pragma NO COVER
if
isinstance
(
s
,
binary_type
):
return
s
.
decode
(
encoding
,
errors
)
return
s
# pragma: no cover
def
bytes_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
if
isinstance
(
s
,
text_type
):
if
isinstance
(
s
,
text_type
):
return
s
.
encode
(
encoding
,
errors
)
return
s
.
encode
(
encoding
,
errors
)
return
s
return
s
if
PY3
:
# pragma: no cover
if
PY3
:
# pragma: no cover
def
native_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
def
native_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
#pragma NO COVER
if
isinstance
(
s
,
text_type
):
if
isinstance
(
s
,
text_type
):
return
s
return
s
return
str
(
s
,
encoding
,
errors
)
return
str
(
s
,
encoding
,
errors
)
else
:
else
:
def
native_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
def
native_
(
s
,
encoding
=
'latin-1'
,
errors
=
'strict'
):
#pragma NO COVER
if
isinstance
(
s
,
text_type
):
if
isinstance
(
s
,
text_type
):
return
s
.
encode
(
encoding
,
errors
)
return
s
.
encode
(
encoding
,
errors
)
return
str
(
s
)
return
str
(
s
)
if
PY3
:
if
PY3
:
#pragma NO COVER
from
io
import
StringIO
from
io
import
StringIO
else
:
else
:
from
io
import
BytesIO
as
StringIO
from
io
import
BytesIO
as
StringIO
if
PY3
:
if
PY3
:
#pragma NO COVER
from
collections
import
MutableMapping
from
collections
import
MutableMapping
else
:
else
:
from
UserDict
import
UserDict
as
MutableMapping
from
UserDict
import
UserDict
as
MutableMapping
...
@@ -54,13 +49,13 @@ if PY3: # pragma: no cover
...
@@ -54,13 +49,13 @@ if PY3: # pragma: no cover
exec_
=
getattr
(
builtins
,
"exec"
)
exec_
=
getattr
(
builtins
,
"exec"
)
def
reraise
(
tp
,
value
,
tb
=
None
):
def
reraise
(
tp
,
value
,
tb
=
None
):
#pragma NO COVER
if
value
.
__traceback__
is
not
tb
:
if
value
.
__traceback__
is
not
tb
:
raise
value
.
with_traceback
(
tb
)
raise
value
.
with_traceback
(
tb
)
raise
value
raise
value
else
:
# pragma: no cover
else
:
# pragma: no cover
def
exec_
(
code
,
globs
=
None
,
locs
=
None
):
def
exec_
(
code
,
globs
=
None
,
locs
=
None
):
#pragma NO COVER
"""Execute code in a namespace."""
"""Execute code in a namespace."""
if
globs
is
None
:
if
globs
is
None
:
frame
=
sys
.
_getframe
(
1
)
frame
=
sys
.
_getframe
(
1
)
...
@@ -77,7 +72,7 @@ else: # pragma: no cover
...
@@ -77,7 +72,7 @@ else: # pragma: no cover
"""
)
"""
)
if
PY3
:
if
PY3
:
#pragma NO COVER
try
:
try
:
from
threading
import
get_ident
as
get_thread_ident
from
threading
import
get_ident
as
get_thread_ident
except
ImportError
:
except
ImportError
:
...
@@ -87,9 +82,9 @@ else:
...
@@ -87,9 +82,9 @@ else:
if
PY3
:
if
PY3
:
def
func_name
(
func
):
def
func_name
(
func
):
#pragma NO COVER
return
func
.
__name__
return
func
.
__name__
else
:
else
:
def
func_name
(
func
):
def
func_name
(
func
):
#pragma NO COVER
return
func
.
func_name
return
func
.
func_name
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