Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ee171a26
Commit
ee171a26
authored
Oct 15, 2018
by
Pablo Galindo
Committed by
GitHub
Oct 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using deprecated logging API in Sphinx suspicious checker (GH-9875)
parent
6bdb6f76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
Doc/tools/extensions/suspicious.py
Doc/tools/extensions/suspicious.py
+6
-4
No files found.
Doc/tools/extensions/suspicious.py
View file @
ee171a26
...
@@ -48,6 +48,7 @@ import sys
...
@@ -48,6 +48,7 @@ import sys
from
docutils
import
nodes
from
docutils
import
nodes
from
sphinx.builders
import
Builder
from
sphinx.builders
import
Builder
import
sphinx.util
detect_all
=
re
.
compile
(
r'''
detect_all
=
re
.
compile
(
r'''
::(?=[^=])| # two :: (but NOT ::=)
::(?=[^=])| # two :: (but NOT ::=)
...
@@ -85,6 +86,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
...
@@ -85,6 +86,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
Checks for possibly invalid markup that may leak into the output.
Checks for possibly invalid markup that may leak into the output.
"""
"""
name
=
'suspicious'
name
=
'suspicious'
logger
=
sphinx
.
util
.
logging
.
getLogger
(
"CheckSuspiciousMarkupBuilder"
)
def
init
(
self
):
def
init
(
self
):
# create output file
# create output file
...
@@ -116,7 +118,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
...
@@ -116,7 +118,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
self
.
warn
(
'Found %s/%s unused rules:'
%
self
.
warn
(
'Found %s/%s unused rules:'
%
(
len
(
unused_rules
),
len
(
self
.
rules
)))
(
len
(
unused_rules
),
len
(
self
.
rules
)))
for
rule
in
unused_rules
:
for
rule
in
unused_rules
:
self
.
info
(
repr
(
rule
))
self
.
logger
.
info
(
repr
(
rule
))
return
return
def
check_issue
(
self
,
line
,
lineno
,
issue
):
def
check_issue
(
self
,
line
,
lineno
,
issue
):
...
@@ -146,7 +148,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
...
@@ -146,7 +148,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
return
False
return
False
def
report_issue
(
self
,
text
,
lineno
,
issue
):
def
report_issue
(
self
,
text
,
lineno
,
issue
):
if
not
self
.
any_issue
:
self
.
info
()
if
not
self
.
any_issue
:
self
.
logger
.
info
()
self
.
any_issue
=
True
self
.
any_issue
=
True
self
.
write_log_entry
(
lineno
,
issue
,
text
)
self
.
write_log_entry
(
lineno
,
issue
,
text
)
if
py3
:
if
py3
:
...
@@ -181,7 +183,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
...
@@ -181,7 +183,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
A csv file, with exactly the same format as suspicious.csv
A csv file, with exactly the same format as suspicious.csv
Fields: document name (normalized), line number, issue, surrounding text
Fields: document name (normalized), line number, issue, surrounding text
"""
"""
self
.
info
(
"loading ignore rules... "
,
nonl
=
1
)
self
.
logger
.
info
(
"loading ignore rules... "
,
nonl
=
1
)
self
.
rules
=
rules
=
[]
self
.
rules
=
rules
=
[]
try
:
try
:
if
py3
:
if
py3
:
...
@@ -206,7 +208,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
...
@@ -206,7 +208,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
rule
=
Rule
(
docname
,
lineno
,
issue
,
text
)
rule
=
Rule
(
docname
,
lineno
,
issue
,
text
)
rules
.
append
(
rule
)
rules
.
append
(
rule
)
f
.
close
()
f
.
close
()
self
.
info
(
'done, %d rules loaded'
%
len
(
self
.
rules
))
self
.
logger
.
info
(
'done, %d rules loaded'
%
len
(
self
.
rules
))
def
get_lineno
(
node
):
def
get_lineno
(
node
):
...
...
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