Reformat with black 23.3.0

This commit is contained in:
Ole Schütt 2023-05-02 11:45:13 +02:00 committed by Ole Schütt
parent 6b21f62de6
commit 12c03de0ba
20 changed files with 13 additions and 15 deletions

View file

@ -57,7 +57,6 @@ TEST_FILE_CONTENT = """
def sample_run(input_file_path):
with cp2k.ForceEnvironment(input_file_path, "/dev/null") as fenv:
print("potential energy: {:e}".format(fenv.potential_energy))
print("calculating energy..")

View file

@ -84,7 +84,6 @@ def main() -> None:
)
for release in cp2k_release_list:
if args.release != "all" and args.release != release:
continue
@ -94,7 +93,6 @@ def main() -> None:
prefix = f"{package}-{release}"
for mpi_implementation in mpi_implementation_list:
if (
args.mpi_implementation != "all"
and args.mpi_implementation != mpi_implementation
@ -157,7 +155,6 @@ def write_definition_file(
target_cpu: str,
testopts: str,
) -> str:
if release == "master":
branch = ""
else:

View file

@ -17,6 +17,7 @@ KNOWN_EXTENSIONS = (
"cc",
)
# =============================================================================
def main():
if len(sys.argv) != 4:

View file

@ -9,6 +9,7 @@ from os import path
re_program = re.compile(r"\n\s*end\s*program")
re_main = re.compile(r"\sint\s+main\s*\(")
# ============================================================================
def main():
if len(sys.argv) != 2:

View file

@ -46,6 +46,7 @@ IGNORED_WARNINGS = (
"style of line directive is a GCC extension",
)
# ======================================================================================
def check_warnings(fhandle):
loc = loc_short = ""

View file

@ -7,7 +7,6 @@ import argparse
def summarize(issue_files, suppressions):
suppress = []
if suppressions:

View file

@ -8,6 +8,7 @@ from os import path
from pprint import pformat
from datetime import datetime
# ===============================================================================
def main():
if len(sys.argv) != 3:

View file

@ -42,6 +42,7 @@ from matplotlib.ticker import AutoMinorLocator # type: ignore
GitSha = NewType("GitSha", str)
ReportStatus = Literal["OK", "FAILED", "OUTDATED", "UNKNOWN"]
# ======================================================================================
class GitLog:
def __init__(self) -> None:
@ -157,7 +158,6 @@ def main() -> None:
def gen_frontpage(
config: ConfigParser, log: GitLog, status_fn: Path, outdir: Path, send_emails: bool
) -> None:
status: Dict[str, Status] = {}
if path.exists(status_fn):
with open(status_fn, "rb") as f:
@ -239,7 +239,6 @@ def gen_frontpage(
# ======================================================================================
def gen_archive(config: ConfigParser, log: GitLog, outdir: Path) -> None:
for s in config.sections():
print(f"Working on archive page of: {s}")
name = config.get(s, "name")
@ -354,7 +353,6 @@ def gen_url_list(config: ConfigParser, outdir: Path) -> None:
def gen_plots(
archive_reports: Dict[GitSha, Report], log: GitLog, outdir: Path, full_archive: bool
) -> str:
ordered_shas = [c.sha for c in log.commits]
ordered_reports = [archive_reports[s] for s in ordered_shas if s in archive_reports]
@ -414,7 +412,6 @@ def make_plot_data(fn: Path, plot: AggregatedPlot, max_age: int, log: GitLog) ->
def make_plot_image(
fn: Path, plot: AggregatedPlot, max_age: int, full_archive: bool
) -> None:
# Setup figure.
fig = plt.figure(figsize=(12, 4))
fig.subplots_adjust(bottom=0.18, left=0.06, right=0.70)
@ -468,7 +465,6 @@ def send_notification(
s: str,
send_emails: bool,
) -> None:
idx_end = log.index_by_sha[report.sha] if report.sha else 0
if not last_ok:
return # we don't know when this started

View file

@ -16,6 +16,7 @@ import re
# ======================================================================================
Report = NewType("Report", Dict[str, str])
# ======================================================================================
@dataclasses.dataclass
class TestDef:

View file

@ -7,6 +7,7 @@ from typing import Any
import argparse
import io
# ======================================================================================
def main() -> None:
parser = argparse.ArgumentParser()

View file

@ -6,6 +6,7 @@ import re
import sys
from collections import OrderedDict
# ======================================================================================
def main():
if len(sys.argv) < 4 or (len(sys.argv) - 1) % 3 != 0:

View file

@ -87,7 +87,6 @@ def clean_publics(fn, unused):
without_comment = re.sub("!.*", "", line).strip()
if len(without_comment) > 0 and without_comment[-1] != "&":
# flush new_public
for i, entry in enumerate(new_public):
if i == 0:

View file

@ -7,6 +7,7 @@
import os
import sys
# -------------------------------------------------------------------------------
def main():
gen_povray()

View file

@ -103,7 +103,6 @@ def format_array(
begin: str = "[",
end: str = "]",
) -> List[str]:
lines: List[str] = [" " * indent + begin]
for i, x in enumerate(array):
if i % wrap == 0 and i > 0:

View file

@ -16,7 +16,6 @@ def main() -> None:
lines_out = []
continuation = False
for line in makefile.read_text(encoding="utf8").split("\n"):
# Remove trailing whitespaces.
line = line.rstrip()

View file

@ -26,6 +26,7 @@ SCRATCH_DIR = Path("./obj/precommit")
CACHE_FILE = SCRATCH_DIR / "cache.json"
SERVER = os.environ.get("CP2K_PRECOMMIT_SERVER", "https://precommit.cp2k.org")
# ======================================================================================
def main() -> None:
# Parse command line arguments.

View file

@ -16,6 +16,7 @@ app.config["MAX_CONTENT_LENGTH"] = 1024 * 1024 # 1MB
app.logger.setLevel(logging.INFO)
app.logger.info("CP2K Precommit Server is up and running :-)")
# ======================================================================================
@app.route("/")
def hello():

View file

@ -23,7 +23,6 @@ class TestSingleFileFolder(unittest.TestCase):
shutil.rmtree(self.tempdir)
def test_prettify(self):
# call prettify, the return value should be 0 (OK)
self.assertEqual(main([self.fname]), 0)

View file

@ -39,6 +39,7 @@ KEEPALIVE_SKIP_DIRS = [
"QS/regtest-mp2-grad-2",
]
# ======================================================================================
async def main() -> None:
parser = argparse.ArgumentParser(description="Runs CP2K regression test suite.")
@ -575,7 +576,6 @@ async def run_regtests_classic(batch: Batch, cfg: Config) -> List[TestResult]:
def eval_regtest(
batch: Batch, test: Regtest, duration: float, returncode: int, timed_out: bool
) -> TestResult:
output_bytes = test.out_path.read_bytes() if test.out_path.exists() else b""
output = output_bytes.decode("utf8", errors="replace")
output_tail = "\n".join(output.split("\n")[-100:])

View file

@ -5,6 +5,7 @@
import sys
from os import path
# ===============================================================================
def main():
if len(sys.argv) != 2: