GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rhwp-python/tests/type_check_samples.py at main · DanMeon/rhwp-python

Expand file tree

/

type_check_samples.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
43 lines (31 loc) · 1.29 KB
/

type_check_samples.py

Copy path

File metadata and controls

43 lines (31 loc) · 1.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""타입 스텁 검증 — 정상 케이스. pyright 가 오류 0건을 보고해야 함.
pytest 는 test_*.py 패턴만 수집하므로 이 파일은 자동 제외된다.
pyright 전용: `uv run pyright tests/type_check_samples.py`
"""
import rhwp
def valid_usage() -> None:
pkg_ver: str = rhwp.version()
core_ver: str = rhwp.rhwp_core_version()
print(pkg_ver, core_ver)
doc: rhwp.Document = rhwp.parse("a.hwp")
sections: int = doc.section_count
paras: int = doc.paragraph_count
pages: int = doc.page_count
text: str = doc.extract_text()
plist: list[str] = doc.paragraphs()
repr_str: str = repr(doc)
print(sections, paras, pages, len(text), len(plist), repr_str)
def direct_constructor() -> None:
doc = rhwp.Document("a.hwp")
text: str = doc.extract_text()
print(text)
def rendering_usage() -> None:
# ^ Stage 3: SVG/PDF 렌더링 타입 검증
doc = rhwp.parse("a.hwp")
svg: str = doc.render_svg(0)
svgs: list[str] = doc.render_all_svg()
written: list[str] = doc.export_svg("/tmp/out", prefix="page")
written_default: list[str] = doc.export_svg("/tmp/out")
pdf: bytes = doc.render_pdf()
size: int = doc.export_pdf("/tmp/out.pdf")
print(len(svg), len(svgs), len(written), len(written_default), len(pdf), size)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.