Debian Codegraph @

stubs/calibre_extensions/speedup.pyi

raw
1 from datetime import datetime
2 from typing import Any
3
4 def deepcopy(object: Any) -> Any:
5 "Fast implementation of deepcopy()"
6 pass
7
8 def parse_date(text: str) -> tuple[int, int, int, int, int, int, int] | None:
9 "Parse ISO dates faster (specialized for dates stored in the calibre db)."
10 pass
11
12 def parse_iso8601(text: str) -> tuple[datetime, bool, int]:
13 "Parse ISO 8601 dates faster. More spec compliant than parse_date()"
14 pass
15
16 def pdf_float(val: float) -> str:
17 "Convert float to a string representation suitable for PDF"
18 pass
19
20 def detach(path: str) -> None:
21 "Redirect the standard I/O stream to the specified file (usually os.devnull)"
22 pass
23
24 def create_texture(
25 width: int,
26 height: int,
27 red: int,
28 green: int,
29 blue: int,
30 blend_red: int = 0,
31 blend_green: int = 0,
32 blend_blue: int = 0,
33 blend_alpha: float = 0.1,
34 density: float = 0.7,
35 weight: int = 3,
36 radius: float = 1,
37 ) -> bytes:
38 """Create a texture of the specified width and height from the specified color.
39
40 The texture is created by blending in random noise of the specified blend color into
41 a flat image. All colors are numbers between 0 and 255. 0 <= blend_alpha <= 1 with 0
42 being fully transparent. 0 <= density <= 1 is used to control the amount of noise in
43 the texture. weight and radius control the Gaussian convolution used for blurring of
44 the noise. weight must be an odd positive integer. Increasing the weight will tend to
45 blur out the noise. Decreasing it will make it sharper. This function returns an image
46 (bytestring) in the PPM format as the texture.
47 """
48 pass
49
50 def websocket_mask(data: bytearray | memoryview, mask: bytes | memoryview, offset: int = 0) -> None:
51 "XOR the data (bytestring) with the specified (must be 4-byte bytestring) mask"
52 pass
53
54 def utf8_decode(data: bytes, state: int = 0, codep: int = 0) -> tuple[str, int, int]:
55 "Decode an UTF-8 bytestring, using a strict UTF-8 decoder, that unlike python does not allow orphaned surrogates. Returns a unicode object and the state."
56 pass
57
58 def clean_xml_chars(unicode_object: str) -> str:
59 "Remove codepoints in unicode_object that are not allowed in XML"
60 pass
61
62 def set_thread_name(name: str) -> None:
63 "Wrapper for pthread_setname_np"
64 pass
65
66 def pread_all(fd: int, n: int, offset: int = 0) -> bytes:
67 """Read upto n bytes from the specified fd at offset in a thread safe manner.
68
69 If less than n bytes are returned it means there were less than n bytes in the file
70 at offset. Only works with seekable regular files, not sockets/ttys/etc. Note that on
71 Windows it moves the file pointer so cannot be mixed with calls to tell() or ordinary
72 reads.
73 """
74 pass
75
76 def get_num_of_significant_chars(elem: Any) -> int:
77 "Get the number of chars in specified tag"
78 pass
79
80 def barename(tag: str) -> str:
81 "Get bare tag name without namespace"
82 pass
83
84 def namespace(tag: str) -> str:
85 "Get namespace of the tag"
86 pass
87
88 O_CLOEXEC: int