MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / _make_output

Function _make_output

src/__init__.py:46–161  ·  view source on GitHub ↗

Returns a stream that writes to a specified destination, which can be a file descriptor, a file, an existing stream or Python's `logging' system. Args: text: text specification of destination. fd: - write to file descriptor. path: - write t

(
        *,
        text=None,
        fd=None,
        stream=None,
        path=None,
        path_append=None,
        pylogging=None,
        pylogging_logger=None,
        pylogging_level=None,
        pylogging_name=None,
        default=None,
        )

Source from the content-addressed store, hash-verified

44#
45
46def _make_output(
47 *,
48 text=None,
49 fd=None,
50 stream=None,
51 path=None,
52 path_append=None,
53 pylogging=None,
54 pylogging_logger=None,
55 pylogging_level=None,
56 pylogging_name=None,
57 default=None,
58 ):
59 '''
60 Returns a stream that writes to a specified destination, which can be a
61 file descriptor, a file, an existing stream or Python's `logging' system.
62
63 Args:
64 text: text specification of destination.
65 fd:<int> - write to file descriptor.
66 path:<str> - write to file.
67 path+:<str> - append to file.
68 logging:<items> - write to Python `logging` module.
69 items: comma-separated <name=value> pairs.
70 level=<int>
71 name=<str>.
72 Other names are ignored.
73
74 fd: an int file descriptor.
75 stream: something with methods .write(text) and .flush().
76 If specified we simply return <stream>.
77 path: a file path.
78 If specified we return a stream that writes to this file.
79 path_append: a file path.
80 If specified we return a stream that appends to this file.
81 pylogging*:
82 if any of these args is not None, we return a stream that writes to
83 Python&#x27;s `logging` module.
84
85 pylogging:
86 Unused other than to activate use of logging module.
87 pylogging_logger:
88 A logging.Logger; If None, set from <pylogging_name>.
89 pylogging_level:
90 An int log level, if None we use
91 pylogging_logger.getEffectiveLevel().
92 pylogging_name:
93 Only used if <pylogging_logger> is None:
94 If <pylogging_name> is None, we set it to 'pymupdf'.
95 Then we do: pylogging_logger = logging.getLogger(pylogging_name)
96 ''&#x27;
97 if text is not None:
98 # Textual specification, for example from from environment variable.
99 if text.startswith('fd:'):
100 fd = int(text[3:])
101 elif text.startswith('path:'):
102 path = text[5:]
103 elif text.startswith('path+'):

Callers 3

__init__.pyFile · 0.85
set_messagesFunction · 0.85
set_logFunction · 0.85

Calls 2

OutClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…