mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
Everywhere: Format all python files with black
This commit is contained in:
parent
9e8336c04f
commit
2f9957c618
Notes:
github-actions[bot]
2025-05-22 14:22:50 +00:00
Author: https://github.com/trflynn89
Commit: 2f9957c618
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4841
Reviewed-by: https://github.com/gmta ✅
18 changed files with 338 additions and 350 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
r"""
|
||||
Embeds a file into a String, a la #embed from C++23
|
||||
Embeds a file into a String, a la #embed from C++23
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
@ -8,31 +8,26 @@ import sys
|
|||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
epilog=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument('input', help='input file to stringify')
|
||||
parser.add_argument('-o', '--output', required=True,
|
||||
help='output file')
|
||||
parser.add_argument('-n', '--variable-name', required=True,
|
||||
help='name of the C++ variable')
|
||||
parser.add_argument('-s', '--namespace', required=False,
|
||||
help='C++ namespace to put the string into')
|
||||
parser = argparse.ArgumentParser(epilog=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument("input", help="input file to stringify")
|
||||
parser.add_argument("-o", "--output", required=True, help="output file")
|
||||
parser.add_argument("-n", "--variable-name", required=True, help="name of the C++ variable")
|
||||
parser.add_argument("-s", "--namespace", required=False, help="C++ namespace to put the string into")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.output, 'w') as f:
|
||||
with open(args.output, "w") as f:
|
||||
f.write("#include <AK/String.h>\n")
|
||||
if args.namespace:
|
||||
f.write(f"namespace {args.namespace} {{\n")
|
||||
f.write(f"extern String {args.variable_name};\n")
|
||||
f.write(f"String {args.variable_name} = R\"~~~(")
|
||||
with open(args.input, 'r') as input:
|
||||
f.write(f'String {args.variable_name} = R"~~~(')
|
||||
with open(args.input, "r") as input:
|
||||
for line in input.readlines():
|
||||
f.write(f"{line}")
|
||||
f.write(")~~~\"_string;\n")
|
||||
f.write(')~~~"_string;\n')
|
||||
if args.namespace:
|
||||
f.write("}\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue