Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Replace `abc` with repr(abc)
· da522d83
Brian May
authored
Aug 20, 2018
da522d83
Merge branch 'bam/security-tracker-update_python_repr'
· 20dfe46e
Salvatore Bonaccorso
authored
Feb 24, 2019
20dfe46e
Show whitespace changes
Inline
Side-by-side
lib/python/security_db.py
View file @
20dfe46e
...
...
@@ -627,7 +627,7 @@ class DB:
st
=
os
.
stat
(
filename
)
# The "1" is a version number which can be used to trigger a
# re-read if the code has changed in an incompatible way.
return
`
(st.st_size, st.st_ino, st.st_mtime, 1)
`
return
repr
(
(
st
.
st_size
,
st
.
st_ino
,
st
.
st_mtime
,
1
)
)
def
_parseFile
(
self
,
cursor
,
filename
):
current_print
=
self
.
filePrint
(
filename
)
...
...
@@ -657,7 +657,7 @@ class DB:
if
match
is
None
:
raise
SyntaxError
((
'
package %s references
'
+
'
invalid source package %s
'
)
%
(
pkg_name
,
`
contents
`
))
(
pkg_name
,
repr
(
contents
)
))
(
pkg_source
,
pkg_source_version
)
=
match
.
groups
()
elif
name
==
"
Architecture
"
:
pkg_arch
=
contents
...
...
@@ -1173,7 +1173,7 @@ class DB:
result
.
append
(
"
%s:%d: unstable: %s
"
%
(
b
.
source_file
,
b
.
source_line
,
unstable_ver
))
result
.
append
(
"
%s:%d: release %s: %s
"
%
(
b
.
source_file
,
b
.
source_line
,
`
rel
`
,
rel_ver
))
%
(
b
.
source_file
,
b
.
source_line
,
repr
(
rel
)
,
rel_ver
))
if
self
.
verbose
:
print
(
"
checking source packages
"
)
...
...
lib/python/web_support.py
View file @
20dfe46e
...
...
@@ -139,7 +139,7 @@ class URL:
def
__str__
(
self
):
return
self
.
__url
def
__repr__
(
self
):
return
"
URL(%s)
"
%
`
self.__url
`
return
"
URL(%s)
"
%
repr
(
self
.
__url
)
class
URLFactory
:
"""
Creates URL objects.
...
...
@@ -347,7 +347,7 @@ class Tag(HTMLBase):
write
(
"
<%s%s/>
"
%
(
self
.
__name
,
self
.
__attribs
))
def
__repr__
(
self
):
return
"
<websupport.Tag instance, name=%s>
"
%
`
self.__name
`
return
"
<websupport.Tag instance, name=%s>
"
%
repr
(
self
.
__name
)
def
toString
(
self
):
r
=
cStringIO
.
StringIO
()
...
...
@@ -768,7 +768,7 @@ class WebService(Service, WebServiceBase):
self
.
pre_dispatch
()
url
=
URLFactory
(
server_name
,
script_name
,
path
,
params
)
r
=
method
(
remaining
,
params
,
url
)
assert
isinstance
(
r
,
Result
),
`r`
assert
isinstance
(
r
,
Result
),
repr
(
r
)
r
.
flatten
(
result
.
write
)
class
ThreadingHTTPServer
(
SocketServer
.
ThreadingMixIn
,
...
...
@@ -801,7 +801,7 @@ class WebServiceHTTP(WebServiceBase):
try
:
service_self
.
pre_dispatch
()
r
=
method
(
remaining
,
params
,
url
)
assert
isinstance
(
r
,
Result
),
`r`
assert
isinstance
(
r
,
Result
),
repr
(
r
)
result
=
r
.
flatten_later
()
finally
:
service_self
.
lock
.
release
()
...
...