Commit 8232920 1 parent 07440b8 commit 8232920 Copy full SHA for 8232920
File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 20
20
from .xldate import XLDateError , xldate_as_datetime , xldate_as_tuple
21
21
22
22
23
- #: descriptions of the version file types :mod:`xlrd` can :func:`inspect <inspect_format>`.
23
+ #: descriptions of the file types :mod:`xlrd` can :func:`inspect <inspect_format>`.
24
24
FILE_FORMAT_DESCRIPTIONS = {
25
25
'xls' : 'Excel xls' ,
26
26
'xlsb' : 'Excel 2007 xlsb file' ,
37
37
38
38
def inspect_format (path = None , content = None ):
39
39
"""
40
- Inspect the supplied path or content stream and return the
41
- file's type as a :class:`str` or ``None`` if it cannot be determined.
40
+ Inspect the content at the supplied path or the :class:`bytes` content provided
41
+ and return the file's type as a :class:`str`, or ``None`` if it cannot
42
+ be determined.
43
+
44
+ :param path:
45
+ A :class:`string <str>` path containing the content to inspect.
46
+ ``~`` will be expanded.
47
+
48
+ :param content:
49
+ The :class:`bytes` content to inspect.
50
+
51
+ :returns:
52
+ A :class:`str`, or ``None`` if the format cannot be determined.
53
+ The return value can always be looked up in :data:`FILE_FORMAT_DESCRIPTIONS`
54
+ to return a human-readable description of the format found.
42
55
"""
43
56
if content :
44
57
peek = content [:PEEK_SIZE ]
You can’t perform that action at this time.
0 commit comments