misc: fix useless-object-inheritance pylint error (#62099)

This commit is contained in:
Lauréline Guérin 2022-03-18 14:24:29 +01:00
parent 71ddfd62dc
commit 2e59a6c4be
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
37 changed files with 51 additions and 51 deletions

View File

@ -24,7 +24,7 @@ def row_lock(row):
yield
class RowLockedCache(object):
class RowLockedCache:
"""Cache return value of a function, always return the cached value for
performance but if the cache is stale update it asynchronously using
a thread, prevent multiple update using row locks on database models and

View File

@ -574,7 +574,7 @@ class BaseAdresse(AddressResource):
self.update_api_geo_data()
class UnaccentNameMixin(object):
class UnaccentNameMixin:
def save(self, *args, **kwargs):
self.unaccent_name = simplify(self.name)
super().save(*args, **kwargs)

View File

@ -64,7 +64,7 @@ def is_clean(element):
return all(is_clean(child) for child in element.iterchildren())
class BaseType(object):
class BaseType:
"""Base data binding object"""
tagname = None

View File

@ -184,7 +184,7 @@ def wrap_cmis_error(f):
return wrapper
class CMISGateway(object):
class CMISGateway:
def __init__(self, cmis_endpoint, username, password, logger):
self._cmis_client = CmisClient(cmis_endpoint, username, password, passerelle_logger=logger)
self._logger = logger

View File

@ -30,7 +30,7 @@ def u(s):
return force_text(s, 'iso-8859-15')
class Loader(object):
class Loader:
def __init__(self, connector):
self.connector = connector

View File

@ -107,7 +107,7 @@ class Dialect(csv.Dialect):
skipinitialspace = False
class Loader(object):
class Loader:
def __init__(self, connector):
self.connector = connector

View File

@ -30,7 +30,7 @@ def u(s):
return force_text(s, 'iso-8859-15')
class Loader(object):
class Loader:
def __init__(self, connector):
self.connector = connector

View File

@ -32,7 +32,7 @@ def get_resource_base_dir():
return default_storage.path('mdel')
class AttachedFile(object):
class AttachedFile:
def __init__(self, code, filename, b64_content):
if code not in ('JI', 'JD'):
raise APIError('%s is not a valid code (JI or JD)' % code)
@ -46,7 +46,7 @@ class AttachedFile(object):
default_storage.save(path, ContentFile(self.content))
class MDELBase(object):
class MDELBase:
def to_string(self):
raw_string = etree.tostring(self.xml, encoding='utf-8')
parsed_string = minidom.parseString(raw_string)

View File

@ -187,7 +187,7 @@ class Resource(BaseResource):
if not count:
break
class FileHandler(object):
class FileHandler:
def __init__(self, resource, sftp, filename, identifier, procedure, sequence, mapping):
self.resource = resource
self.sftp = sftp

View File

@ -23,7 +23,7 @@ from passerelle.base.mixins import ResourceChildViewMixin
from . import forms, models
class StayIfChanged(object):
class StayIfChanged:
has_changed = False
def form_valid(self, form):

View File

@ -66,7 +66,7 @@ TYPE_CASTER = {
}
class Schema(object):
class Schema:
def __init__(self):
self.types = {}
self.elements = {}
@ -293,7 +293,7 @@ class Schema(object):
@six.python_2_unicode_compatible
class Path(object):
class Path:
def __init__(self, path, xsd_type):
assert path
self.path = path

View File

@ -19,7 +19,7 @@ from django.apps import apps
from django.utils.module_loading import import_string
class ConnectorAppMixin(object):
class ConnectorAppMixin:
def get_connector_model(self):
return self._connector_model

View File

@ -54,7 +54,7 @@ class ImportSiteForm(forms.Form):
import_users = forms.BooleanField(label=_('Import users and access rights'), required=False)
class BaseQueryFormMixin(object):
class BaseQueryFormMixin:
def clean_slug(self):
slug = self.cleaned_data['slug']

View File

@ -17,7 +17,7 @@
from django.utils import functional
class ResourceChildViewMixin(object):
class ResourceChildViewMixin:
'''Mixin to help implementing view for child objects of resource objets.'''
@property

View File

@ -906,7 +906,7 @@ class ResourceStatus(models.Model):
return self.status == 'down'
class ProxyLogger(object):
class ProxyLogger:
def __init__(self, connector, extra=None, transaction_id=None):
self.connector = connector
self.appname = connector.get_connector_slug()

View File

@ -36,7 +36,7 @@ from passerelle.utils.jsonresponse import APIError
from passerelle.views import WrongParameter
class Error(object):
class Error:
def __init__(self, code, msg=None):
self.code = code
self.msg = msg

View File

@ -87,7 +87,7 @@ def list_schema_fields(schema):
yield fieldname[0] if isinstance(fieldname, tuple) else fieldname
class FormData(object):
class FormData:
def __init__(self, formdata, schema):
if not isinstance(formdata, dict):
raise ValueError('formdata must be a dict')

View File

@ -62,7 +62,7 @@ class Uint32(int):
pass
class MSTEDecoder(object):
class MSTEDecoder:
def __init__(self, data):
self._idx = 4
self._keys = []
@ -171,7 +171,7 @@ class ObjectStore(list):
return None
class MSTEEncoder(object):
class MSTEEncoder:
def __init__(self, data):
self._data = data
self._stream = []

View File

@ -196,7 +196,7 @@ def xml_schema_converter(axel_schema, base_xsd_path, name, root_element):
OperationResult = namedtuple('OperationResult', ['json_response', 'xml_request', 'xml_response'])
class Operation(object):
class Operation:
base_xsd_path = None
default_prefix = ''
axel_schema = AxelSchema

View File

@ -26,7 +26,7 @@ from django.utils.safestring import mark_safe
from .jsonresponse import APIError # noqa pylint: disable=unused-import
class endpoint(object):
class endpoint:
do_not_call_in_templates = True
def __init__(

View File

@ -45,7 +45,7 @@ class JSONEncoder(DjangoJSONEncoder):
return super().default(o)
class to_json(object):
class to_json:
def __init__(self, error_code=500, logger=None, **kwargs):
self.error_code = error_code
self.kwargs = kwargs

View File

@ -60,7 +60,7 @@ def _load_private_key(content_or_file, password=None):
@six.python_2_unicode_compatible
class SFTP(object):
class SFTP:
def __init__(self, url, private_key_content=None, private_key_password=None):
self.url = url
parsed = urlparse.urlparse(url)

View File

@ -40,7 +40,7 @@ class WcsApiError(Exception):
pass
class JSONFile(object):
class JSONFile:
def __init__(self, d):
self.d = d
@ -68,7 +68,7 @@ def to_dict(o):
return o
class BaseObject(object):
class BaseObject:
def __init__(self, wcs_api, **kwargs):
self._wcs_api = wcs_api
self.__dict__.update(**kwargs)
@ -228,7 +228,7 @@ class Schema(BaseObject):
self.geolocations = sorted((k, v) for k, v in (self.geolocations or {}).items())
class FormDatas(object):
class FormDatas:
def __init__(self, wcs_api, formdef, full=False, anonymize=False, batch=1000):
self.wcs_api = wcs_api
self.formdef = formdef
@ -307,7 +307,7 @@ class CancelSubmitError(Exception):
pass
class FormDefSubmit(object):
class FormDefSubmit:
formdef = None
data = None
user_email = None
@ -498,7 +498,7 @@ class Category(BaseObject):
pass
class WcsObjects(object):
class WcsObjects:
url = None
object_class = None
@ -537,7 +537,7 @@ class Categories(WcsObjects):
object_class = Category
class WcsApi(object):
class WcsApi:
def __init__(
self, url, email=None, name_id=None, batch_size=1000, session=None, logger=None, orig=None, key=None
):
@ -643,7 +643,7 @@ def get_wcs_choices(session=None):
@six.python_2_unicode_compatible
class FormDefRef(object):
class FormDefRef:
_formdef = None
_api = None
session = None

View File

@ -130,7 +130,7 @@ class TransformConverter(xmlschema.UnorderedConverter):
return super().element_encode(obj, xsd_element, *args)
class JSONSchemaFromXMLSchema(object):
class JSONSchemaFromXMLSchema:
SIMPLE_TYPE_MAPPING = {
xmlschema_names.XSD_STRING: 'string',
xmlschema_names.XSD_INTEGER: 'integer',

View File

@ -93,7 +93,7 @@ VARIABLE_RE = re.compile(r'{{ *(\w*)')
@python_2_unicode_compatible
class ZipPart(object):
class ZipPart:
def __init__(self, zip_template, name_template, template_path=None, content_expression=None):
self.zip_template = zip_template
self._name_template = name_template
@ -164,7 +164,7 @@ class ZipPart(object):
return s.format(self)
class ZipTemplate(object):
class ZipTemplate:
def __init__(self, manifest, ctx=None):
if manifest.startswith('/'):
path = manifest

View File

@ -149,7 +149,7 @@ class ManageAddView(TemplateView):
return context
class GenericConnectorMixin(object):
class GenericConnectorMixin:
exclude_fields = ('slug', 'users')
def get_connector(self, **kwargs):

View File

@ -815,7 +815,7 @@ def test_context_overloading(mocked_serialize_object, connector, app, monkeypatc
mock_operation_result = mock.Mock(liste=False, EncodeKeyContact=False)
mock_operation = mock.Mock(return_value=mock_operation_result)
class MockService(object):
class MockService:
def __getattr__(self, name):
return mock_operation

View File

@ -40,7 +40,7 @@ def mock_atal_soap_call(monkeypatch, return_value=None, side_effect=None):
return mock_soap_call
class SoapElem(object):
class SoapElem:
def __init__(self, **kwargs):
for attr, value in kwargs.items():
setattr(self, attr, value)

View File

@ -224,7 +224,7 @@ def test_row_locked_cache(genesys, freezer):
freezer.move_to('2018-01-01 00:00:00')
link = Link.objects.create(resource=genesys, name_id='zob', id_per='4567')
class F(object):
class F:
calls = 0
value = 1

View File

@ -44,7 +44,7 @@ def setup(db):
def test_uploadfile(app, setup, tmpdir, monkeypatch):
class FakeCMISGateway(object):
class FakeCMISGateway:
def __init__(self, *args, **kwargs):
pass

View File

@ -82,7 +82,7 @@ class WebFaultHavingLatin1(WebFault):
pass
class MockedService(object):
class MockedService:
def __init__(self, success, error_class, replydata):
self.success = success
self.error_class = error_class

View File

@ -204,7 +204,7 @@ def test_proxy_logger_on_405(mocked_patch, caplog, app, arcgis):
assert record.message == 'endpoint PATCH /arcgis/test/mapservice-query (=> 405)'
class FakeConnectorBase(object):
class FakeConnectorBase:
slug = 'connector'
def get_connector_slug(self):
@ -348,7 +348,7 @@ def test_endpoint_decorator():
assert connector.foo9.endpoint_info.long_description == 'foo9 post'
class FakeJSONConnector(object):
class FakeJSONConnector:
slug = 'connector-json'
log_level = 'DEBUG'
@ -444,7 +444,7 @@ def test_endpoint_decorator_pre_process(db, app):
assert resp.json['data'] == {'foo': [{'id': 42, 'bar': True}]}
class FakeConnectorDatasource(object):
class FakeConnectorDatasource:
slug = 'connector-datasource'
log_level = 'DEBUG'
@ -627,7 +627,7 @@ def test_endpoint_cache(app, db, monkeypatch):
connector = StubInvoicesConnector(slug='fake')
connector.save()
class TestCache(object):
class TestCache:
def __init__(self):
self.d = dict()
self.get_calls = 0

View File

@ -84,7 +84,7 @@ def test_call_ping(soap_client, app, conn):
service = mock.Mock()
service.echo.return_value = 'pong'
class MockedSettings(object):
class MockedSettings:
def __init__(self, **kwargs):
pass

View File

@ -208,7 +208,7 @@ def mdph13(db):
@pytest.fixture
def mock_http():
class MockHttp(object):
class MockHttp:
def __init__(self):
self.requests = []
self.responses = []

View File

@ -245,7 +245,7 @@ def mock_planitech(monkeypatch, return_value=None, side_effect=None, referential
def test_call_planitech(connector, monkeypatch):
class MockResponse(object):
class MockResponse:
status_code = 200
content = None

View File

@ -18,12 +18,12 @@ def clean_adapter_registry():
Request.ADAPTER_REGISTRY.clear()
class MockFileField(object):
class MockFileField:
def __init__(self, path):
self.path = path
class MockResource(object):
class MockResource:
logger = logging.getLogger('requests')
basic_auth_username = ''
basic_auth_password = ''

View File

@ -34,7 +34,7 @@ class BarPlugin(Plugin):
pass
class SOAPResource(object):
class SOAPResource:
def __init__(self):
self.requests = requests.Session()
self.wsdl_url = WSDL