mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Make black happy
This commit is contained in:
parent
2baac2dfa7
commit
0d4bf5ad0d
1 changed files with 15 additions and 9 deletions
|
@ -63,14 +63,22 @@ class BlueprintApp:
|
||||||
type=argparse.FileType("r"),
|
type=argparse.FileType("r"),
|
||||||
)
|
)
|
||||||
|
|
||||||
format = self.add_subcommand("format", "Format given blueprint files", self.cmd_format)
|
format = self.add_subcommand(
|
||||||
format.add_argument("--check", help="don't write to the files, just return whether they would be formatted", action="store_true")
|
"format", "Format given blueprint files", self.cmd_format
|
||||||
|
)
|
||||||
|
format.add_argument(
|
||||||
|
"--check",
|
||||||
|
help="don't write to the files, just return whether they would be formatted",
|
||||||
|
action="store_true",
|
||||||
|
)
|
||||||
format.add_argument(
|
format.add_argument(
|
||||||
"inputs",
|
"inputs",
|
||||||
nargs="+",
|
nargs="+",
|
||||||
metavar="filenames",
|
metavar="filenames",
|
||||||
default=sys.stdin,
|
default=sys.stdin,
|
||||||
type=argparse.FileType("r"), # idk, but opening with "rw" somehow throws an error
|
type=argparse.FileType(
|
||||||
|
"r"
|
||||||
|
), # idk, but opening with "rw" somehow throws an error
|
||||||
)
|
)
|
||||||
|
|
||||||
port = self.add_subcommand("port", "Interactive porting tool", self.cmd_port)
|
port = self.add_subcommand("port", "Interactive porting tool", self.cmd_port)
|
||||||
|
@ -174,7 +182,9 @@ class BlueprintApp:
|
||||||
if opts.check:
|
if opts.check:
|
||||||
to_be_reformatted += 1
|
to_be_reformatted += 1
|
||||||
else:
|
else:
|
||||||
open(file.name, "w").write(formatted) # This is very unelegant, should actually be `file.write(formatted)`
|
open(file.name, "w").write(
|
||||||
|
formatted
|
||||||
|
) # This is very unelegant, should actually be `file.write(formatted)`
|
||||||
reformatted += 1
|
reformatted += 1
|
||||||
|
|
||||||
except PrintableError as e:
|
except PrintableError as e:
|
||||||
|
@ -182,9 +192,7 @@ class BlueprintApp:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if to_be_reformatted == 0 and reformatted == 0:
|
if to_be_reformatted == 0 and reformatted == 0:
|
||||||
print(
|
print(f"{Colors.GREEN}{Colors.BOLD}Nothing to do.{Colors.CLEAR}")
|
||||||
f"{Colors.GREEN}{Colors.BOLD}Nothing to do.{Colors.CLEAR}"
|
|
||||||
)
|
|
||||||
elif opts.check:
|
elif opts.check:
|
||||||
print(
|
print(
|
||||||
f"{Colors.RED}{Colors.BOLD}{to_be_reformatted} files would be reformatted.{Colors.CLEAR}"
|
f"{Colors.RED}{Colors.BOLD}{to_be_reformatted} files would be reformatted.{Colors.CLEAR}"
|
||||||
|
@ -194,8 +202,6 @@ class BlueprintApp:
|
||||||
f"{Colors.RED}{Colors.BOLD}Reformatted {reformatted} file.{Colors.CLEAR}"
|
f"{Colors.RED}{Colors.BOLD}Reformatted {reformatted} file.{Colors.CLEAR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cmd_lsp(self, opts):
|
def cmd_lsp(self, opts):
|
||||||
langserv = LanguageServer()
|
langserv = LanguageServer()
|
||||||
langserv.run()
|
langserv.run()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue