mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #3948 from rneatherway/lgtm-fixes
Fix alerts found on lgtm.com
This commit is contained in:
commit
618760cf58
@ -73,8 +73,6 @@ class ChangesBuilder(Builder):
|
||||
ttext = self.typemap[type]
|
||||
context = content.replace('\n', ' ')
|
||||
if descname and docname.startswith('c-api'):
|
||||
if not descname:
|
||||
continue
|
||||
if context:
|
||||
entry = '<b>%s</b>: <i>%s:</i> %s' % (descname, ttext,
|
||||
context)
|
||||
|
@ -4673,9 +4673,8 @@ class DefinitionParser(object):
|
||||
else:
|
||||
# For testing purposes.
|
||||
# do it again to get the proper traceback (how do you
|
||||
# relieable save a traceback when an exception is
|
||||
# reliably save a traceback when an exception is
|
||||
# constructed?)
|
||||
pass
|
||||
self.pos = startPos
|
||||
typed = True
|
||||
declSpecs = self._parse_decl_specs(outer=outer, typed=typed)
|
||||
|
@ -91,9 +91,8 @@ class Grammar(object):
|
||||
|
||||
def dump(self, filename):
|
||||
"""Dump the grammar tables to a pickle file."""
|
||||
f = open(filename, "wb")
|
||||
pickle.dump(self.__dict__, f, 2)
|
||||
f.close()
|
||||
with open(filename, "wb") as f:
|
||||
pickle.dump(self.__dict__, f, 2)
|
||||
|
||||
def load(self, filename):
|
||||
"""Load the grammar tables from a pickle file."""
|
||||
|
@ -431,7 +431,7 @@ def generate_tokens(readline):
|
||||
(lnum, pos), (lnum, pos+1), line)
|
||||
pos = pos + 1
|
||||
|
||||
for indent in indents[1:]: # pop remaining indent levels
|
||||
for _ in indents[1:]: # pop remaining indent levels
|
||||
yield (DEDENT, '', (lnum, 0), (lnum, 0), '')
|
||||
yield (ENDMARKER, '', (lnum, 0), (lnum, 0), '')
|
||||
|
||||
|
@ -301,7 +301,7 @@
|
||||
li.hide();
|
||||
|
||||
// Determine where in the parents children list to insert this comment.
|
||||
for(i=0; i < siblings.length; i++) {
|
||||
for(var i=0; i < siblings.length; i++) {
|
||||
if (comp(comment, siblings[i]) <= 0) {
|
||||
$('#cd' + siblings[i].id)
|
||||
.parent()
|
||||
|
@ -432,7 +432,7 @@ var cssHelper = function () {
|
||||
oss[n][oss[n].length] = r;
|
||||
}
|
||||
};
|
||||
for (i = 0; i < ors.length; i++) {
|
||||
for (var i = 0; i < ors.length; i++) {
|
||||
collectSelectors(ors[i]);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ class ImageConverter(BaseImageConverter):
|
||||
def is_available(self):
|
||||
# type: () -> bool
|
||||
"""Confirms the converter is available or not."""
|
||||
raise NotImplemented
|
||||
raise NotImplementedError()
|
||||
|
||||
def guess_mimetypes(self, node):
|
||||
# type: (nodes.Node) -> List[unicode]
|
||||
@ -248,7 +248,7 @@ class ImageConverter(BaseImageConverter):
|
||||
def convert(self, _from, _to):
|
||||
# type: (unicode, unicode) -> bool
|
||||
"""Converts the image to expected one."""
|
||||
raise NotImplemented
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def setup(app):
|
||||
|
@ -21,7 +21,7 @@ except ImportError:
|
||||
class BaseStemmer(object):
|
||||
def stem(self, word):
|
||||
# type: (unicode) -> unicode
|
||||
raise NotImplemented
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class PyStemmer(BaseStemmer):
|
||||
|
Loading…
Reference in New Issue
Block a user