浏览代码

rename cython detection function

"have" has clearer semantics than "detect"
Antoine Beaupré 9 年之前
父节点
当前提交
423ff45d81
共有 5 个文件被更改,包括 10 次插入10 次删除
  1. 2 2
      borg/archive.py
  2. 2 2
      borg/archiver.py
  3. 2 2
      borg/helpers.py
  4. 2 2
      borg/key.py
  5. 2 2
      borg/repository.py

+ 2 - 2
borg/archive.py

@@ -13,8 +13,8 @@ import time
 from io import BytesIO
 from . import xattr
 from .helpers import parse_timestamp, Error, uid2user, user2uid, gid2group, group2gid, \
-    Manifest, Statistics, decode_dict, st_mtime_ns, make_path_safe, StableDict, int_to_bigint, bigint_to_int, detect_cython
-if detect_cython():
+    Manifest, Statistics, decode_dict, st_mtime_ns, make_path_safe, StableDict, int_to_bigint, bigint_to_int, have_cython
+if have_cython():
     from .platform import acl_get, acl_set
     from .chunker import Chunker
     from .hashindex import ChunkIndex

+ 2 - 2
borg/archiver.py

@@ -19,8 +19,8 @@ from .helpers import Error, location_validator, format_time, format_file_size, \
     format_file_mode, ExcludePattern, IncludePattern, exclude_path, adjust_patterns, to_localtime, timestamp, \
     get_cache_dir, get_keys_dir, format_timedelta, prune_within, prune_split, \
     Manifest, remove_surrogates, update_excludes, format_archive, check_extension_modules, Statistics, \
-    is_cachedir, bigint_to_int, ChunkerParams, CompressionSpec, detect_cython
-if detect_cython():
+    is_cachedir, bigint_to_int, ChunkerParams, CompressionSpec, have_cython
+if have_cython():
     from .compress import Compressor, COMPR_BUFFER
     from .upgrader import AtticRepositoryUpgrader
     from .repository import Repository

+ 2 - 2
borg/helpers.py

@@ -18,7 +18,7 @@ from operator import attrgetter
 
 import msgpack
 
-def detect_cython():
+def have_cython():
     """allow for a way to disable Cython includes
 
     this is used during usage docs build, in setup.py. It is to avoid
@@ -33,7 +33,7 @@ def detect_cython():
     """
     return not os.environ.get('BORG_CYTHON_DISABLE')
 
-if detect_cython():
+if have_cython():
     from . import hashindex
     from . import chunker
     from . import crypto

+ 2 - 2
borg/key.py

@@ -7,8 +7,8 @@ import textwrap
 import hmac
 from hashlib import sha256
 
-from .helpers import IntegrityError, get_keys_dir, Error, detect_cython
-if detect_cython():
+from .helpers import IntegrityError, get_keys_dir, Error, have_cython
+if have_cython():
     from .crypto import pbkdf2_sha256, get_random_bytes, AES, bytes_to_long, long_to_bytes, bytes_to_int, num_aes_blocks
     from .compress import Compressor, COMPR_BUFFER
 

+ 2 - 2
borg/repository.py

@@ -8,8 +8,8 @@ import struct
 import sys
 from zlib import crc32
 
-from .helpers import Error, IntegrityError, read_msgpack, write_msgpack, unhexlify, detect_cython
-if detect_cython():
+from .helpers import Error, IntegrityError, read_msgpack, write_msgpack, unhexlify, have_cython
+if have_cython():
     from .hashindex import NSIndex
 from .locking import UpgradableLock
 from .lrucache import LRUCache