Skip to content

Commit

Permalink
internals: remove docs
Browse files Browse the repository at this point in the history
not too much point documenting internal helpers...
  • Loading branch information
mara004 committed Mar 9, 2023
1 parent 212e4dd commit 0100cd4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
7 changes: 0 additions & 7 deletions src/pypdfium2/_helpers/_internal/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@


def set_autoclose_debug(value=True):
"""
Set autoclose debugging to define whether a message should be printed each time an object is finalized (opt-in).
True to enable (method default), False to disable.
"""
global DEBUG_AUTOCLOSE
DEBUG_AUTOCLOSE = value

Expand All @@ -26,9 +22,6 @@ class AutoCastable:

@property
def _as_parameter_(self):
"""
Ctypes hook to automatically return the underlying raw object of a wrapper class if used as C function parameter.
"""
return self.raw


Expand Down
31 changes: 0 additions & 31 deletions src/pypdfium2/_helpers/_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@


def color_tohex(color, rev_byteorder):
"""
Convert an RGBA color tuple to a single hex value (ARGB or ABGR).
Parameters:
color (tuple[int, int, int, int]):
rev_byteorder (bool):
If False, produce ARGB output.
If True, produce ABGR output for use with FPDF_REVERSE_BYTE_ORDER.
Returns:
int: Hex color value.
"""

if len(color) != 4:
raise ValueError("Color must consist of exactly 4 values.")
Expand All @@ -37,17 +26,6 @@ def color_tohex(color, rev_byteorder):


def set_callback(struct, fname, callback):
"""
Set a callback function on a struct.
This automates wrapping the callback in the corresponding CFUNCTYPE.
struct (ctypes.Structure):
The struct object.
fname (str):
Name of the target field for the callback.
callback (typing.Callable):
The callback function to assign to the field.
"""
setattr(struct, fname, type(getattr(struct, fname))(callback))


Expand Down Expand Up @@ -84,11 +62,6 @@ def __call__(self, _, data, size):


def get_bufreader(buffer):
"""
Returns:
(FPDF_FILEACCESS, tuple): PDFium interface struct wrapping the given readable buffer,
and a tuple of objects to keep alive while the buffer callback is used (as the struct object itself may be discarded earlier).
"""

buffer.seek(0, 2)
file_len = buffer.tell()
Expand All @@ -105,10 +78,6 @@ def get_bufreader(buffer):


def get_bufwriter(buffer):
"""
Returns:
FPDF_FILEWRITE: PDFium interface struct wrapping the given writeable buffer.
"""
writer = pdfium_c.FPDF_FILEWRITE(version=1)
set_callback(writer, "WriteBlock", _buffer_writer(buffer))
return writer
Expand Down

0 comments on commit 0100cd4

Please sign in to comment.