From 6806c0f92ff2e0ba8d6373bb91ebc1a6f0509fb2 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Thu, 5 Sep 2024 10:07:49 -0400 Subject: [PATCH] pre-commit. --- .pre-commit-config.yaml | 18 ++++++++++-------- gsd/gsd.c | 12 +++++++----- scripts/benchmark-write.cc | 3 +-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b9984cf9..7f896085 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,15 +13,17 @@ repos: - id: check-toml - id: check-yaml - id: check-case-conflict - - id: fix-encoding-pragma - args: - - --remove - id: mixed-line-ending -# actionlint fails to build on mac... -# - repo: https://github.com/rhysd/actionlint -# rev: v1.6.27 -# hooks: -# - id: actionlint +- repo: https://github.com/asottile/pyupgrade + rev: 'v3.16.0' + hooks: + - id: pyupgrade + args: + - --py39-plus +- repo: https://github.com/rhysd/actionlint + rev: v1.7.1 + hooks: + - id: actionlint - repo: https://github.com/glotzerlab/fix-license-header rev: v0.3.2 hooks: diff --git a/gsd/gsd.c b/gsd/gsd.c index 86af9490..2e8d7667 100644 --- a/gsd/gsd.c +++ b/gsd/gsd.c @@ -28,9 +28,9 @@ #include #include #include +#include #include #include -#include #include "gsd.h" @@ -163,9 +163,10 @@ inline static ssize_t gsd_io_pwrite_retry(int fd, const void* buf, size_t count, size_t to_write = count - total_bytes_written; #if defined(_WIN32) || defined(__APPLE__) // win32 and apple raise an error for writes greater than INT_MAX - if (to_write > INT_MAX / 2) { + if (to_write > INT_MAX / 2) + { to_write = INT_MAX / 2; -} + } #endif errno = 0; @@ -206,9 +207,10 @@ inline static ssize_t gsd_io_pread_retry(int fd, void* buf, size_t count, int64_ size_t to_read = count - total_bytes_read; #if defined(_WIN32) || defined(__APPLE__) // win32 and apple raise errors for reads greater than INT_MAX - if (to_read > INT_MAX / 2) { + if (to_read > INT_MAX / 2) + { to_read = INT_MAX / 2; -} + } #endif errno = 0; diff --git a/scripts/benchmark-write.cc b/scripts/benchmark-write.cc index b527ad17..428bcc48 100644 --- a/scripts/benchmark-write.cc +++ b/scripts/benchmark-write.cc @@ -69,8 +69,7 @@ int main(int argc, char** argv) // NOLINT const double us = 1e-6; std::cout << "Write time: " << time_per_key / us << " microseconds/key." << '\n'; - std::cout << "Write time: " << time_per_key / us * n_keys << " microseconds/frame." - << '\n'; + std::cout << "Write time: " << time_per_key / us * n_keys << " microseconds/frame." << '\n'; const double mb_per_second = double(key_size * 8 + static_cast(32) * static_cast(2))