Commit c6adb253 authored by Noé Gaumont's avatar Noé Gaumont 🐙
Browse files

feat: drop python2

--HG--
branch : seda21
parent 8247a8602fa1
Pipeline #71549 failed with stages
in 4 minutes and 33 seconds
......@@ -14,8 +14,7 @@ description = 'Data Exchange Standard for Archival'
web = 'http://www.cubicweb.org/project/%s' % distname
__depends__ = {
'cubicweb': '>= 3.25.4, < 3.27',
'six': '>= 1.4.0',
'cubicweb': '>= 3.26',
'cubicweb-eac': '>= 0.8.3, < 0.9.0',
'cubicweb-skos': '>= 1.6.0',
'cubicweb-compound': '>= 0.7',
......@@ -29,6 +28,7 @@ __recommends__ = {}
classifiers = [
'Environment :: Web Environment',
'Framework :: CubicWeb',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: JavaScript',
]
......@@ -22,8 +22,6 @@ import io
from itertools import count
from os.path import abspath, dirname, join
from six import text_type
from cubicweb.server.checkintegrity import reindex_entities
from cubicweb.dataimport.stores import NoHookRQLObjectStore
from cubicweb.dataimport.importer import (
......@@ -123,12 +121,12 @@ def lcsv_check(cnx, store, fname, scheme_uri, separator=';', **kwargs):
counter = count()
def uri_generator(val):
return text_type(next(counter)) + val
return str(next(counter)) + val
with io.open(join(dirname(__file__), 'migration', 'data', fname), 'rb') as stream:
lcsv2rdf = lcsv.LCSV2RDF(stream, separator, 'utf-8',
# XXX drop once skos is released
uri_generator=uri_generator, uri_cls=text_type)
uri_generator=uri_generator, uri_cls=str)
list(lcsv2rdf.triples())
# also check there are the expected number of separator for each line
......
......@@ -15,8 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-seda adapter classes for generation of a profile generation as HTML"""
from six import string_types
from cubicweb import _
from .profile_generation import SEDA2ExportAdapter, content_types
......@@ -191,7 +189,7 @@ class SEDA2HTMLExport(SEDA2ExportAdapter):
self.element('span', div, text=occ.target.local_name, attributes={'class': 'label'})
self.element('span', div, text=card, attributes={'class': 'card'})
fixed_value = self.serialize(target_value)
if isinstance(fixed_value, string_types):
if isinstance(fixed_value, str):
self.element('span', div, text=fixed_value, attributes={'class': 'value'})
else:
span = self.element('span', div, attributes={'class': 'value'})
......@@ -253,7 +251,7 @@ class SEDA2HTMLExport(SEDA2ExportAdapter):
value_div = self.element('div', div)
self.element('span', value_div, text=self._cw._('fixed value'),
attributes={'class': 'label'})
if isinstance(fixed_value, string_types):
if isinstance(fixed_value, str):
self.element('span', value_div, text=fixed_value, attributes={'class': 'value'})
else:
span = self.element('span', value_div, attributes={'class': 'value'})
......@@ -296,5 +294,5 @@ class SEDA2HTMLExport(SEDA2ExportAdapter):
else:
if isinstance(value, bool):
value = 'true' if value else 'false'
assert isinstance(value, string_types), repr(value)
assert isinstance(value, str), repr(value)
return value
......@@ -19,8 +19,6 @@ from collections import defaultdict, namedtuple
from functools import partial
from itertools import chain
from six import text_type, string_types
from lxml import etree
from pyxst.xml_struct import graph_nodes
......@@ -119,8 +117,8 @@ def serialize(value, build_url):
return None # intermediary entity
if isinstance(value, bool):
return 'true' if value else 'false'
assert isinstance(value, string_types), repr(value)
return text_type(value)
assert isinstance(value, str), repr(value)
return value
def integrity_cardinality(data_object):
......@@ -749,9 +747,9 @@ class SEDA1XSDExport(SEDA2ExportAdapter):
if extra_attributes is not None:
attributes.update(extra_attributes)
if fixed_value is not None:
attributes['fixed'] = text_type(fixed_value)
attributes['fixed'] = str(fixed_value)
elif default_value is not None:
attributes['default'] = text_type(default_value)
attributes['default'] = str(default_value)
if xsd_type is not None and not xsd_attributes:
attributes['type'] = xsd_type
assert cardinality in ('0..1', '0..n', '1', '1..n')
......@@ -785,8 +783,8 @@ class SEDA1XSDExport(SEDA2ExportAdapter):
attrs['use'] = 'optional'
if not isinstance(xattr.fixed_value, (tuple, list)):
attrs['type'] = xattr.qualified_type
if isinstance(xattr.fixed_value, string_types):
attrs['fixed'] = text_type(xattr.fixed_value)
if isinstance(xattr.fixed_value, str):
attrs['fixed'] = xattr.fixed_value
attribute_element = self.element('xsd:attribute', parent, attrs)
if isinstance(xattr.fixed_value, (tuple, list)):
type_element = self.element('xsd:simpleType', attribute_element)
......@@ -1209,7 +1207,7 @@ class SEDA1XSDExport(SEDA2ExportAdapter):
return agency.agency.dc_title() if agency.agency is not None else None
def agency_id(self, agency):
return text_type(agency.agency.eid) if agency.agency is not None else None
return str(agency.agency.eid) if agency.agency is not None else None
def archive_unit_content(self, archive_unit):
return archive_unit.first_level_choice.content_sequence
......
......@@ -15,8 +15,6 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-seda views for ArchiveUnit"""
from six import text_type
from logilab.mtconverter import xml_escape
from logilab.common.registry import objectify_predicate
from logilab.common.decorators import monkeypatch
......@@ -1025,7 +1023,7 @@ class SimplifiedArchiveUnitDataObjectReferencesTab(ArchiveUnitDataObjectReferenc
def display_add_button(self, entity):
rtype_roles = [(rtype, role) for rtype, role, _ in self.rtype_role_targets]
params = self.url_params(entity)
params['referenced_by'] = text_type(entity.eid)
params['referenced_by'] = str(entity.eid)
transfer = entity.container[0]
links = []
if transfer.cw_etype == 'SEDAArchiveTransfer':
......
......@@ -17,8 +17,6 @@
import json
from six import text_type
from logilab.mtconverter import xml_escape
from cubicweb import tags, view, _
......@@ -86,7 +84,7 @@ class ContainedRelationFacetWidget(rwdg.RelationFacetWidget):
_, container = parent_and_container(entity)
assert container is not None
# and put it as an extra url param
url_params['container'] = text_type(container.eid)
url_params['container'] = str(container.eid)
return super(ContainedRelationFacetWidget, self).trigger_search_url(entity, url_params)
......
......@@ -17,8 +17,6 @@
import json
from six import text_type
from logilab.mtconverter import xml_escape
from cubicweb.predicates import is_instance
......@@ -66,7 +64,7 @@ def _rule_ref_vocabulary(container, parent_etype):
rset = req.execute(rql, {'rt': 'seda_rule', 'et': etype})
if rset:
return ([(req._('<no value specified>'), INTERNAL_FIELD_VALUE)]
+ sorted([(concept.label(), text_type(concept.eid))
+ sorted([(concept.label(), str(concept.eid))
for concept in rset.entities()]))
else:
scheme_relation = 'seda_{0}_rule_code_list_version_from_object'.format(rule_type)
......
......@@ -15,8 +15,6 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-seda custom fields/widgets"""
from six import text_type
from logilab.common.decorators import monkeypatch
from cubicweb import tags, utils
......@@ -199,7 +197,7 @@ class ConceptAutoCompleteWidget(fw.TextInput):
eid = u''
else:
value = concept.label()
eid = text_type(concept.eid)
eid = str(concept.eid)
# we need an hidden input to handle the value while the text input display the label
inputs = [
tags.input(name=field.input_name(form, 'Label'), id=slave_id + 'Label',
......@@ -267,7 +265,7 @@ class SEDAMetaField(ff.StringField):
else:
hidden = ' hidden'
icon = 'icon-list-add'
wdgs.append(tags.a(u'', onclick=text_type(js.seda.toggleFormMetaVisibility(divid)),
wdgs.append(tags.a(u'', onclick=str(js.seda.toggleFormMetaVisibility(divid)),
href='javascript:$.noop()', title=form._cw._('show/hide meta fields'),
# take care, related js relies on the icon class position
klass=icon + ' metaFieldSwitch'))
......
......@@ -19,8 +19,6 @@ XSD parsing is done using generateDS, which has been copied into the `gends` dir
used bits).
"""
from six import text_type
from cubicweb import neg_role, _
from cubicweb_seda.xsd import XSDM_MAPPING
......@@ -212,7 +210,7 @@ class UICFGGenerator(CodeGenerator):
yield etype, rtype, 'object', mapping.element_name, mapping.desc
class Code(text_type):
class Code(str):
"""Special string subclass whose repr() doesn't add quotes, for insertion of python code in a
data structure
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment