사용 중단된 이름

메서드와 속성의 원래 명명 규칙은 “camelCase”였습니다. 2013년경 생성 이후 PyMuPDF에서 기능이 크게 증가했고, 이에 따라 클래스, 메서드, 속성도 증가했습니다. 많은 경우 직관적이지 않고 논리적이지 않으며 기억하거나 추측하기 어려운 이름이 생겼습니다.

몇 버전 전, 단계적 접근이 필요한 큰 작업이었지만 “snake_cased” 명명 표준으로 전환하기로 했습니다. 이제는 완료된 것으로 봅니다(버전 1.18.14).

다음 목록은 사용 중단된 이름을 새 버전에 매핑합니다. 예를 들어, 속성 pageCountDocument 클래스에서 page_count 가 되었습니다. 덜 명확한 이름 변경도 있습니다. 예를 들어 메서드 getPNGdataPixmap 클래스에서 tobytes 로 이름이 변경되었습니다.

클래스 이름(카멜 케이스)과 패키지 전체 상수(대부분 대문자)는 변경되지 않았습니다.

이전 이름은 MuPDF 버전 1.19.0까지 사용 중단된 별칭으로 사용 가능하며, 그 이후 버전(아마도 버전 1.20.0이지만, 이는 상류 결정(MuPDF)에 따라 다름)에서 제거됩니다.

버전 1.19.0부터 별칭 메서드가 사용될 때 sys.stderrDeprecation: 'newPage' removed from class 'Document' after v1.19.0 - use 'new_page'. 와 같은 사용 중단 경고를 발행합니다. 사용 중단된 속성을 사용해도 이 유형의 경고는 발생하지 않습니다.

즉시부터 모든 사용 중단된 객체(메서드 및 속성)는 원본의 docstring 복사본을 표시하며, 사용 중단 메시지가 접두사 로 붙습니다. 예:

>>> print(pymupdf.Document.pageCount.__doc__)
*** Deprecated and removed in version following 1.19.0 - use 'page_count'. ***
Number of pages.
>>> print(pymupdf.Document.newPage.__doc__)
*** Deprecated and removed in version following 1.19.0 - use 'new_page'. ***
Create and return a new page object.

    Args:
        pno: (int) insert before this page. Default: after last page.
        width: (float) page width in points. Default: 595 (ISO A4 width).
        height: (float) page height in points. Default 842 (ISO A4 height).
    Returns:
        A Page object.

스크립트에서 대량 이름 변경을 수행하는 데 사용할 수 있는 유틸리티 스크립트 alias-changer.py 가 있습니다. 단일 파일 또는 폴더를 인수로 받습니다. 폴더가 제공되면 해당 폴더의 모든 Python 파일과 하위 폴더의 파일이 변경됩니다. 선택적으로 스크립트의 백업을 만들 수 있습니다.

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at artifex.com or contact Artifex Software Inc., 39 Mesa Street, Suite 108A, San Francisco CA 94129, United States for further information.