MCPcopy
hub / github.com/microsoft/markitdown / StreamInfo

Class StreamInfo

packages/markitdown/src/markitdown/_stream_info.py:6–32  ·  view source on GitHub ↗

The StreamInfo class is used to store information about a file stream. All fields can be None, and will depend on how the stream was opened.

Source from the content-addressed store, hash-verified

4
5@dataclass(kw_only=True, frozen=True)
6class StreamInfo:
7 """The StreamInfo class is used to store information about a file stream.
8 All fields can be None, and will depend on how the stream was opened.
9 """
10
11 mimetype: Optional[str] = None
12 extension: Optional[str] = None
13 charset: Optional[str] = None
14 filename: Optional[
15 str
16 ] = None # From local path, url, or Content-Disposition header
17 local_path: Optional[str] = None # If read from disk
18 url: Optional[str] = None # If read from url
19
20 def copy_and_update(self, *args, **kwargs):
21 """Copy the StreamInfo object and update it with the given StreamInfo
22 instance and/or other keyword arguments."""
23 new_info = asdict(self)
24
25 for si in args:
26 assert isinstance(si, StreamInfo)
27 new_info.update({k: v for k, v in asdict(si).items() if v is not None})
28
29 if len(kwargs) > 0:
30 new_info.update(kwargs)
31
32 return StreamInfo(**new_info)

Callers 15

get_shape_contentMethod · 0.90
_convertFunction · 0.90
_convertFunction · 0.90
_convertFunction · 0.90
_convertFunction · 0.90
test_guess_stream_infoFunction · 0.90

Calls

no outgoing calls

Tested by 15

_convertFunction · 0.72
_convertFunction · 0.72
_convertFunction · 0.72
_convertFunction · 0.72
test_guess_stream_infoFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…