|
4 | 4 | from json import dumps |
5 | 5 | from typing import Any, Dict, Generator, Iterable, List, Mapping, Optional, Tuple |
6 | 6 |
|
7 | | -import pkg_resources |
8 | 7 | import pyramid.httpexceptions as exc |
9 | 8 | import pytz |
10 | 9 | import requests |
|
26 | 25 | from pyff.resource import Resource |
27 | 26 | from pyff.samlmd import entity_display_name |
28 | 27 | from pyff.utils import b2u, dumptree, hash_id, json_serializer, utc_now |
| 28 | +from pyff import __version__ |
29 | 29 |
|
30 | 30 | log = get_log(__name__) |
31 | 31 |
|
32 | 32 |
|
33 | 33 | class NoCache(object): |
34 | | - """ Dummy implementation for when caching isn't enabled """ |
| 34 | + """Dummy implementation for when caching isn't enabled""" |
35 | 35 |
|
36 | 36 | def __init__(self) -> None: |
37 | 37 | pass |
@@ -70,7 +70,7 @@ def status_handler(request: Request) -> Response: |
70 | 70 | if 'Validation Errors' in r.info and r.info['Validation Errors']: |
71 | 71 | d[r.url] = r.info['Validation Errors'] |
72 | 72 | _status = dict( |
73 | | - version=pkg_resources.require("pyFF")[0].version, |
| 73 | + version=__version__, |
74 | 74 | invalids=d, |
75 | 75 | icon_store=dict(size=request.registry.md.icon_store.size()), |
76 | 76 | jobs=[dict(id=j.id, next_run_time=j.next_run_time) for j in request.registry.scheduler.get_jobs()], |
@@ -163,7 +163,7 @@ def process_handler(request: Request) -> Response: |
163 | 163 | _ctypes = {'xml': 'application/samlmetadata+xml;application/xml;text/xml', 'json': 'application/json'} |
164 | 164 |
|
165 | 165 | def _d(x: Optional[str], do_split: bool = True) -> Tuple[Optional[str], Optional[str]]: |
166 | | - """ Split a path into a base component and an extension. """ |
| 166 | + """Split a path into a base component and an extension.""" |
167 | 167 | if x is not None: |
168 | 168 | x = x.strip() |
169 | 169 |
|
@@ -214,7 +214,7 @@ def _d(x: Optional[str], do_split: bool = True) -> Tuple[Optional[str], Optional |
214 | 214 | pfx = request.registry.aliases.get(alias, None) |
215 | 215 | if pfx is None: |
216 | 216 | log.debug("alias {} not found - passing to storage lookup".format(alias)) |
217 | | - path=alias #treat as path |
| 217 | + path = alias # treat as path |
218 | 218 |
|
219 | 219 | # content_negotiation_policy is one of three values: |
220 | 220 | # 1. extension - current default, inspect the path and if it ends in |
@@ -478,7 +478,7 @@ def cors_headers(request: Request, response: Response) -> None: |
478 | 478 | { |
479 | 479 | 'Access-Control-Allow-Origin': '*', |
480 | 480 | 'Access-Control-Allow-Methods': 'POST,GET,DELETE,PUT,OPTIONS', |
481 | | - 'Access-Control-Allow-Headers': ('Origin, Content-Type, Accept, ' 'Authorization'), |
| 481 | + 'Access-Control-Allow-Headers': ('Origin, Content-Type, Accept, Authorization'), |
482 | 482 | 'Access-Control-Allow-Credentials': 'true', |
483 | 483 | 'Access-Control-Max-Age': '1728000', |
484 | 484 | } |
|
0 commit comments