misc: fix super-with-arguments pylint error (#62099)
This commit is contained in:
parent
1d9722a210
commit
302e573f70
|
@ -230,7 +230,7 @@ class ArcGIS(BaseResource, HTTPResource):
|
|||
return query.q(request, q=None, full=full, **kwargs)
|
||||
|
||||
def export_json(self):
|
||||
d = super(ArcGIS, self).export_json()
|
||||
d = super().export_json()
|
||||
d['queries'] = [query.export_json() for query in self.queries.all()]
|
||||
return d
|
||||
|
||||
|
@ -256,7 +256,7 @@ class SqlFormatter(string.Formatter):
|
|||
def format_field(self, value, format_spec):
|
||||
if format_spec and format_spec[-1].isalpha() and format_spec[-1] == 'd':
|
||||
value = int(value)
|
||||
formatted = super(SqlFormatter, self).format_field(value, format_spec)
|
||||
formatted = super().format_field(value, format_spec)
|
||||
if not format_spec or not format_spec[-1].isalpha() or format_spec[-1] == 's':
|
||||
formatted = "'%s'" % formatted.replace("'", "''")
|
||||
return formatted
|
||||
|
@ -349,7 +349,7 @@ class Query(BaseQuery):
|
|||
return self.resource.mapservice_query(request, q=q, full=full, **kwargs)
|
||||
|
||||
def as_endpoint(self):
|
||||
endpoint = super(Query, self).as_endpoint(path=self.resource.q.endpoint_info.name)
|
||||
endpoint = super().as_endpoint(path=self.resource.q.endpoint_info.name)
|
||||
|
||||
mapservice_endpoint = self.resource.mapservice_query.endpoint_info
|
||||
endpoint.func = mapservice_endpoint.func
|
||||
|
|
|
@ -27,7 +27,7 @@ class QueryNew(ResourceChildViewMixin, CreateView):
|
|||
form_class = QueryForm
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(QueryNew, self).get_form_kwargs()
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs['instance'] = self.model(resource=self.resource)
|
||||
return kwargs
|
||||
|
||||
|
|
|
@ -566,11 +566,11 @@ class BaseAdresse(AddressResource):
|
|||
self.add_job('update_streets_data')
|
||||
|
||||
def hourly(self):
|
||||
super(BaseAdresse, self).hourly()
|
||||
super().hourly()
|
||||
self.clean_addresses_cache()
|
||||
|
||||
def daily(self):
|
||||
super(BaseAdresse, self).daily()
|
||||
super().daily()
|
||||
self.update_streets_data()
|
||||
self.update_api_geo_data()
|
||||
|
||||
|
@ -578,7 +578,7 @@ class BaseAdresse(AddressResource):
|
|||
class UnaccentNameMixin(object):
|
||||
def save(self, *args, **kwargs):
|
||||
self.unaccent_name = simplify(self.name)
|
||||
super(UnaccentNameMixin, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
|
|
|
@ -136,13 +136,13 @@ class AbstractCartaDSCS(BaseResource):
|
|||
return self.wsdl_base_url + service_type + '.svc?singleWsdl'
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super(AbstractCartaDSCS, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
if CartaDSDataCache.objects.count() == 0:
|
||||
# don't wait for daily job to get initial data
|
||||
self.add_job('update_data_cache')
|
||||
|
||||
def soap_client(self, **kwargs):
|
||||
client = super(AbstractCartaDSCS, self).soap_client(**kwargs)
|
||||
client = super().soap_client(**kwargs)
|
||||
# fix URL that should have been changed by reverse proxy
|
||||
parsed_wsdl_address = urlparse.urlparse(client.service._binding_options['address'])
|
||||
parsed_real_address = urlparse.urlparse(self.wsdl_base_url)
|
||||
|
@ -358,11 +358,11 @@ class AbstractCartaDSCS(BaseResource):
|
|||
self.sync_subscribers_role(dossier)
|
||||
|
||||
def hourly(self):
|
||||
super(AbstractCartaDSCS, self).hourly()
|
||||
super().hourly()
|
||||
self.update_dossier_cache()
|
||||
|
||||
def daily(self):
|
||||
super(AbstractCartaDSCS, self).daily()
|
||||
super().daily()
|
||||
self.update_data_cache()
|
||||
|
||||
@endpoint(description=_('Get list of collectivities'))
|
||||
|
|
|
@ -198,7 +198,7 @@ class Names(ComplexType):
|
|||
sequence = ('nomDeFamille', 'nomUsgae', 'typeUsage')
|
||||
|
||||
def __init__(self, data):
|
||||
super(Names, self).__init__(data)
|
||||
super().__init__(data)
|
||||
if self.data.get('lastname'):
|
||||
self.nomDeFamille = self.data['lastname']
|
||||
self.nomUsage = self.data.get('usual_name', '')
|
||||
|
@ -210,7 +210,7 @@ class Place(ComplexType):
|
|||
sequence = ('ville', 'province', 'pays')
|
||||
|
||||
def __init__(self, data):
|
||||
super(Place, self).__init__(data)
|
||||
super().__init__(data)
|
||||
if self.data.get('city'):
|
||||
self.ville = self.data['city']
|
||||
self.province = self.data.get('county', '')
|
||||
|
@ -223,7 +223,7 @@ class Address(ComplexType):
|
|||
pattern = 'address_'
|
||||
|
||||
def __init__(self, data):
|
||||
super(Address, self).__init__(data)
|
||||
super().__init__(data)
|
||||
self.ligneAdr1 = self.data.get('street', '')
|
||||
self.ligneAdr2 = self.data.get('complement', '')
|
||||
self.codePostal = self.data.get('zipcode', '')
|
||||
|
@ -238,7 +238,7 @@ class Birth(ComplexType):
|
|||
pattern = 'birth_'
|
||||
|
||||
def __init__(self, data):
|
||||
super(Birth, self).__init__(data)
|
||||
super().__init__(data)
|
||||
birthdate = self.data.get('date', None)
|
||||
if birthdate:
|
||||
self.date = BirthDate(birthdate)
|
||||
|
@ -250,7 +250,7 @@ class EventDate(ComplexType):
|
|||
sequence = ('dateDebut', 'dateFin')
|
||||
|
||||
def __init__(self, data):
|
||||
super(EventDate, self).__init__(data)
|
||||
super().__init__(data)
|
||||
self.dateDebut = StartDate(self.data['event_date_start'])
|
||||
if data.get('event_date_end', None):
|
||||
self.dateFin = EndDate(self.data['event_date_end'])
|
||||
|
@ -265,7 +265,7 @@ class Person(ComplexType):
|
|||
sequence = ('noms', 'prenoms', 'genre', 'adresse', 'sexe', 'pere', 'mere', 'naissance')
|
||||
|
||||
def __init__(self, data):
|
||||
super(Person, self).__init__(data)
|
||||
super().__init__(data)
|
||||
self.noms = Names(self.data)
|
||||
self.prenoms = self.data.get('firstnames', '')
|
||||
if self.data.get('title', None):
|
||||
|
@ -287,7 +287,7 @@ class Parent(Person):
|
|||
|
||||
def __init__(self, data, pattern):
|
||||
self.pattern = pattern
|
||||
super(Parent, self).__init__(data)
|
||||
super().__init__(data)
|
||||
sex = self.data.get('sex')
|
||||
if sex:
|
||||
if sex == 'M':
|
||||
|
@ -305,7 +305,7 @@ class ConcernedCommon(Person):
|
|||
sequence = ('noms', 'prenoms', 'genre', 'sexe', 'parent1', 'parent2', 'naissance')
|
||||
|
||||
def __init__(self, data):
|
||||
super(ConcernedCommon, self).__init__(data)
|
||||
super().__init__(data)
|
||||
self.parent1 = Parent(self.data, 'parent1_')
|
||||
self.parent2 = Parent(self.data, 'parent2_')
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ class CmisTypeView(TemplateView):
|
|||
raise Http404(_('Cmis type not found.'))
|
||||
else:
|
||||
self.current_type = None
|
||||
return super(CmisTypeView, self).get(request, *args, **kwargs)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super(CmisTypeView, self).get_context_data(**kwargs)
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx['object'] = self.connector
|
||||
if self.current_type:
|
||||
ctx['current_type'] = self.current_type
|
||||
|
|
|
@ -167,7 +167,7 @@ class CsvDataSource(BaseResource):
|
|||
self.get_rows()
|
||||
except Exception as e:
|
||||
raise ValidationError(_('Invalid CSV file: %s') % e)
|
||||
return super(CsvDataSource, self).clean(*args, **kwargs)
|
||||
return super().clean(*args, **kwargs)
|
||||
|
||||
def _detect_dialect_options(self):
|
||||
content = self.get_content_without_bom()
|
||||
|
@ -176,7 +176,7 @@ class CsvDataSource(BaseResource):
|
|||
|
||||
def save(self, *args, **kwargs):
|
||||
cache = kwargs.pop('cache', True)
|
||||
result = super(CsvDataSource, self).save(*args, **kwargs)
|
||||
result = super().save(*args, **kwargs)
|
||||
if cache:
|
||||
self.cache_data()
|
||||
return result
|
||||
|
@ -469,7 +469,7 @@ class CsvDataSource(BaseResource):
|
|||
return {'data': list(data[0].values())[0]}
|
||||
|
||||
def export_json(self):
|
||||
d = super(CsvDataSource, self).export_json()
|
||||
d = super().export_json()
|
||||
d['queries'] = [query.export_json() for query in Query.objects.filter(resource=self)]
|
||||
return d
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class NewQueryView(CreateView):
|
|||
template_name = 'csvdatasource/query_form.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super(NewQueryView, self).get_context_data(**kwargs)
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx['resource'] = CsvDataSource.objects.get(slug=self.kwargs['connector_slug'])
|
||||
return ctx
|
||||
|
||||
|
@ -47,7 +47,7 @@ class UpdateQueryView(UpdateView):
|
|||
template_name = 'csvdatasource/query_form.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super(UpdateQueryView, self).get_context_data(**kwargs)
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx['resource'] = CsvDataSource.objects.get(slug=self.kwargs['connector_slug'])
|
||||
return ctx
|
||||
|
||||
|
@ -59,7 +59,7 @@ class DeleteQueryView(DeleteView):
|
|||
model = Query
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super(DeleteQueryView, self).get_context_data(**kwargs)
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx['resource'] = CsvDataSource.objects.get(slug=self.kwargs['connector_slug'])
|
||||
return ctx
|
||||
|
||||
|
|
|
@ -183,11 +183,11 @@ class GenericFamily(BaseResource):
|
|||
module = sys.modules[modname]
|
||||
module.Loader(self).clean(archive)
|
||||
|
||||
return super(GenericFamily, self).clean()
|
||||
return super().clean()
|
||||
|
||||
@transaction.atomic
|
||||
def save(self, *args, **kwargs):
|
||||
super(GenericFamily, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
if not zipfile.is_zipfile(self.archive.path):
|
||||
return
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class GdcDetailView(DetailView):
|
|||
template_name = 'gdc/gdc_detail.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(GdcDetailView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
if phpserialize is None:
|
||||
context['missing_phpserialize'] = True
|
||||
return context
|
||||
|
|
|
@ -253,7 +253,7 @@ class Gesbac(BaseResource):
|
|||
form.save()
|
||||
|
||||
def hourly(self):
|
||||
super(Gesbac, self).hourly()
|
||||
super().hourly()
|
||||
self.get_responses()
|
||||
|
||||
def send_demand(self, form_id):
|
||||
|
|
|
@ -61,7 +61,7 @@ class JsonData(models.Model):
|
|||
template = Template(text_value_template)
|
||||
context = Context(self.content)
|
||||
self.text = template.render(context).strip()
|
||||
return super(JsonData, self).save(*args, **kwargs)
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
|
|
|
@ -66,10 +66,10 @@ class Common(MDELBase):
|
|||
self.flow_type = args[0]
|
||||
self.num = args[1]
|
||||
self.doc = kwargs.get('doc')
|
||||
super(Common, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
def save(self, folder):
|
||||
return super(Common, self).save(folder, self.filename)
|
||||
return super().save(folder, self.filename)
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
|
@ -158,7 +158,7 @@ class Message(Common):
|
|||
doc=None,
|
||||
):
|
||||
|
||||
super(Message, self).__init__(flow_type, num, doc=doc)
|
||||
super().__init__(flow_type, num, doc=doc)
|
||||
|
||||
etree._namespace_map[self.ns_uri] = self.ns_prefix
|
||||
|
||||
|
@ -221,9 +221,7 @@ class Description(Common):
|
|||
user_comment=None,
|
||||
):
|
||||
|
||||
super(Description, self).__init__(
|
||||
flow_type, num, zip_code, date, platform_id, form_files, attached_files, doc=doc
|
||||
)
|
||||
super().__init__(flow_type, num, zip_code, date, platform_id, form_files, attached_files, doc=doc)
|
||||
self.step = step
|
||||
|
||||
root = ElementFactory('EnteteMetierEnveloppe', attrib={'xmlns': self.xmlns})
|
||||
|
@ -277,7 +275,7 @@ class Data(MDELBase):
|
|||
return '%s-doc-.xml' % self.demand_id
|
||||
|
||||
def save(self, folder):
|
||||
return super(Data, self).save(folder, self.filename)
|
||||
return super().save(folder, self.filename)
|
||||
|
||||
def data_validator(self, data):
|
||||
"""Checks if required keys are present"""
|
||||
|
@ -375,7 +373,7 @@ class ILEData(Data):
|
|||
# only possible value : vol as 'Inscription Volontaire'
|
||||
data['inscription_type'] = 'vol'
|
||||
|
||||
super(ILEData, self).__init__(demand_id, data)
|
||||
super().__init__(demand_id, data)
|
||||
|
||||
|
||||
class AECData(Data):
|
||||
|
@ -463,7 +461,7 @@ class AECData(Data):
|
|||
self.root_element = 'EnveloppeMetierType'
|
||||
self.root_attributes = {'canal_utilise': '0'}
|
||||
|
||||
super(AECData, self).__init__(demand_id, data, demand_num)
|
||||
super().__init__(demand_id, data, demand_num)
|
||||
|
||||
|
||||
def json_to_xml(path, value, parent):
|
||||
|
|
|
@ -212,7 +212,7 @@ class Demand(models.Model):
|
|||
|
||||
def save(self, *args, **kwargs):
|
||||
self.demand_id = '%s-%s' % (self.num, self.flow_type)
|
||||
super(Demand, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
|
@ -38,10 +38,10 @@ class ElementFactory(etree.Element):
|
|||
text = kwargs.pop('text', None)
|
||||
namespace = kwargs.pop('namespace', None)
|
||||
if namespace:
|
||||
super(ElementFactory, self).__init__(etree.QName(namespace, args[0]), **kwargs)
|
||||
super().__init__(etree.QName(namespace, args[0]), **kwargs)
|
||||
self.namespace = namespace
|
||||
else:
|
||||
super(ElementFactory, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if text:
|
||||
self.text = text
|
||||
|
||||
|
@ -56,11 +56,11 @@ class ElementFactory(etree.Element):
|
|||
if found is not None:
|
||||
return self
|
||||
|
||||
super(ElementFactory, self).append(element)
|
||||
super().append(element)
|
||||
return self
|
||||
|
||||
def extend(self, elements):
|
||||
super(ElementFactory, self).extend(elements)
|
||||
super().extend(elements)
|
||||
return self
|
||||
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ class ElementFactory(etree.Element):
|
|||
self.text = kwargs.pop('text', None)
|
||||
namespace = kwargs.pop('namespace', None)
|
||||
if namespace:
|
||||
super(ElementFactory, self).__init__(etree.QName(namespace, args[0]), **kwargs)
|
||||
super().__init__(etree.QName(namespace, args[0]), **kwargs)
|
||||
self.namespace = namespace
|
||||
else:
|
||||
super(ElementFactory, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def append(self, element, allow_new=True):
|
||||
|
||||
|
@ -54,11 +54,11 @@ class ElementFactory(etree.Element):
|
|||
if found is not None:
|
||||
return self
|
||||
|
||||
super(ElementFactory, self).append(element)
|
||||
super().append(element)
|
||||
return self
|
||||
|
||||
def extend(self, elements):
|
||||
super(ElementFactory, self).extend(elements)
|
||||
super().extend(elements)
|
||||
return self
|
||||
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class OpenDataSoft(BaseResource):
|
|||
verbose_name = _('OpenDataSoft Web Service')
|
||||
|
||||
def export_json(self):
|
||||
data = super(OpenDataSoft, self).export_json()
|
||||
data = super().export_json()
|
||||
data['queries'] = [query.export_json() for query in self.queries.all()]
|
||||
return data
|
||||
|
||||
|
@ -201,7 +201,7 @@ class Query(BaseQuery):
|
|||
)
|
||||
|
||||
def as_endpoint(self):
|
||||
endpoint = super(Query, self).as_endpoint(path=self.resource.q.endpoint_info.name)
|
||||
endpoint = super().as_endpoint(path=self.resource.q.endpoint_info.name)
|
||||
|
||||
search_endpoint = self.resource.search.endpoint_info
|
||||
endpoint.func = search_endpoint.func
|
||||
|
|
|
@ -28,7 +28,7 @@ class QueryNew(ResourceChildViewMixin, CreateView):
|
|||
template_name = "passerelle/manage/resource_child_form.html"
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(QueryNew, self).get_form_kwargs()
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs['instance'] = self.model(resource=self.resource)
|
||||
return kwargs
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ class OpenGIS(BaseResource):
|
|||
return query.q(request, bbox, q, circle, **kwargs)
|
||||
|
||||
def export_json(self):
|
||||
d = super(OpenGIS, self).export_json()
|
||||
d = super().export_json()
|
||||
d['queries'] = [query.export_json() for query in self.queries.all()]
|
||||
return d
|
||||
|
||||
|
@ -457,7 +457,7 @@ class OpenGIS(BaseResource):
|
|||
return instance
|
||||
|
||||
def daily(self):
|
||||
super(OpenGIS, self).daily()
|
||||
super().daily()
|
||||
self.update_queries()
|
||||
|
||||
def update_queries(self, query_id=None):
|
||||
|
@ -474,7 +474,7 @@ class OpenGIS(BaseResource):
|
|||
return reverse('opengis-query-new', kwargs={'slug': self.slug})
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super(OpenGIS, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
if self.queries.exists():
|
||||
self.add_job('update_queries')
|
||||
|
||||
|
@ -498,7 +498,7 @@ class Query(BaseQuery):
|
|||
|
||||
def as_endpoint(self):
|
||||
resource_endpoint = self.resource.query.endpoint_info
|
||||
endpoint = super(Query, self).as_endpoint(path=resource_endpoint.name)
|
||||
endpoint = super().as_endpoint(path=resource_endpoint.name)
|
||||
# use parameters added by resource endpoint
|
||||
endpoint.func = resource_endpoint.func
|
||||
endpoint.show_undocumented_params = False
|
||||
|
@ -687,7 +687,7 @@ class Query(BaseQuery):
|
|||
FeatureCache.objects.bulk_create(features)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super(Query, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
self.resource.add_job('update_queries', query_id=self.pk)
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class QueryNew(QueryMixin, ResourceChildViewMixin, CreateView):
|
|||
return context
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(QueryNew, self).get_form_kwargs()
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs['instance'] = self.model(resource=self.resource)
|
||||
return kwargs
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ class PhoneCalls(BaseResource):
|
|||
}
|
||||
|
||||
def hourly(self):
|
||||
super(PhoneCalls, self).hourly()
|
||||
super().hourly()
|
||||
# close unfinished long calls
|
||||
maximal_time = now() - timedelta(minutes=self.max_call_duration)
|
||||
Call.objects.filter(resource=self, end_timestamp=None, start_timestamp__lt=maximal_time).update(
|
||||
|
@ -138,7 +138,7 @@ class PhoneCalls(BaseResource):
|
|||
)
|
||||
|
||||
def daily(self):
|
||||
super(PhoneCalls, self).daily()
|
||||
super().daily()
|
||||
# remove finished old calls
|
||||
maximal_time = now() - timedelta(days=self.data_retention_period)
|
||||
Call.objects.filter(
|
||||
|
|
|
@ -72,7 +72,7 @@ class PloneRestApi(BaseResource, HTTPResource):
|
|||
verbose_name = _('Plone REST API Web Service')
|
||||
|
||||
def export_json(self):
|
||||
data = super(PloneRestApi, self).export_json()
|
||||
data = super().export_json()
|
||||
data['queries'] = [query.export_json() for query in self.queries.all()]
|
||||
return data
|
||||
|
||||
|
@ -431,7 +431,7 @@ class Query(BaseQuery):
|
|||
)
|
||||
|
||||
def as_endpoint(self):
|
||||
endpoint = super(Query, self).as_endpoint(path=self.resource.q.endpoint_info.name)
|
||||
endpoint = super().as_endpoint(path=self.resource.q.endpoint_info.name)
|
||||
|
||||
search_endpoint = self.resource.search.endpoint_info
|
||||
endpoint.func = search_endpoint.func
|
||||
|
|
|
@ -28,7 +28,7 @@ class QueryNew(ResourceChildViewMixin, CreateView):
|
|||
template_name = "passerelle/manage/resource_child_form.html"
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(QueryNew, self).get_form_kwargs()
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs['instance'] = self.model(resource=self.resource)
|
||||
return kwargs
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class VariableAndExpressionWidget(forms.MultiWidget):
|
|||
forms.Select,
|
||||
forms.TextInput,
|
||||
]
|
||||
super(VariableAndExpressionWidget, self).__init__(widgets=widgets, **kwargs)
|
||||
super().__init__(widgets=widgets, **kwargs)
|
||||
|
||||
def decompress(self, value):
|
||||
if not value:
|
||||
|
@ -58,7 +58,7 @@ class VariableAndExpressionField(forms.MultiValueField):
|
|||
forms.ChoiceField(choices=choices, required=required),
|
||||
forms.CharField(required=False, validators=[validate_django_template]),
|
||||
]
|
||||
super(VariableAndExpressionField, self).__init__(
|
||||
super().__init__(
|
||||
fields=fields,
|
||||
required=required,
|
||||
widget=widget,
|
||||
|
|
|
@ -21,7 +21,7 @@ from . import fields, models
|
|||
|
||||
class MappingForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MappingForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if self.instance.procedure and self.instance and self.instance.formdef:
|
||||
choices = [('', '--------')] + [(v, v) for v in self.instance.variables]
|
||||
for i, field in enumerate(self.schema_fields()):
|
||||
|
@ -56,7 +56,7 @@ class MappingForm(forms.ModelForm):
|
|||
value['label'] = self.fields[key].label
|
||||
fields[real_key] = value
|
||||
self.instance.rules['fields'] = fields
|
||||
return super(MappingForm, self).save(commit=commit)
|
||||
return super().save(commit=commit)
|
||||
|
||||
class Meta:
|
||||
model = models.Mapping
|
||||
|
|
|
@ -690,7 +690,7 @@ class Request(models.Model):
|
|||
self.archive.delete()
|
||||
except Exception:
|
||||
self.resource.logger.error('could not delete %s', self.archive)
|
||||
return super(Request, self).delete(*args, **kwargs)
|
||||
return super().delete(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def message_xml(self):
|
||||
|
|
|
@ -29,12 +29,12 @@ class StayIfChanged(object):
|
|||
def form_valid(self, form):
|
||||
if set(form.changed_data) & set(['procedure', 'formdef']):
|
||||
self.has_changed = True
|
||||
return super(StayIfChanged, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
if self.has_changed:
|
||||
return self.get_changed_url()
|
||||
return super(StayIfChanged, self).get_success_url()
|
||||
return super().get_success_url()
|
||||
|
||||
def get_changed_url(self):
|
||||
return ''
|
||||
|
@ -46,7 +46,7 @@ class MappingNew(StayIfChanged, ResourceChildViewMixin, CreateView):
|
|||
|
||||
def form_valid(self, form):
|
||||
form.instance.resource = self.resource
|
||||
return super(MappingNew, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_changed_url(self):
|
||||
return self.object.get_absolute_url()
|
||||
|
|
|
@ -38,7 +38,7 @@ class ResourceChildViewMixin(object):
|
|||
return self.resource_class.objects.get(slug=self.kwargs['slug'])
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super(ResourceChildViewMixin, self).get_queryset()
|
||||
qs = super().get_queryset()
|
||||
return qs.filter(resource=self.resource)
|
||||
|
||||
def get_success_url(self):
|
||||
|
|
|
@ -162,7 +162,7 @@ class BaseResource(models.Model):
|
|||
pass
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(BaseResource, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.logger = ProxyLogger(connector=self, transaction_id=str(uuid.uuid4()))
|
||||
|
||||
def __str__(self):
|
||||
|
@ -767,7 +767,7 @@ class AvailabilityParameters(models.Model):
|
|||
class SkipJob(Exception):
|
||||
def __init__(self, after_timestamp=None):
|
||||
self.after_timestamp = after_timestamp
|
||||
super(SkipJob, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
|
||||
class Job(models.Model):
|
||||
|
|
|
@ -51,7 +51,7 @@ class ResourceView(DetailView):
|
|||
raise PermissionDenied
|
||||
|
||||
def get_context_data(self, slug=None, **kwargs):
|
||||
context = super(ResourceView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['site_base_uri'] = '%s://%s' % (
|
||||
'https' if self.request.is_secure() else 'http',
|
||||
self.request.get_host(),
|
||||
|
@ -93,7 +93,7 @@ class ApiUserListView(ListView):
|
|||
ordering = 'id'
|
||||
|
||||
def get_context_data(self, slug=None, **kwargs):
|
||||
context = super(ApiUserListView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['trusted_services'] = get_trusted_services()
|
||||
return context
|
||||
|
||||
|
@ -103,7 +103,7 @@ class AccessRightDeleteView(DeleteView):
|
|||
template_name = 'passerelle/manage/accessright_confirm_delete.html'
|
||||
|
||||
def get_object(self):
|
||||
object = super(AccessRightDeleteView, self).get_object()
|
||||
object = super().get_object()
|
||||
self.resource = object.resource
|
||||
return object
|
||||
|
||||
|
@ -127,7 +127,7 @@ class AccessRightCreateView(CreateView):
|
|||
if not form.cleaned_data['apiuser'].key and not form.allow_open_access:
|
||||
form.add_confirmation_checkbox()
|
||||
return self.form_invalid(form)
|
||||
return super(AccessRightCreateView, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
return self.object.resource.get_absolute_url()
|
||||
|
@ -137,7 +137,7 @@ class LoggingParametersUpdateView(FormView):
|
|||
template_name = 'passerelle/manage/logging_parameters_form.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(LoggingParametersUpdateView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['connector'] = self.get_resource()
|
||||
return context
|
||||
|
||||
|
@ -182,7 +182,7 @@ class LoggingParametersUpdateView(FormView):
|
|||
parameters.responses_max_size = form.cleaned_data['responses_max_size']
|
||||
parameters.log_retention_days = form.cleaned_data['log_retention_days']
|
||||
parameters.save()
|
||||
return super(LoggingParametersUpdateView, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class ManageAvailabilityView(UpdateView):
|
||||
|
@ -199,7 +199,7 @@ class ManageAvailabilityView(UpdateView):
|
|||
return self.get_resource().availability_parameters
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ManageAvailabilityView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['connector'] = self.get_resource()
|
||||
context['availability_status'] = self.get_resource().get_availability_status()
|
||||
return context
|
||||
|
@ -229,7 +229,7 @@ class ManageAvailabilityView(UpdateView):
|
|||
if form.instance.run_check:
|
||||
resource.availability()
|
||||
|
||||
return super(ManageAvailabilityView, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class GenericViewJobsConnectorView(GenericConnectorMixin, ListView):
|
||||
|
@ -237,7 +237,7 @@ class GenericViewJobsConnectorView(GenericConnectorMixin, ListView):
|
|||
paginate_by = 25
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(GenericViewJobsConnectorView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
connector = self.get_object()
|
||||
context['object'] = connector
|
||||
context['query'] = self.request.GET.get('q') or ''
|
||||
|
@ -299,7 +299,7 @@ class GenericJobView(GenericConnectorMixin, DetailView):
|
|||
template_name = 'passerelle/manage/job.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(GenericJobView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
try:
|
||||
context['job'] = Job.objects.get(pk=self.kwargs['job_pk'])
|
||||
except Job.DoesNotExist:
|
||||
|
@ -343,7 +343,7 @@ class ImportSiteView(FormView):
|
|||
except ImportSiteError as e:
|
||||
form.add_error('site_json', e)
|
||||
return self.form_invalid(form)
|
||||
return super(ImportSiteView, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class ExportSiteView(View):
|
||||
|
|
|
@ -35,7 +35,7 @@ class FakeFamily(BaseResource):
|
|||
def save(self, *args, **kwargs):
|
||||
if not self.jsondatabase:
|
||||
self.jsondatabase = default_database()
|
||||
super(FakeFamily, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def get_verbose_name(cls):
|
||||
|
|
|
@ -118,7 +118,7 @@ class GrandLyonStreetSections(BaseResource):
|
|||
return {'err': 1}
|
||||
|
||||
def daily(self):
|
||||
super(GrandLyonStreetSections, self).daily()
|
||||
super().daily()
|
||||
update_start = timezone.now()
|
||||
sections = self.requests.get(
|
||||
'https://download.data.grandlyon.com/ws/grandlyon/adr_voie_lieu.adraxevoie/all.json?maxfeatures=1000000'
|
||||
|
@ -171,4 +171,4 @@ class StreetSection(models.Model):
|
|||
def save(self, *args, **kwargs):
|
||||
if self.nom:
|
||||
self.normalized_name = normalize_street(self.nom)
|
||||
return super(StreetSection, self).save(*args, **kwargs)
|
||||
return super().save(*args, **kwargs)
|
||||
|
|
|
@ -103,7 +103,7 @@ class IntegrationView(View, SingleObjectMixin):
|
|||
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(IntegrationView, self).dispatch(request, *args, **kwargs)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
@utils.protected_api('can_access')
|
||||
@utils.to_json()
|
||||
|
|
|
@ -122,7 +122,7 @@ class Tcl(BaseResource):
|
|||
self.stop(None, stop_object.id)
|
||||
|
||||
def daily(self):
|
||||
super(Tcl, self).daily()
|
||||
super().daily()
|
||||
start_update = timezone.now()
|
||||
|
||||
with transaction.atomic():
|
||||
|
@ -255,7 +255,7 @@ class Line(models.Model):
|
|||
else:
|
||||
raise Exception('unknown TCL line %r' % self.code_titan)
|
||||
|
||||
return super(Line, self).save(*args, **kwargs)
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class Stop(models.Model):
|
||||
|
|
|
@ -113,7 +113,7 @@ class AxelError(Exception):
|
|||
self.message = message
|
||||
self.xml_request = xml_request
|
||||
self.xml_response = xml_response
|
||||
super(AxelError, self).__init__(message, *args)
|
||||
super().__init__(message, *args)
|
||||
|
||||
def __str__(self):
|
||||
return self.message
|
||||
|
|
|
@ -23,7 +23,7 @@ class GenericConnectorForm(forms.ModelForm):
|
|||
def save(self, commit=True):
|
||||
if not self.instance.slug:
|
||||
self.instance.slug = slugify(self.instance.title)
|
||||
return super(GenericConnectorForm, self).save(commit=commit)
|
||||
return super().save(commit=commit)
|
||||
|
||||
|
||||
class ResourceLogSearchForm(forms.Form):
|
||||
|
|
|
@ -29,7 +29,7 @@ class SMSConnectorForm(GenericConnectorForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
from passerelle.sms.models import SMSResource
|
||||
|
||||
super(SMSConnectorForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['authorized'] = forms.MultipleChoiceField(
|
||||
choices=SMSResource.AUTHORIZED,
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
|
|
|
@ -131,7 +131,7 @@ class SMSResource(BaseResource):
|
|||
return ', '.join(result)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SMSResource, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.get_authorized_display = self._get_authorized_display
|
||||
|
||||
def clean_numbers(self, destinations):
|
||||
|
|
|
@ -43,7 +43,7 @@ class SmsTestSendView(GenericConnectorMixin, FormView):
|
|||
messages.error(self.request, _('Sending SMS fails: %s' % exc))
|
||||
else:
|
||||
messages.success(self.request, _('An SMS was just sent'))
|
||||
return super(SmsTestSendView, self).form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class SmsStatisticsView(View):
|
||||
|
|
|
@ -20,7 +20,7 @@ from passerelle.utils import is_trusted
|
|||
|
||||
class DecoratedURLPattern(URLPattern):
|
||||
def resolve(self, *args, **kwargs):
|
||||
result = super(DecoratedURLPattern, self).resolve(*args, **kwargs)
|
||||
result = super().resolve(*args, **kwargs)
|
||||
if result:
|
||||
result.func = self._decorate_with(result.func)
|
||||
return result
|
||||
|
@ -28,7 +28,7 @@ class DecoratedURLPattern(URLPattern):
|
|||
|
||||
class DecoratedURLResolver(URLResolver):
|
||||
def resolve(self, *args, **kwargs):
|
||||
result = super(DecoratedURLResolver, self).resolve(*args, **kwargs)
|
||||
result = super().resolve(*args, **kwargs)
|
||||
if result:
|
||||
result.func = self._decorate_with(result.func)
|
||||
return result
|
||||
|
|
|
@ -258,7 +258,7 @@ class Request(RequestSession):
|
|||
self.logger = kwargs.pop('logger')
|
||||
self.resource = kwargs.pop('resource', None)
|
||||
timeout = kwargs.pop('timeout', None)
|
||||
super(Request, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if self.resource:
|
||||
timeout = timeout if timeout is not None else getattr(self.resource, 'requests_timeout', None)
|
||||
http_adapter_init_kwargs = {}
|
||||
|
@ -321,7 +321,7 @@ class Request(RequestSession):
|
|||
if kwargs.get('verify') is False:
|
||||
# disable urllib3 warnings
|
||||
warnings.simplefilter(action='ignore', category=InsecureRequestWarning)
|
||||
response = super(Request, self).request(method, url, **kwargs)
|
||||
response = super().request(method, url, **kwargs)
|
||||
|
||||
if method == 'GET' and cache_duration and (response.status_code // 100 == 2):
|
||||
cache.set(
|
||||
|
@ -339,7 +339,7 @@ class Request(RequestSession):
|
|||
def send(self, request, **kwargs):
|
||||
start_time = time.time()
|
||||
try:
|
||||
response = super(Request, self).send(request, **kwargs)
|
||||
response = super().send(request, **kwargs)
|
||||
duration = time.time() - start_time
|
||||
except Exception as exc:
|
||||
duration = time.time() - start_time
|
||||
|
|
|
@ -37,14 +37,14 @@ class APIError(RuntimeError):
|
|||
self.log_error = kwargs.pop('log_error', False)
|
||||
self.http_status = kwargs.pop('http_status', 200)
|
||||
self.__dict__.update(kwargs)
|
||||
super(APIError, self).__init__(*args)
|
||||
super().__init__(*args)
|
||||
|
||||
|
||||
class JSONEncoder(DjangoJSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, time.struct_time):
|
||||
o = datetime.datetime(*tuple(o)[:6])
|
||||
return super(JSONEncoder, self).default(o)
|
||||
return super().default(o)
|
||||
|
||||
|
||||
class to_json(object):
|
||||
|
|
|
@ -155,7 +155,7 @@ class SFTPWidget(forms.MultiWidget):
|
|||
forms.Textarea,
|
||||
forms.TextInput,
|
||||
]
|
||||
super(SFTPWidget, self).__init__(widgets=widgets, **kwargs)
|
||||
super().__init__(widgets=widgets, **kwargs)
|
||||
|
||||
def decompress(self, value):
|
||||
if not value:
|
||||
|
@ -186,7 +186,7 @@ class SFTPFormField(forms.MultiValueField):
|
|||
forms.CharField(required=False),
|
||||
forms.CharField(required=False),
|
||||
]
|
||||
super(SFTPFormField, self).__init__(fields=fields, require_all_fields=False, **kwargs)
|
||||
super().__init__(fields=fields, require_all_fields=False, **kwargs)
|
||||
|
||||
def compress(self, data_list):
|
||||
if not data_list:
|
||||
|
@ -211,7 +211,7 @@ class SFTPField(models.Field):
|
|||
|
||||
def __init__(self, **kwargs):
|
||||
kwargs.setdefault('default', None)
|
||||
super(SFTPField, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def get_internal_type(self):
|
||||
return 'TextField'
|
||||
|
@ -236,4 +236,4 @@ class SFTPField(models.Field):
|
|||
'form_class': SFTPFormField,
|
||||
}
|
||||
defaults.update(**kwargs)
|
||||
return super(SFTPField, self).formfield(**defaults)
|
||||
return super().formfield(**defaults)
|
||||
|
|
|
@ -40,7 +40,7 @@ class SOAPClient(Client):
|
|||
transport = transport_class(
|
||||
resource, wsdl_url, session=resource.requests, cache=InMemoryCache(), **transport_kwargs
|
||||
)
|
||||
super(SOAPClient, self).__init__(wsdl_url, transport=transport, **kwargs)
|
||||
super().__init__(wsdl_url, transport=transport, **kwargs)
|
||||
|
||||
|
||||
class ResponseFixContentWrapper:
|
||||
|
@ -74,7 +74,7 @@ class SOAPTransport(Transport):
|
|||
self.wsdl_host = urlparse.urlparse(wsdl_url).netloc
|
||||
# fix content for servers returning unexpected characters before XML document start
|
||||
self.remove_first_bytes_for_xml = remove_first_bytes_for_xml
|
||||
super(SOAPTransport, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def _load_remote_data(self, url):
|
||||
try:
|
||||
|
@ -82,7 +82,7 @@ class SOAPTransport(Transport):
|
|||
response = self.session.get(url, timeout=self.load_timeout, auth=None, cert=None)
|
||||
response.raise_for_status()
|
||||
return response.content
|
||||
return super(SOAPTransport, self)._load_remote_data(url)
|
||||
return super()._load_remote_data(url)
|
||||
except RequestException as e:
|
||||
raise SOAPError(
|
||||
'SOAP service is down, location %r cannot be loaded: %s' % (url, e), exception=e, url=url
|
||||
|
|
|
@ -87,7 +87,7 @@ class FormDataWorkflow(BaseObject):
|
|||
fields = None
|
||||
|
||||
def __init__(self, wcs_api, **kwargs):
|
||||
super(FormDataWorkflow, self).__init__(wcs_api, **kwargs)
|
||||
super().__init__(wcs_api, **kwargs)
|
||||
if self.status is not None:
|
||||
self.status = BaseObject(wcs_api, **self.status)
|
||||
self.fields = self.fields or {}
|
||||
|
@ -106,7 +106,7 @@ class Evolution(BaseObject):
|
|||
parts = None
|
||||
|
||||
def __init__(self, wcs_api, **kwargs):
|
||||
super(Evolution, self).__init__(wcs_api, **kwargs)
|
||||
super().__init__(wcs_api, **kwargs)
|
||||
self.time = isodate.parse_datetime(self.time)
|
||||
if self.parts:
|
||||
self.parts = [BaseObject(wcs_api, **part) for part in self.parts]
|
||||
|
@ -125,7 +125,7 @@ class FormData(BaseObject):
|
|||
|
||||
def __init__(self, wcs_api, forms, **kwargs):
|
||||
self.forms = forms
|
||||
super(FormData, self).__init__(wcs_api, **kwargs)
|
||||
super().__init__(wcs_api, **kwargs)
|
||||
self.receipt_time = isodate.parse_datetime(self.receipt_time)
|
||||
if self.submissions:
|
||||
self.submission = BaseObject(wcs_api, **self.submission)
|
||||
|
@ -198,7 +198,7 @@ class Workflow(BaseObject):
|
|||
fields = None
|
||||
|
||||
def __init__(self, wcs_api, **kwargs):
|
||||
super(Workflow, self).__init__(wcs_api, **kwargs)
|
||||
super().__init__(wcs_api, **kwargs)
|
||||
self.statuses = [BaseObject(wcs_api, **v) for v in (self.statuses or [])]
|
||||
assert not hasattr(self.statuses[0], 'startpoint'), 'startpoint is exported by w.c.s. FIXME'
|
||||
for status in self.statuses:
|
||||
|
@ -222,7 +222,7 @@ class Schema(BaseObject):
|
|||
geolocations = None
|
||||
|
||||
def __init__(self, wcs_api, **kwargs):
|
||||
super(Schema, self).__init__(wcs_api, **kwargs)
|
||||
super().__init__(wcs_api, **kwargs)
|
||||
self.workflow = Workflow(wcs_api, **self.workflow)
|
||||
self.fields = [Field(wcs_api, **f) for f in self.fields]
|
||||
self.geolocations = sorted((k, v) for k, v in (self.geolocations or {}).items())
|
||||
|
@ -691,7 +691,7 @@ class FormDefRef(object):
|
|||
|
||||
class FormDefFormField(forms.TypedChoiceField):
|
||||
def __init__(self, **kwargs):
|
||||
super(FormDefFormField, self).__init__(choices=self.get_formdef_choices, coerce=FormDefRef, **kwargs)
|
||||
super().__init__(choices=self.get_formdef_choices, coerce=FormDefRef, **kwargs)
|
||||
|
||||
def get_formdef_choices(self):
|
||||
requests = getattr(self, 'requests', None)
|
||||
|
@ -722,4 +722,4 @@ class FormDefField(models.Field):
|
|||
'form_class': FormDefFormField,
|
||||
}
|
||||
defaults.update(kwargs)
|
||||
return super(FormDefField, self).formfield(**defaults)
|
||||
return super().formfield(**defaults)
|
||||
|
|
|
@ -105,11 +105,11 @@ def to_json(root):
|
|||
class TransformConverter(xmlschema.UnorderedConverter):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.transformer = kwargs.pop('transformer', None)
|
||||
super(TransformConverter, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def copy(self, **kwargs):
|
||||
transformer = kwargs.pop('transformer', self.transformer)
|
||||
new = super(TransformConverter, self).copy(**kwargs)
|
||||
new = super().copy(**kwargs)
|
||||
new.transformer = transformer
|
||||
return new
|
||||
|
||||
|
@ -119,7 +119,7 @@ class TransformConverter(xmlschema.UnorderedConverter):
|
|||
mapped = self.transformer.type_map[xsd_element.type.name]
|
||||
if hasattr(self.transformer, 'decode_%s' % mapped):
|
||||
data = getattr(self.transformer, 'decode_%s' % mapped)(data)
|
||||
return super(TransformConverter, self).element_decode(data, xsd_element, *args)
|
||||
return super().element_decode(data, xsd_element, *args)
|
||||
|
||||
def element_encode(self, obj, xsd_element, *args):
|
||||
if self.transformer:
|
||||
|
@ -127,7 +127,7 @@ class TransformConverter(xmlschema.UnorderedConverter):
|
|||
mapped = self.transformer.type_map[xsd_element.type.name]
|
||||
if hasattr(self.transformer, 'encode_%s' % mapped):
|
||||
obj = getattr(self.transformer, 'encode_%s' % mapped)(obj)
|
||||
return super(TransformConverter, self).element_encode(obj, xsd_element, *args)
|
||||
return super().element_encode(obj, xsd_element, *args)
|
||||
|
||||
|
||||
class JSONSchemaFromXMLSchema(object):
|
||||
|
|
|
@ -82,7 +82,7 @@ class LoginView(auth_views.LoginView):
|
|||
return HttpResponseRedirect(
|
||||
resolve_url('mellon_login') + '?next=' + quote(request.GET.get('next'))
|
||||
)
|
||||
return super(LoginView, self).dispatch(request, *args, **kwargs)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
login = LoginView.as_view()
|
||||
|
@ -130,7 +130,7 @@ class ManageView(TemplateView):
|
|||
template_name = 'passerelle/manage.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ManageView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
# get all app instances
|
||||
context['apps'] = []
|
||||
for app in get_all_apps():
|
||||
|
@ -143,7 +143,7 @@ class ManageAddView(TemplateView):
|
|||
template_name = 'passerelle/manage_add.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ManageAddView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['apps'] = [x for x in get_all_apps() if not x.is_legacy()]
|
||||
context['apps'].sort(key=lambda x: x.get_verbose_name())
|
||||
return context
|
||||
|
@ -172,12 +172,12 @@ class GenericConnectorMixin(object):
|
|||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.init_stuff(request, *args, **kwargs)
|
||||
return super(GenericConnectorMixin, self).dispatch(request, *args, **kwargs)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class GenericConnectorView(GenericConnectorMixin, DetailView):
|
||||
def get_context_data(self, slug=None, **kwargs):
|
||||
context = super(GenericConnectorView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['has_check_status'] = not hasattr(context['object'].check_status, 'not_implemented')
|
||||
return context
|
||||
|
||||
|
@ -195,12 +195,12 @@ class GenericCreateConnectorView(GenericConnectorMixin, CreateView):
|
|||
|
||||
def form_valid(self, form):
|
||||
with transaction.atomic():
|
||||
response = super(GenericCreateConnectorView, self).form_valid(form)
|
||||
response = super().form_valid(form)
|
||||
self.object.availability()
|
||||
return response
|
||||
|
||||
def init_stuff(self, request, *args, **kwargs):
|
||||
super(GenericCreateConnectorView, self).init_stuff(request, *args, **kwargs)
|
||||
super().init_stuff(request, *args, **kwargs)
|
||||
# tell JS to prepopulate 'slug' field using the 'title' field
|
||||
self.get_form_class().base_fields['title'].widget.attrs['data-slug-sync'] = 'slug'
|
||||
|
||||
|
@ -210,7 +210,7 @@ class GenericEditConnectorView(GenericConnectorMixin, UpdateView):
|
|||
|
||||
def form_valid(self, form):
|
||||
with transaction.atomic():
|
||||
response = super(GenericEditConnectorView, self).form_valid(form)
|
||||
response = super().form_valid(form)
|
||||
self.object.availability()
|
||||
return response
|
||||
|
||||
|
@ -228,7 +228,7 @@ class GenericViewLogsConnectorView(GenericConnectorMixin, ListView):
|
|||
paginator_class = InfinitePaginator
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(GenericViewLogsConnectorView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['object'] = self.get_object()
|
||||
context['form'] = self.form
|
||||
if self.request.GET.get('log_id'):
|
||||
|
@ -287,7 +287,7 @@ class GenericLogView(GenericConnectorMixin, DetailView):
|
|||
template_name = 'passerelle/manage/log.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(GenericLogView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
try:
|
||||
context['logline'] = ResourceLog.objects.get(
|
||||
pk=self.kwargs['log_pk'], appname=self.kwargs['connector'], slug=self.kwargs['slug']
|
||||
|
@ -445,7 +445,7 @@ class GenericEndpointView(GenericConnectorMixin, SingleObjectMixin, View):
|
|||
if kwargs.get('endpoint') == 'up' and hasattr(self.connector.check_status, 'not_implemented'):
|
||||
# hide automatic up endpoint if check_status method is not implemented
|
||||
raise Http404()
|
||||
return super(GenericEndpointView, self).dispatch(request, *args, **kwargs)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def _allowed_methods(self):
|
||||
return [x.upper() for x in self.endpoint.endpoint_info.methods]
|
||||
|
|
|
@ -75,7 +75,7 @@ def dpark(db):
|
|||
class ReplyDataClass(dict):
|
||||
def __init__(self, **kwargs):
|
||||
self.__dict__.update(kwargs)
|
||||
super(ReplyDataClass, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class WebFaultHavingLatin1(WebFault):
|
||||
|
|
|
@ -371,7 +371,7 @@ class FakeJSONConnector(object):
|
|||
BAR_SCHEMA = copy.deepcopy(FOO_SCHEMA)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FakeJSONConnector, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.logger = ProxyLogger(connector=self)
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in New Issue