mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix SLOT002 (subclasses of collections.namedtuple() should define `__slots__`)
This commit is contained in:
@@ -274,8 +274,6 @@ ignore = [
|
||||
"SIM115", # use context handler for opening files
|
||||
"SIM117", # use single 'with' statement
|
||||
"SIM118", # use key in dict not key in dict.keys()
|
||||
# flake8-slots
|
||||
"SLOT002", # Subclasses of collections.namedtuple() should define __slots__
|
||||
# flake8-self
|
||||
"SLF001", # private member accessed
|
||||
# flake8-print
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import json
|
||||
import warnings
|
||||
from collections import namedtuple
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
@@ -12,12 +11,19 @@ from docutils.parsers import rst
|
||||
from sphinx.search import IndexBuilder
|
||||
|
||||
|
||||
class DummyEnvironment(namedtuple('DummyEnvironment', ['version', 'domains'])):
|
||||
class DummyEnvironment:
|
||||
def __init__(self, version, domains):
|
||||
self.version = version
|
||||
self.domains = domains
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name.startswith('_search_index_'):
|
||||
setattr(self, name, {})
|
||||
return getattr(self, name, {})
|
||||
|
||||
def __str__(self):
|
||||
return f'DummyEnvironment({self.version!r}, {self.domains!r})'
|
||||
|
||||
|
||||
class DummyDomain:
|
||||
def __init__(self, data):
|
||||
|
||||
Reference in New Issue
Block a user