misc: pylint fix useless-object-inheritance (#52222)

This commit is contained in:
Lauréline Guérin 2021-03-22 09:19:23 +01:00
parent edab61d227
commit f21431cb8a
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
42 changed files with 76 additions and 76 deletions

View File

@ -33,7 +33,7 @@ from wcs.qommon.form import StringWidget
from wcs.qommon.form import TextWidget
class ApiAccessUI(object):
class ApiAccessUI:
def __init__(self, api_access):
self.api_access = api_access
if self.api_access is None:

View File

@ -34,7 +34,7 @@ from wcs.qommon.form import StringWidget
from wcs.qommon.form import WysiwygTextWidget
class CategoryUI(object):
class CategoryUI:
category_class = Category
def __init__(self, category):

View File

@ -48,7 +48,7 @@ from wcs.qommon.form import get_response
from wcs.qommon.form import get_session
class NamedDataSourceUI(object):
class NamedDataSourceUI:
def __init__(self, datasource):
self.datasource = datasource
if self.datasource is None:

View File

@ -86,7 +86,7 @@ def get_categories(category_class):
return [x[1:] for x in t]
class FormDefUI(object):
class FormDefUI:
formdef_class = FormDef
category_class = Category
@ -1521,7 +1521,7 @@ class FormDefPage(Directory):
return self.archive_submit(form)
def archive_submit(self, form):
class Archiver(object):
class Archiver:
def __init__(self, formdef):
self.formdef = formdef
@ -1625,7 +1625,7 @@ class FormDefPage(Directory):
return self.anonymise_submit(form)
def anonymise_submit(self, form):
class Anonymiser(object):
class Anonymiser:
def __init__(self, formdef, status_ids, before_date):
self.formdef = formdef
self.status_ids = ["wf-%s" % id for id in status_ids]

View File

@ -35,7 +35,7 @@ from wcs.qommon.form import WidgetList
from wcs.roles import get_user_roles
class RoleUI(object):
class RoleUI:
def __init__(self, role):
self.role = role
if self.role is None:

View File

@ -1005,7 +1005,7 @@ class SettingsDirectory(QommonSettingsDirectory):
r += form.render()
return r.getvalue()
class Exporter(object):
class Exporter:
def __init__(self, dirs, settings):
self.app_dir = get_publisher().app_dir
self.dirs = dirs

View File

@ -46,7 +46,7 @@ from wcs.qommon.ident.idp import is_idp_managing_user_attributes
from wcs.qommon.ident.idp import is_idp_managing_user_roles
class UserUI(object):
class UserUI:
def __init__(self, user):
self.user = user

View File

@ -301,7 +301,7 @@ def graphviz(workflow, url_prefix='', select=None, svg=True, include=False):
return out
class WorkflowUI(object):
class WorkflowUI:
def __init__(self, workflow):
self.workflow = workflow

View File

@ -42,7 +42,7 @@ from wcs.wscalls import NamedWsCall
from wcs.wscalls import WsCallRequestWidget
class NamedWsCallUI(object):
class NamedWsCallUI:
def __init__(self, wscall):
self.wscall = wscall
if self.wscall is None:

View File

@ -3370,7 +3370,7 @@ class FormBackOfficeStatusPage(FormStatusPage):
return self.test_tool_result()
class FakeField(object):
class FakeField:
def __init__(self, id, type_, label, addable=True):
self.id = id
self.type = type_

View File

@ -20,7 +20,7 @@ from django.utils.module_loading import import_string
from quixote import get_publisher
class TenantBaseCache(object):
class TenantBaseCache:
'''Prepend the tenant application directory to the cache prefix'''
def set_key_prefix(self, prefix):

View File

@ -30,7 +30,7 @@ class ValidationError(ValueError):
pass
class Condition(object):
class Condition:
record_errors = True
log_errors = False

View File

@ -810,7 +810,7 @@ class StubNamedDataSource(NamedDataSource):
return '<StubNamedDataSource %r>' % self.name
class DataSourcesSubstitutionProxy(object):
class DataSourcesSubstitutionProxy:
def __getattr__(self, attr):
return get_structured_items(NamedDataSource.get_by_slug(attr).data_source)

View File

@ -248,7 +248,7 @@ class PrefillSelectionWidget(CompositeWidget):
return r.getvalue()
class Field(object):
class Field:
id = None
type = None
varname = None
@ -1762,7 +1762,7 @@ class MapOptionsMixin:
)
class ItemFieldMixin(object):
class ItemFieldMixin:
def add_items_fields_admin_form(self, form):
real_data_source = data_sources.get_real(self.data_source)
form.add(
@ -2444,7 +2444,7 @@ class PageCondition(Condition):
# 1) feed the form_var_* variables in the global substitution system,
# they will shadow formdata context variables with their new "live"
# value, this may be useful when evaluating data sources.
class ConditionVars(object):
class ConditionVars:
def __init__(self, id_dict_var):
# keep track of reference dictionary
self.id_dict_var = id_dict_var

View File

@ -112,7 +112,7 @@ def flatten_dict(d):
del d[k]
class Evolution(object):
class Evolution:
who = None
status = None
time = None

View File

@ -77,7 +77,7 @@ class FormdefImportRecoverableError(FormdefImportError):
pass
class FormField(object):
class FormField:
# only used to unpickle form fields from older (<200603) versions
def __setstate__(self, dict):
type = dict['type']
@ -1523,7 +1523,7 @@ class FormDef(StorableObject):
if changed:
formdef.store()
class _EmptyClass(object): # helper for instance creation without calling __init__
class _EmptyClass: # helper for instance creation without calling __init__
pass
def __copy__(self, memo=None, deepcopy=False):

View File

@ -31,7 +31,7 @@ from ..qommon import misc
from ..qommon.backoffice.listing import pagination_links
class FormDefUI(object):
class FormDefUI:
def __init__(self, formdef):
self.formdef = formdef

View File

@ -128,7 +128,7 @@ class FilesDirectory(Directory):
return FileDirectory(self.formdata, reference=component)
class FormTemplateMixin(object):
class FormTemplateMixin:
def get_formdef_template_variants(self, template_names):
template_part_names = [(os.path.dirname(x), os.path.basename(x)) for x in template_names]
for dirname, basename in template_part_names:

View File

@ -23,7 +23,7 @@ from wcs.workflows import Workflow
from .qommon.misc import simplify
class LoggedError(object):
class LoggedError:
_names = 'logged-errors'
id = None

View File

@ -55,7 +55,7 @@ def fargo_url(url):
# Allow doing a signed POST in an afterjob, as fargo_url() does not work if no request is in
# context; so we do it in the constructor.
class fargo_post_json_async(object):
class fargo_post_json_async:
def __init__(self, url, payload):
self.url = fargo_url(url)
self.payload = payload

View File

@ -19,7 +19,7 @@ import sys
from django.conf import settings
class CronJob(object):
class CronJob:
name = None
hours = None
minutes = None

View File

@ -33,7 +33,7 @@ from . import _
qommon._commands = {}
class Command(object):
class Command:
doc = ''
name = None
usage_args = '[ options ... ]'
@ -88,7 +88,7 @@ class Command(object):
qommon._commands[cls.name] = cls
class Ctl(object):
class Ctl:
def __init__(self, cmd_prefixes=None):
self.cmd_prefixes = cmd_prefixes or []
self.parser = optparse.OptionParser(

View File

@ -392,7 +392,7 @@ def create_smtp_server(emails_cfg, smtp_timeout=None):
return s
class EmailToSend(object):
class EmailToSend:
def __init__(self, msg_from, rcpts, msg, smtp_timeout):
self.msg_from = msg_from
self.rcpts = rcpts

View File

@ -80,7 +80,7 @@ class EmailError(Exception):
pass
class InternalServerError(object):
class InternalServerError:
def render(self):
from . import _

View File

@ -498,7 +498,7 @@ class Form(QuixoteForm):
widget.add_media()
class HtmlWidget(object):
class HtmlWidget:
error = None
name = None
@ -996,7 +996,7 @@ class EmailWidget(StringWidget):
self.error = _('invalid address domain')
class OptGroup(object):
class OptGroup:
def __init__(self, title):
self.title = title

View File

@ -15,7 +15,7 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
class AuthMethod(object):
class AuthMethod:
method_admin_widget = None
def is_interactive(self):

View File

@ -81,7 +81,7 @@ def get_as_string_number(value):
return str(value)
class Workbook(object):
class Workbook:
def __init__(self, encoding='utf-8'):
self.sheets = []
self.encoding = encoding
@ -178,7 +178,7 @@ class Workbook(object):
z.close()
class WorkSheet(object):
class WorkSheet:
def __init__(self, workbook, name):
self.cells = {}
self.name = name
@ -204,7 +204,7 @@ class WorkSheet(object):
return root
class WorkCell(object):
class WorkCell:
def __init__(self, worksheet, value, formdata=None, data_field=None, native_value=None):
self.worksheet = worksheet
if value is None:

View File

@ -72,7 +72,7 @@ class ImmediateRedirectException(Exception):
self.location = location
class QommonPublisher(Publisher, object):
class QommonPublisher(Publisher):
APP_NAME = None
APP_DIR = None
DATA_DIR = None
@ -438,7 +438,7 @@ class QommonPublisher(Publisher, object):
self._app_logger = self.get_app_logger(force=True)
else:
class NullLogger(object):
class NullLogger:
def error(self, *args):
pass

View File

@ -29,7 +29,7 @@ def bool2xs(boolean):
raise TypeError()
class Metadata(object):
class Metadata:
__endpoints = {'slo': 'singleLogout', 'ac': 'assertionConsumer'}
def __init__(self, publisher, provider_id, config):

View File

@ -47,7 +47,7 @@ class QommonSession(QuixoteSession):
self.__remote_address = env.get('X_FORWARDED_FOR', env.get('REMOTE_ADDR'))
class CaptchaSession(object):
class CaptchaSession:
MAX_CAPTCHA_TOKENS = 8
_captcha_tokens = None
won_captcha = False

View File

@ -20,7 +20,7 @@ from . import get_cfg
from . import get_logger
class PasserelleSMS(object):
class PasserelleSMS:
TIMEOUT = 10
def __init__(self):
@ -40,7 +40,7 @@ class PasserelleSMS(object):
get_logger().debug('sms %r sent using passerelle to %r, result: %r', text, destinations, data)
class SMS(object):
class SMS:
@classmethod
def get_sms_class(cls):
sms_cfg = get_cfg('sms', {})

View File

@ -139,7 +139,7 @@ def pickle_2to3_conversion(obj):
obj.__dict__ = deep_bytes2str(obj.__dict__) # inplace
class Criteria(object):
class Criteria:
def __init__(self, attribute, value):
self.attribute = attribute
self.value = value
@ -296,7 +296,7 @@ class StorageIndexException(Exception):
pass
class StorableObject(object):
class StorableObject:
_indexes = None
_hashed_indexes = None
_filename = None # None, unless must be saved to a specific location

View File

@ -31,7 +31,7 @@ def invalidate_substitution_cache(func):
return f
class Substitutions(object):
class Substitutions:
substitutions_dict = {}
dynamic_sources = []
sources = None

View File

@ -426,7 +426,7 @@ def render(template_name, context):
return htmltext(force_str(result))
class QommonTemplateResponse(object):
class QommonTemplateResponse:
def __init__(self, templates, context):
self.templates = templates
self.context = context
@ -477,7 +477,7 @@ def ezt_raises(exception, on_parse=False):
raise TemplateError(message % ' '.join(parts))
class Template(object):
class Template:
def __init__(self, value, raises=False, ezt_format=ezt.FORMAT_RAW, ezt_only=False, autoescape=True):
'''Guess kind of template (Django or ezt), and parse it'''
self.value = value

View File

@ -103,7 +103,7 @@ class UploadStorageError(Exception):
pass
class UploadStorage(object):
class UploadStorage:
def save_tempfile(self, upload):
upload.__class__ = PicklableUpload
dirname = os.path.join(get_publisher().app_dir, 'tempfiles')
@ -158,7 +158,7 @@ class UploadStorage(object):
raise AssertionError('no get_redirect_url on UploadStorage object')
class RemoteOpaqueUploadStorage(object):
class RemoteOpaqueUploadStorage:
def __init__(self, ws, frontoffice_redirect='true', backoffice_redirect='true', **kwargs):
self.ws = ws
self.frontoffice_redirect = bool(frontoffice_redirect == 'true')

View File

@ -101,7 +101,7 @@ def _acquire_non_blocking(acquire, timeout, retry_period, path):
time.sleep(retry_period)
class _LockSet(object):
class _LockSet:
def __init__(self, locks):
self._locks = locks
@ -130,7 +130,7 @@ class _LockSet(object):
self.release()
class _ThreadLock(object):
class _ThreadLock:
def __init__(self, path, timeout=None, retry_period=None):
self._path = path
self._timeout = timeout
@ -152,7 +152,7 @@ class _ThreadLock(object):
self._lock.release()
class _LockFile(object):
class _LockFile:
def __init__(self, path, timeout=None, retry_period=None):
self._path = path
self._timeout = timeout

View File

@ -20,7 +20,7 @@ import os
from quixote import get_publisher
class Script(object):
class Script:
ezt_call_mode = 'simple'
def __init__(self, script_name):
@ -56,7 +56,7 @@ class Script(object):
return data.get('result')
class ScriptsSubstitutionProxy(object):
class ScriptsSubstitutionProxy:
def __getattr__(self, attr):
try:
return Script(attr)

View File

@ -1374,7 +1374,7 @@ def do_global_views(conn, cur):
)
class SqlMixin(object):
class SqlMixin:
_table_name = None
_numerical_id = True
_table_select_skipped_fields = []
@ -3024,7 +3024,7 @@ class LoggedError(SqlMixin, wcs.logged_errors.LoggedError):
cur.close()
class classproperty(object):
class classproperty:
def __init__(self, f):
self.f = f

View File

@ -36,7 +36,7 @@ from .qommon.substitution import CompatibilityNamesDict
from .qommon.templatetags.qommon import parse_datetime
class LazyFormDefObjectsManager(object):
class LazyFormDefObjectsManager:
def __init__(
self, formdef, formdata=None, geoloc_center_formdata=None, criterias=None, order_by=None, limit=None
):
@ -255,7 +255,7 @@ class LazyFormDefObjectsManager(object):
return any(self)
class LazyList(object):
class LazyList:
def __init__(self, lazy_manager, key):
self._lazy_manager = lazy_manager
self._key = key
@ -304,7 +304,7 @@ class LazyList(object):
return list(self) == list(other)
class LazyFormDef(object):
class LazyFormDef:
def __init__(self, formdef):
self._formdef = formdef
@ -613,7 +613,7 @@ class LazyFormData(LazyFormDef):
raise
class LazyFormDataVar(object):
class LazyFormDataVar:
def __init__(self, fields, data, formdata=None):
self._fields = fields
self._data = data or {}
@ -701,7 +701,7 @@ class LazyFormDataVar(object):
raise AttributeError(attr)
class LazyFieldVar(object):
class LazyFieldVar:
def __init__(self, data, field, formdata=None, **kwargs):
self._data = data
self._field = field
@ -876,7 +876,7 @@ class LazyFieldVarStructured(LazyFieldVar):
raise KeyError(key)
class DateOperatorsMixin(object):
class DateOperatorsMixin:
def __eq__(self, other):
if hasattr(other, 'timetuple'):
other = other.timetuple()
@ -1077,7 +1077,7 @@ class LazyFieldVarBlock(LazyFieldVar):
return [data.get(field.id) for data in self._formdata.data.get(self._field.id)['data']]
class LazyUser(object):
class LazyUser:
def __init__(self, user):
self._user = user
@ -1125,7 +1125,7 @@ class LazyUser(object):
return getattr(self._user, attr)
class LazyRequest(object):
class LazyRequest:
def __init__(self, request):
self._request = request

View File

@ -39,7 +39,7 @@ from wcs.workflows import WorkflowStatusItem
from wcs.workflows import register_item_class
class Mapping(object):
class Mapping:
field_id = None
expression = None
@ -131,7 +131,7 @@ class MappingsWidget(WidgetListAsTable):
self.value.sort(key=lambda mapping: self.ranks.get(str(mapping.field_id), 9999))
class LinkedFormdataEvolutionPart(object):
class LinkedFormdataEvolutionPart:
formdef_class = FormDef
attach_to_history = False
@ -187,7 +187,7 @@ class LinkedFormdataEvolutionPart(object):
return ''
class LazyFormDataLinks(object):
class LazyFormDataLinks:
def __init__(self, formdata):
self._formdata = formdata

View File

@ -133,7 +133,7 @@ class AbortActionException(Exception):
pass
class AttachmentSubstitutionProxy(object):
class AttachmentSubstitutionProxy:
def __init__(self, formdata, attachment_evolution_part):
self.formdata = formdata
self.attachment_evolution_part = attachment_evolution_part
@ -165,7 +165,7 @@ class AttachmentSubstitutionProxy(object):
)
class NamedAttachmentsSubstitutionProxy(object):
class NamedAttachmentsSubstitutionProxy:
def __init__(self, formdata, parts):
self.formdata = formdata
self.parts = parts[:]
@ -181,7 +181,7 @@ class NamedAttachmentsSubstitutionProxy(object):
return AttachmentSubstitutionProxy(self.formdata, self.parts[i])
class AttachmentsSubstitutionProxy(object):
class AttachmentsSubstitutionProxy:
def __init__(self, formdata):
self.formdata = formdata
@ -940,7 +940,7 @@ class Workflow(StorableObject):
return list(CardDef.select(lambda x: x.workflow_id == self.id, **kwargs))
class XmlSerialisable(object):
class XmlSerialisable:
node_name = None
key = None
@ -1132,7 +1132,7 @@ class WorkflowGlobalActionManualTrigger(WorkflowGlobalActionTrigger):
self._roles_init_with_xml('roles', elem, charset, include_id=include_id, snapshot=snapshot)
class WorkflowGlobalActionTimeoutTriggerMarker(object):
class WorkflowGlobalActionTimeoutTriggerMarker:
def __init__(self, timeout_id):
self.timeout_id = timeout_id
@ -1469,7 +1469,7 @@ class WorkflowGlobalActionWebserviceTrigger(WorkflowGlobalActionManualTrigger):
return [('hooks', WorkflowGlobalActionWebserviceHooksDirectory(formdata))]
class WorkflowGlobalAction(object):
class WorkflowGlobalAction:
id = None
name = None
items = None
@ -1549,7 +1549,7 @@ class WorkflowGlobalAction(object):
trigger_o.init_with_xml(trigger, charset, include_id=include_id, snapshot=snapshot)
class WorkflowCriticalityLevel(object):
class WorkflowCriticalityLevel:
id = None
name = None
colour = None
@ -1574,7 +1574,7 @@ class WorkflowCriticalityLevel(object):
self.colour = xml_node_text(elem.find('colour'))
class WorkflowStatus(object):
class WorkflowStatus:
id = None
name = None
items = None

View File

@ -277,7 +277,7 @@ class NamedWsCall(XmlStorableObject):
return json_loads(data)
class WsCallsSubstitutionProxy(object):
class WsCallsSubstitutionProxy:
def __getattr__(self, attr):
try:
return NamedWsCall.get(attr).call()