Skip to content

Instantly share code, notes, and snippets.

View AlexRiina's full-sized avatar

Alex Riina AlexRiina

View GitHub Profile
@AlexRiina
AlexRiina / denest_imports.py
Last active March 20, 2022 21:27
Remove layers from deep imports where possible
"""
Search for imports that are not at the top-level and replace them with
top-level imports.
from x.y import Z -> from x import Z
NOTE: doesn't handle comments or `import x as y`
"""
import argparse
@AlexRiina
AlexRiina / noqaer.py
Last active May 11, 2023 00:33
automatically ignore lines from flake8
"""
Add `# noqa: FXXX` comments to all lines with violations from flake8
"""
# MIT License
#
# Copyright (c) 2022 Alex Riina
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal