File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change
1
+ import plistlib
2
+
3
+
4
+ def _matches_format (path_or_file ):
5
+ try :
6
+ plistlib .readPlist (path_or_file )
7
+ return True
8
+ except Exception :
9
+ return False
10
+
11
+
12
+ format = {
13
+ 'name' : 'plist' ,
14
+ 'predicate' : _matches_format ,
15
+ 'read' : plistlib .readPlist ,
16
+ 'write' : plistlib .writePlist ,
17
+ }
Original file line number Diff line number Diff line change 9
9
10
10
from __future__ import absolute_import
11
11
from typing import List , Dict
12
- from .PlistFormat import format as plist
12
+ try :
13
+ from plistlib import readPlist
14
+ from .PlistFormat2 import format as plist # for Python 2
15
+ except ImportError :
16
+ from .PlistFormat import format as plist # for Python 3
13
17
from .JSONFormat import format as json
14
18
15
19
formats = [plist , json ] # type: List[Dict]
You can’t perform that action at this time.
0 commit comments