|
16 | 16 | from .resource import Resource, ResourceOpts |
17 | 17 |
|
18 | 18 | from pyff.constants import ATTRS, NF_URI, NS, config |
19 | | -from pyff.exceptions import * |
| 19 | +from pyff.exceptions import MetadataException |
20 | 20 | from pyff.logs import get_log |
21 | 21 | from pyff.parse import ParserInfo, PyffParser, add_parser |
22 | | -from pyff.resource import Resource, ResourceOpts |
23 | 22 | from pyff.utils import ( |
24 | 23 | Lambda, |
25 | 24 | b2u, |
@@ -262,7 +261,7 @@ def _format_key(k: str) -> str: |
262 | 261 | # Turn expiration_time into 'Expiration Time' |
263 | 262 | return k.replace('_', ' ').title() |
264 | 263 |
|
265 | | - res = {_format_key(k): v for k, v in self.dict().items()} |
| 264 | + res = {_format_key(k): v for k, v in self.model_dump().items()} |
266 | 265 | return res |
267 | 266 |
|
268 | 267 |
|
@@ -371,7 +370,7 @@ def filter_invalids_from_document(t: ElementTree, base_url, validation_errors) - |
371 | 370 | xsd = schema() |
372 | 371 | for e in iter_entities(t): |
373 | 372 | if not xsd.validate(e): |
374 | | - error = xml_error(xsd.error_log, m=base_url) |
| 373 | + _error = xml_error(xsd.error_log, m=base_url) |
375 | 374 | entity_id = e.get("entityID", "(Missing entityID)") |
376 | 375 | log.warning('removing \'{}\': schema validation failed: {}'.format(entity_id, xsd.error_log)) |
377 | 376 | validation_errors[entity_id] = f"{xsd.error_log}" |
@@ -703,7 +702,7 @@ def _u(an, values): |
703 | 702 |
|
704 | 703 |
|
705 | 704 | def gen_icon(e): |
706 | | - scopes = entity_scopes(e) |
| 705 | + _scopes = entity_scopes(e) |
707 | 706 |
|
708 | 707 |
|
709 | 708 | def entity_icon_url(e, langs=None): |
@@ -990,7 +989,9 @@ def discojson_sp(e, global_trust_info=None, global_md_sources=None): |
990 | 989 | sp['entityID'] = e.get('entityID', None) |
991 | 990 |
|
992 | 991 | md_sources = e.findall( |
993 | | - "{{{}}}SPSSODescriptor/{{{}}}Extensions/{{{}}}TrustInfo/{{{}}}MetadataSource".format(NS['md'], NS['md'], NS['ti'], NS['ti']) |
| 992 | + "{{{}}}SPSSODescriptor/{{{}}}Extensions/{{{}}}TrustInfo/{{{}}}MetadataSource".format( |
| 993 | + NS['md'], NS['md'], NS['ti'], NS['ti'] |
| 994 | + ) |
994 | 995 | ) |
995 | 996 |
|
996 | 997 | sp['extra_md'] = {} |
@@ -1294,7 +1295,9 @@ def _entity_attributes(e): |
1294 | 1295 |
|
1295 | 1296 | def _eattribute(e, attr, nf): |
1296 | 1297 | ea = _entity_attributes(e) |
1297 | | - a = ea.xpath(".//saml:Attribute[@NameFormat='{}' and @Name='{}']".format(nf, attr), namespaces=NS, smart_strings=False) |
| 1298 | + a = ea.xpath( |
| 1299 | + ".//saml:Attribute[@NameFormat='{}' and @Name='{}']".format(nf, attr), namespaces=NS, smart_strings=False |
| 1300 | + ) |
1298 | 1301 | if a is None or len(a) == 0: |
1299 | 1302 | a = etree.Element("{%s}Attribute" % NS['saml']) |
1300 | 1303 | a.set('NameFormat', nf) |
|
0 commit comments