source: trunk/src/allmydata/storage/shares.py

Last change on this file was 1cfe843d, checked in by Alexandre Detiste <alexandre.detiste@…>, at 2024-02-22T23:40:25Z

more python2 removal

  • Property mode set to 100644
File size: 389 bytes
Line 
1"""
2Ported to Python 3.
3"""
4
5from allmydata.storage.mutable import MutableShareFile
6from allmydata.storage.immutable import ShareFile
7
8def get_share_file(filename):
9    with open(filename, "rb") as f:
10        prefix = f.read(32)
11    if MutableShareFile.is_valid_header(prefix):
12        return MutableShareFile(filename)
13    # otherwise assume it's immutable
14    return ShareFile(filename)
Note: See TracBrowser for help on using the repository browser.