Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up formatting with ruff, black and isort #759

Merged
merged 8 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,16 @@ jobs:
- install_dependencies

- run:
name: run flake8
name: run ruff
command: |
. venv/bin/activate
flake8 irrd
ruff irrd

- run:
name: run isort
command: |
. venv/bin/activate
isort --check --diff irrd

- run:
name: run mypy
Expand Down Expand Up @@ -385,6 +391,15 @@ jobs:
- restore_cache:
keys: v1-docs-cache

# Sphinx_immaterial does parallel downloads that don't work
# well on CircleCI. There is no setting, so we just edit
# the max number of workers. Bit gross, but this isn't our
# production doc build anyways, that happens on RTD without hacks.
- run:
name: hack sphinx_immaterial
command: |
sed -i 's/max_workers=32/max_workers=1/' /mnt/ramdisk/venv/lib/py*/site-packages/sphinx_immaterial/google_fonts.py

- run:
name: build docs
command: |
Expand Down
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile=black
py_version=38
4 changes: 2 additions & 2 deletions irrd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '4.4-dev'
ENV_MAIN_PROCESS_PID = 'IRRD_MAIN_PROCESS_PID'
__version__ = "4.4-dev"
ENV_MAIN_PROCESS_PID = "IRRD_MAIN_PROCESS_PID"
375 changes: 213 additions & 162 deletions irrd/conf/__init__.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion irrd/conf/defaults.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# In addition to these settings, simple
# defaults are stored in default_config.yaml.

DEFAULT_SOURCE_NRTM_PORT = '43'
DEFAULT_SOURCE_NRTM_PORT = "43"
DEFAULT_SOURCE_IMPORT_TIMER = 300
DEFAULT_SOURCE_EXPORT_TIMER = 3600
175 changes: 88 additions & 87 deletions irrd/conf/known_keys.py
Original file line number Diff line number Diff line change
@@ -1,100 +1,101 @@
from irrd.conf import AUTH_SET_CREATION_COMMON_KEY
from irrd.rpsl.passwords import PASSWORD_HASHERS_ALL
from irrd.vendor.dotted.collection import DottedDict
from irrd.rpsl.rpsl_objects import OBJECT_CLASS_MAPPING, RPSLSet
from irrd.vendor.dotted.collection import DottedDict

# Note that sources are checked separately,
# and 'access_lists' is always permitted
KNOWN_CONFIG_KEYS = DottedDict({
'database_url': {},
'database_readonly': {},
'redis_url': {},
'piddir': {},
'user': {},
'group': {},
'server': {
'http': {
'interface': {},
'port': {},
'status_access_list': {},
'event_stream_access_list': {},
'workers': {},
'forwarded_allowed_ips': {},
KNOWN_CONFIG_KEYS = DottedDict(
{
"database_url": {},
"database_readonly": {},
"redis_url": {},
"piddir": {},
"user": {},
"group": {},
"server": {
"http": {
"interface": {},
"port": {},
"status_access_list": {},
"event_stream_access_list": {},
"workers": {},
"forwarded_allowed_ips": {},
},
"whois": {
"interface": {},
"port": {},
"access_list": {},
"max_connections": {},
},
},
"route_object_preference": {"update_timer": {}},
"email": {
"from": {},
"footer": {},
"smtp": {},
"recipient_override": {},
"notification_header": {},
},
"auth": {
"override_password": {},
"authenticate_parents_route_creation": {},
"gnupg_keyring": {},
"set_creation": {
rpsl_object_class: {"prefix_required": {}, "autnum_authentication": {}}
for rpsl_object_class in [
set_object.rpsl_object_class
for set_object in OBJECT_CLASS_MAPPING.values()
if issubclass(set_object, RPSLSet)
]
+ [AUTH_SET_CREATION_COMMON_KEY]
},
"password_hashers": {hasher_name.lower(): {} for hasher_name in PASSWORD_HASHERS_ALL.keys()},
},
"rpki": {
"roa_source": {},
"roa_import_timer": {},
"slurm_source": {},
"pseudo_irr_remarks": {},
"notify_invalid_enabled": {},
"notify_invalid_subject": {},
"notify_invalid_header": {},
},
"scopefilter": {
"prefixes": {},
"asns": {},
},
'whois': {
'interface': {},
'port': {},
'access_list': {},
'max_connections': {},
"log": {
"logfile_path": {},
"level": {},
"logging_config_path": {},
},
},
'route_object_preference': {'update_timer': {}},
'email': {
'from': {},
'footer': {},
'smtp': {},
'recipient_override': {},
'notification_header': {},
},
'auth': {
'override_password': {},
'authenticate_parents_route_creation': {},
'gnupg_keyring': {},
'set_creation': {
rpsl_object_class: {'prefix_required': {}, 'autnum_authentication': {}}
for rpsl_object_class in [
set_object.rpsl_object_class
for set_object in OBJECT_CLASS_MAPPING.values()
if issubclass(set_object, RPSLSet)
] + [AUTH_SET_CREATION_COMMON_KEY]
"sources_default": {},
"compatibility": {
"inetnum_search_disabled": {},
"ipv4_only_route_set_members": {},
},
'password_hashers': {
hasher_name.lower(): {} for hasher_name in PASSWORD_HASHERS_ALL.keys()
}
},
'rpki': {
'roa_source': {},
'roa_import_timer': {},
'slurm_source': {},
'pseudo_irr_remarks': {},
'notify_invalid_enabled': {},
'notify_invalid_subject': {},
'notify_invalid_header': {},
},
'scopefilter': {
'prefixes': {},
'asns': {},
},
'log': {
'logfile_path': {},
'level': {},
'logging_config_path': {},
},
'sources_default': {},
'compatibility': {
'inetnum_search_disabled': {},
'ipv4_only_route_set_members': {},
}
})
)

KNOWN_SOURCES_KEYS = {
'authoritative',
'keep_journal',
'nrtm_host',
'nrtm_port',
'import_source',
'import_serial_source',
'import_timer',
'object_class_filter',
'export_destination',
'export_destination_unfiltered',
'export_timer',
'nrtm_access_list',
'nrtm_access_list_unfiltered',
'nrtm_query_serial_range_limit',
'strict_import_keycert_objects',
'rpki_excluded',
'scopefilter_excluded',
'suspension_enabled',
'route_object_preference',
"authoritative",
"keep_journal",
"nrtm_host",
"nrtm_port",
"import_source",
"import_serial_source",
"import_timer",
"object_class_filter",
"export_destination",
"export_destination_unfiltered",
"export_timer",
"nrtm_access_list",
"nrtm_access_list_unfiltered",
"nrtm_query_serial_range_limit",
"strict_import_keycert_objects",
"rpki_excluded",
"scopefilter_excluded",
"suspension_enabled",
"route_object_preference",
}
Loading