Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P792
WTF isort minimal
Active
Public
Actions
Authored by
vlorentz
on Sep 29 2020, 5:29 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
$ cat db.py
def a():
yield f(
"""
select %s from (values %%s) as t(%s)
"""
)
def b():
return (
"""
select name
from foo
"""
% main_table
)
def c():
query = (
"""
select {keys}
from (values %s) as t(id)
"""
)
def d():
query = f"""select t.id
from {table} t
{extra}"""
$ cat db.py| isort - | diff -u db.py -
--- db.py 2020-09-29 17:30:57.737760374 +0200
+++ - 2020-09-29 17:31:42.967321279 +0200
@@ -9,7 +9,6 @@
return (
"""
select name
- from foo
"""
% main_table
)
@@ -18,12 +17,11 @@
query = (
"""
select {keys}
- from (values %s) as t(id)
+ from values%s import ast, id
"""
)
def d():
query = f"""select t.id
- from {table} t
{extra}"""
$ isort -V
_ _
(_) ___ ___ _ __| |_
| |/ _/ / _ \/ '__ _/
| |\__ \/\_\/| | | |_
|_|\___/\___/\_/ \_/
isort your imports, so you don't have to.
VERSION 5.5.3
Event Timeline
vlorentz
created this paste.
Sep 29 2020, 5:29 PM
2020-09-29 17:29:12 (UTC+2)
vlorentz
edited the content of this paste.
(Show Details)
Sep 29 2020, 5:32 PM
2020-09-29 17:32:05 (UTC+2)
Log In to Comment