Commit c763865a authored by Nicola Spanti's avatar Nicola Spanti
Browse files

[py] Make `flake8` happy again

```
./test/test_mappers.py:126:43: E741 ambiguous variable name 'l'
./test/test_mappers.py:134:43: E741 ambiguous variable name 'l'
./cubicweb_jsonschema/mappers/base.py:56:26: E741 ambiguous variable name 'l'
```
parent 769794957cf6
# copyright 2016-2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
# contact https://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
......@@ -12,7 +12,7 @@
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""Base definitions for Yams to JSON Schema mappers."""
import abc
......@@ -52,8 +52,8 @@ def add_links(schema_and_definitions):
def wrapper(self, schema_role=None):
schema, defns = schema_and_definitions(self, schema_role=schema_role)
if self.resource is not None and isinstance(schema, dict):
links = [l.description_object(self.resource)
for l in self.links(schema_role=schema_role)]
links = [link.description_object(self.resource)
for link in self.links(schema_role=schema_role)]
# Sort links to get predictable results.
links.sort(key=lambda l: (l['href'], l.get('rel')))
if links:
......
# copyright 2016-2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
# contact https://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
......@@ -12,7 +12,7 @@
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import base64
from datetime import datetime
......@@ -123,7 +123,7 @@ class JSONSchemaMapperTC(CubicWebTC):
entity_mapper = self.vreg['mappers'].select(
'jsonschema.entity', cnx, etype='Book')
self.assertCountEqual(
[type(l).__name__ for l in entity_mapper.links()],
[type(link).__name__ for link in entity_mapper.links()],
['EntityLink', 'TopicsLink', 'RelationLink'],
)
relation_mapper = self.vreg['mappers'].select(
......@@ -131,7 +131,7 @@ class JSONSchemaMapperTC(CubicWebTC):
rtype='author', role='subject',
)
self.assertEqual(
[type(l).__name__ for l in relation_mapper.links()],
[type(link).__name__ for link in relation_mapper.links()],
['RelationLink'],
)
......
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