From 404bb1ca20fb0ee6e7c11349b54f3b1041ce583c Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 10 Aug 2025 22:06:55 +0200 Subject: [PATCH] scripts: fix typos and grammar --- scripts/borg.exe.spec | 14 +++++++------- scripts/errorlist.py | 16 ++++++++-------- scripts/hash_sizes.py | 12 ++++++------ scripts/make.py | 10 +++++----- scripts/shell_completions/bash/borg | 10 +++++----- scripts/shell_completions/fish/borg.fish | 10 +++++----- scripts/shell_completions/zsh/_borg | 2 +- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/scripts/borg.exe.spec b/scripts/borg.exe.spec index be7e1e134..2fd74eb4f 100644 --- a/scripts/borg.exe.spec +++ b/scripts/borg.exe.spec @@ -1,5 +1,5 @@ # -*- mode: python -*- -# this pyinstaller spec file is used to build borg binaries on posix platforms +# This PyInstaller spec file is used to build Borg binaries on POSIX platforms. import os, sys @@ -33,8 +33,8 @@ a = Analysis([os.path.join(basepath, 'src', 'borg', '__main__.py'), ], cipher=block_cipher) if sys.platform == 'darwin': - # do not bundle the osxfuse libraries, so we do not get a version - # mismatch to the installed kernel driver of osxfuse. + # Do not bundle the macFUSE libraries to avoid a version + # mismatch with the installed macFUSE kernel driver. a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]] pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) @@ -51,10 +51,10 @@ exe = EXE(pyz, console=True) # Build a directory-based binary in addition to a packed -# single file. This allows one to easily look at all included -# files (e.g. without having to strace or halt the built binary -# and introspect /tmp). Also avoids unpacking all libs when -# running the app, which is better for app signing on various OS. +# single-file. This allows one to easily look at all included +# files (e.g., without having to strace or halt the built binary +# and introspect /tmp). Also avoids unpacking all libraries when +# running the app, which is better for app signing on various operating systems. slim_exe = EXE(pyz, a.scripts, exclude_binaries=True, diff --git a/scripts/errorlist.py b/scripts/errorlist.py index ed81fc981..dd480d5b3 100755 --- a/scripts/errorlist.py +++ b/scripts/errorlist.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# this script automatically generates the error list for the docs by +# This script automatically generates the error list for the docs by # looking at the "Error" class and its subclasses. from textwrap import indent @@ -14,14 +14,14 @@ def subclasses(cls): return set(direct_subclasses) | set(s for c in direct_subclasses for s in subclasses(c)) -# 0, 1, 2 are used for success, generic warning, generic error -# 3..99 are available for specific errors -# 100..127 are available for specific warnings -# 128+ are reserved for signals +# 0, 1, 2 are used for success, generic warning, generic error. +# 3..99 are available for specific errors. +# 100..127 are available for specific warnings. +# 128+ are reserved for signals. free_error_rcs = set(range(EXIT_ERROR_BASE, EXIT_WARNING_BASE)) # 3 .. 99 free_warning_rcs = set(range(EXIT_WARNING_BASE, EXIT_SIGNAL_BASE)) # 100 .. 127 -# these classes map to rc 2 +# These classes map to rc 2 generic_error_rc_classes = set() generic_warning_rc_classes = set() @@ -37,7 +37,7 @@ for cls in sorted(error_classes, key=lambda cls: (cls.__module__, cls.__qualname elif rc == 2: generic_error_rc_classes.add(cls.__qualname__) else: # rc != 2 - # if we did not intentionally map this to the generic error rc, this might be an issue: + # If we did not intentionally map this to the generic error rc, this might be an issue: print(f'ERROR: {rc} is not a free/available RC, but either duplicate or invalid') print() @@ -55,7 +55,7 @@ for cls in sorted(warning_classes, key=lambda cls: (cls.__module__, cls.__qualna elif rc == 1: generic_warning_rc_classes.add(cls.__qualname__) else: # rc != 1 - # if we did not intentionally map this to the generic warning rc, this might be an issue: + # If we did not intentionally map this to the generic warning rc, this might be an issue: print(f'ERROR: {rc} is not a free/available RC, but either duplicate or invalid') print("\n") diff --git a/scripts/hash_sizes.py b/scripts/hash_sizes.py index 68e6e160a..951eb1f88 100644 --- a/scripts/hash_sizes.py +++ b/scripts/hash_sizes.py @@ -1,13 +1,13 @@ """ -Compute hashtable sizes with nices properties +Compute hash table sizes with nice properties: - prime sizes (for small to medium sizes) -- 2 prime-factor sizes (for big sizes) +- two prime-factor sizes (for big sizes) - fast growth for small sizes - slow growth for big sizes Note: - this is just a tool for developers. - within borgbackup, it is just used to generate hash_sizes definition for _hashindex.c. + This is just a tool for developers. + Within BorgBackup, it is only used to generate the hash_sizes definition for _hashindex.c. """ from collections import namedtuple @@ -20,7 +20,7 @@ start, end_p1, end_p2 = 1 * K, 127 * M, 2 * G - 10 * M # stay well below 2^31 - Policy = namedtuple("Policy", "upto grow") policies = [ - # which growth factor to use when growing a hashtable of size < upto + # which growth factor to use when growing a hash table of size < upto # grow fast (*2.0) at the start so we do not have to resize too often (expensive). # grow slow (*1.1) for huge hash tables (do not jump too much in memory usage) Policy(256*K, 2.0), @@ -85,7 +85,7 @@ def main(): sizes.append(p) i = int(i * grow_factor) - gen = two_prime_factors() # for lower ram consumption + gen = two_prime_factors() # for lower RAM consumption while i < end_p2: grow_factor = get_grow_factor(i) p = find_bigger_prime(gen, i) diff --git a/scripts/make.py b/scripts/make.py index c90e1bec0..982cd67c3 100644 --- a/scripts/make.py +++ b/scripts/make.py @@ -23,7 +23,7 @@ def format_metavar(option): class BuildUsage: - """generate usage docs for each command""" + """Generate usage docs for each command.""" def run(self): print('generating usage docs') @@ -31,11 +31,11 @@ class BuildUsage: borg.doc_mode = 'build_man' if not os.path.exists('docs/usage'): os.mkdir('docs/usage') - # allows us to build docs without the C modules fully loaded during help generation + # Allows us to build docs without the C modules fully loaded during help generation from borg.archiver import Archiver parser = Archiver(prog='borg').build_parser() - # borgfs has a separate man page to satisfy debian's "every program from a package - # must have a man page" requirement, but it doesn't need a separate HTML docs page + # borgfs has a separate man page to satisfy Debian's "every program from a package + # must have a man page" requirement, but it does not need a separate HTML docs page. #borgfs_parser = Archiver(prog='borgfs').build_parser() self.generate_level("", parser, Archiver) @@ -290,7 +290,7 @@ class BuildMan: import borg borg.doc_mode = 'build_man' os.makedirs('docs/man', exist_ok=True) - # allows us to build docs without the C modules fully loaded during help generation + # Allows us to build docs without the C modules fully loaded during help generation from borg.archiver import Archiver parser = Archiver(prog='borg').build_parser() borgfs_parser = Archiver(prog='borgfs').build_parser() diff --git a/scripts/shell_completions/bash/borg b/scripts/shell_completions/bash/borg index 350266a8f..f5d6ccba3 100644 --- a/scripts/shell_completions/bash/borg +++ b/scripts/shell_completions/bash/borg @@ -1,7 +1,7 @@ -# Completions for borg +# Completions for Borg # https://www.borgbackup.org/ # Note: -# Listing archives works on password protected repositories only if $BORG_PASSPHRASE is set. +# Listing archives works on password-protected repositories only if $BORG_PASSPHRASE is set. # Install: # Copy this file to /usr/share/bash-completion/completions/ or /etc/bash_completion.d/ @@ -57,7 +57,7 @@ _borg() return 0 ;; '-o') - # FIXME This list is probably not full, but I tried to pick only those that are relevant to borg mount -o: + # FIXME: This list is probably not complete, but it includes options relevant to 'borg mount -o': local fuse_options="ac_attr_timeout= allow_damaged_files allow_other allow_root attr_timeout= auto auto_cache auto_unmount default_permissions entry_timeout= gid= group_id= kernel_cache max_read= negative_timeout= noauto noforget remember= remount rootmode= uid= umask= user user_id= versions" COMPREPLY=( $(compgen -W "${fuse_options}" -- ${cur}) ) return 0 @@ -162,11 +162,11 @@ _borg() if [[ ${prev} == "::" ]] ; then list_archives=1 fi - # Second archive listing for borg diff + # Second archive listing for 'borg diff' if [[ ${COMP_LINE} =~ ^.*\ diff\ .*::[^\ ]+\ ${cur}$ ]] ; then list_archives=1 fi - # Additional archive listing for borg delete + # Additional archive listing for 'borg delete' if [[ ${COMP_LINE} =~ ^.*\ delete\ .*::[^\ ]+.*${cur}$ ]] ; then list_archives=1 fi diff --git a/scripts/shell_completions/fish/borg.fish b/scripts/shell_completions/fish/borg.fish index 75af73a51..c1465871a 100644 --- a/scripts/shell_completions/fish/borg.fish +++ b/scripts/shell_completions/fish/borg.fish @@ -1,7 +1,7 @@ -# Completions for borg +# Completions for Borg # https://www.borgbackup.org/ # Note: -# Listing archives works on password protected repositories only if $BORG_PASSPHRASE is set. +# Listing archives works on password-protected repositories only if $BORG_PASSPHRASE is set. # Install: # Copy this file to /usr/share/fish/vendor_completions.d/ @@ -19,7 +19,7 @@ complete -c borg -f -n __fish_is_first_token -a 'prune' -d 'Prune repository arc complete -c borg -f -n __fish_is_first_token -a 'compact' -d 'Free repository space' complete -c borg -f -n __fish_is_first_token -a 'info' -d 'Show archive details' complete -c borg -f -n __fish_is_first_token -a 'mount' -d 'Mount archive or a repository' -complete -c borg -f -n __fish_is_first_token -a 'umount' -d 'Un-mount the mounted archive' +complete -c borg -f -n __fish_is_first_token -a 'umount' -d 'Unmount the mounted archive' function __fish_borg_seen_key if __fish_seen_subcommand_from key @@ -48,8 +48,8 @@ function __fish_borg_seen_benchmark end return 1 end -complete -c borg -f -n __fish_is_first_token -a 'benchmark' -d 'Benchmark borg operations' -complete -c borg -f -n __fish_borg_seen_benchmark -a 'crud' -d 'Benchmark borg CRUD operations' +complete -c borg -f -n __fish_is_first_token -a 'benchmark' -d 'Benchmark Borg operations' +complete -c borg -f -n __fish_borg_seen_benchmark -a 'crud' -d 'Benchmark Borg CRUD operations' function __fish_borg_seen_help if __fish_seen_subcommand_from help diff --git a/scripts/shell_completions/zsh/_borg b/scripts/shell_completions/zsh/_borg index 548d9a28e..1599843ab 100644 --- a/scripts/shell_completions/zsh/_borg +++ b/scripts/shell_completions/zsh/_borg @@ -51,7 +51,7 @@ _borg_commands() { 'recreate:re-create archives' 'rename:rename an existing archive' 'serve:start in server mode' - 'umount:un-mount the FUSE filesystem' + 'umount:unmount the FUSE filesystem' 'upgrade:upgrade a repository from a previous version' 'with-lock:run a user specified command with the repository lock held' )