Skip to content

Commit 60f8308

Browse files
More ruffing.
1 parent e017a8e commit 60f8308

28 files changed

+334
-346
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Federation Feeder documentation build configuration file, created by
43
# sphinx-quickstart on Thu Jul 5 12:38:40 2012.
@@ -11,8 +10,9 @@
1110
# All configuration values have a default; values that are commented out
1211
# serve to show the default.
1312

14-
import sys
1513
import os
14+
import sys
15+
1616
import sphinx
1717

1818
sys.path.insert(0, os.path.abspath('./../'))

pyproject.toml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,27 @@ line-length = 120
5555
target-version = "py39"
5656

5757
[tool.ruff.lint]
58-
# future fixes....
59-
#select = [
60-
# "B", # flake8-bugbear
61-
# "E", # pycodestyle error
62-
# "F", # pyflakes
63-
# "I", # isort
64-
# "UP", # pyupgrade
65-
# "W", # pycodestyle warning
58+
#select = [
59+
## "ANN",
60+
# "ASYNC",
61+
# "E",
62+
# "ERA",
63+
# "F",
64+
# "FAST",
65+
# "FLY",
66+
# "FURB",
67+
# "I",
68+
# "PERF",
69+
# "PGH",
70+
# "PIE",
71+
# "PL",
72+
# "UP",
73+
# "W",
6674
#]
75+
ignore = [
76+
"PLR0915",
77+
"PLR0912",
78+
]
6779
[tool.ruff.format]
6880
quote-style = "preserve"
6981

scripts/csv2xrd.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/usr/bin/env python
22

3-
import io
43
import sys
54

65
from lxml import etree
76

87
ns = {None: "http://docs.oasis-open.org/ns/xri/xrd-1.0"}
98

109
xrds = etree.Element("{http://docs.oasis-open.org/ns/xri/xrd-1.0}XRDS", nsmap=ns)
11-
with io.open(sys.argv[1]) as fd:
12-
for line in fd.readlines():
10+
with open(sys.argv[1]) as fd:
11+
for line in fd:
1312
line = line.strip()
1413
e = [x.strip('"') for x in line.split(",")]
1514
xrd = etree.Element("{http://docs.oasis-open.org/ns/xri/xrd-1.0}XRD", nsmap=ns)

setup.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
#!/usr/bin/env python3
2-
# -*- encoding: utf-8 -*-
32

4-
from setuptools import setup
53
from pathlib import PurePath
64
from platform import python_implementation
7-
from typing import List
85

9-
from setuptools import find_packages
6+
from setuptools import find_packages, setup
107

118
__author__ = 'Leif Johansson'
129
__version__ = '2.1.3'
1310

1411

15-
def load_requirements(path: PurePath) -> List[str]:
12+
def load_requirements(path: PurePath) -> list[str]:
1613
""" Load dependencies from a requirements.txt style file, ignoring comments etc. """
1714
res = []
1815
with open(path) as fd:
19-
for line in fd.readlines():
20-
while line.endswith('\n') or line.endswith('\\'):
16+
for line in fd:
17+
while line.endswith(('\n', '\\')):
2118
line = line[:-1]
2219
line = line.strip()
23-
if not line or line.startswith('-') or line.startswith('#'):
20+
if not line or line.startswith(('-', '#')):
2421
continue
2522
res += [line]
2623
return res

src/pyff/api.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import importlib
22
import threading
3+
from collections.abc import Generator, Iterable, Mapping
34
from datetime import datetime, timedelta
45
from json import dumps
56
from typing import Any, Optional
6-
from collections.abc import Generator, Iterable, Mapping
7+
from urllib.parse import quote_plus
78

89
import pyramid.httpexceptions as exc
910
import pytz
@@ -15,8 +16,8 @@
1516
from pyramid.events import NewRequest
1617
from pyramid.request import Request
1718
from pyramid.response import Response
18-
from urllib.parse import quote_plus
1919

20+
from pyff import __version__
2021
from pyff.constants import config
2122
from pyff.exceptions import ResourceException
2223
from pyff.logs import get_log
@@ -25,7 +26,6 @@
2526
from pyff.resource import Resource
2627
from pyff.samlmd import entity_display_name
2728
from pyff.utils import b2u, dumptree, hash_id, json_serializer, utc_now
28-
from pyff import __version__
2929

3030
log = get_log(__name__)
3131

@@ -131,7 +131,6 @@ def call(entry: str) -> None:
131131
resp = requests.post(url)
132132
if resp.status_code >= 300:
133133
log.error(f'POST request to API endpoint at {url} failed: {resp.status_code} {resp.reason}')
134-
return None
135134

136135

137136
def request_handler(request: Request) -> Response:
@@ -386,7 +385,7 @@ def _links(url: str, title: Any = None) -> None:
386385

387386
for entity in request.registry.md.store.lookup('entities'):
388387
entity_display = entity_display_name(entity)
389-
_links("/entities/%s" % hash_id(entity.get('entityID')), title=entity_display)
388+
_links("/entities/{}".format(hash_id(entity.get('entityID'))), title=entity_display)
390389

391390
aliases = request.registry.aliases
392391
for a in aliases.keys():

0 commit comments

Comments
 (0)