Changeset 11b93412 in trunk
- Timestamp:
- 2020-08-11T19:49:59Z (5 years ago)
- Branches:
- master
- Children:
- 2772980
- Parents:
- babe2db
- Location:
- src/allmydata/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/util/_python3.py ¶
rbabe2db r11b93412 29 29 "allmydata.util.base32", 30 30 "allmydata.util.base62", 31 "allmydata.util.configutil", 31 32 "allmydata.util.connection_status", 32 33 "allmydata.util.deferredutil", -
TabularUnified src/allmydata/util/configutil.py ¶
rbabe2db r11b93412 1 from __future__ import absolute_import 2 from __future__ import division 3 from __future__ import print_function 4 from __future__ import unicode_literals 1 5 2 from ConfigParser import SafeConfigParser 6 from future.utils import PY2 7 if PY2: 8 from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 9 10 from configparser import SafeConfigParser 3 11 4 12 import attr … … 14 22 def get_config(tahoe_cfg): 15 23 config = SafeConfigParser() 16 with open(tahoe_cfg, "rb") as f: 17 # Skip any initial Byte Order Mark. Since this is an ordinary file, we 18 # don't need to handle incomplete reads, and can assume seekability. 19 if f.read(3) != '\xEF\xBB\xBF': 20 f.seek(0) 24 with open(tahoe_cfg, "r") as f: 21 25 config.readfp(f) 22 26 return config … … 29 33 30 34 def write_config(tahoe_cfg, config): 31 with open(tahoe_cfg, "w b") as f:35 with open(tahoe_cfg, "w") as f: 32 36 config.write(f) 33 37
Note: See TracChangeset
for help on using the changeset viewer.