관리-도구
편집 파일: plistlib.cpython-37.pyc
B � f�w � @ s. d Z ddddddddd d ddgZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl Z d dl Z d dlZd dlZd dl mZ d dlmZ ejdded�Ze� �ej� ejdd� �Zdd� Zdd� Zdd� Zdd� ZG dd� d�ZdZe�d�Z dJdd �Z!d!d"� Z"e�d#ej#�Z$d$d%� Z%d&d'� Z&d(d)� Z'G d*d+� d+�Z(G d,d-� d-�Z)G d.d/� d/e)�Z*d0d1� Z+G d2d� de,�Z-d3d4d5d6d7�Z.e/� Z0G d8d9� d9�Z1d:d;� Z2e3e4e5eje6fZ7G d<d=� d=e/�Z8d>d?� Z9e:e;e+e(e*d@�e<e;e9e1e8d@�iZ=ddAe;dB�dCd �Z>ddAe;dB�dDd�Z?e:dAdEdF�dGd �Z@e:dEdAdH�dId�ZAdS )Ka� plistlib.py -- a tool to generate and parse MacOSX .plist files. The property list (.plist) file format is a simple XML pickle supporting basic object types, like dictionaries, lists, numbers and strings. Usually the top level object is a dictionary. To write out a plist file, use the dump(value, file) function. 'value' is the top level object, 'file' is a (writable) file object. To parse a plist from a file, use the load(file) function, with a (readable) file object as the only argument. It returns the top level object (again, usually a dictionary). To work with plist data in bytes objects, you can use loads() and dumps(). Values can be strings, integers, floats, booleans, tuples, lists, dictionaries (but only with string keys), Data, bytes, bytearray, or datetime.datetime objects. Generate Plist example: pl = dict( aString = "Doodah", aList = ["A", "B", 12, 32.1, [1, 2, 3]], aFloat = 0.1, anInt = 728, aDict = dict( anotherString = "<hello & hi there!>", aUnicodeValue = "M\xe4ssig, Ma\xdf", aTrueValue = True, aFalseValue = False, ), someData = b"<binary gunk>", someMoreData = b"<lots of binary gunk>" * 10, aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())), ) with open(fileName, 'wb') as fp: dump(pl, fp) Parse Plist example: with open(fileName, 'rb') as fp: pl = load(fp) print(pl["aKey"]) � readPlist� writePlist�readPlistFromBytes�writePlistToBytes�Data�InvalidFileException�FMT_XML� FMT_BINARY�load�dump�loads�dumps� N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec c s2 t | t�r(t| |��}|V W d Q R X n| V d S )N)� isinstance�str�open)� pathOrFile�mode�fp� r �-/opt/alt/python37/lib64/python3.7/plistlib.py�_maybe_openO s r c C s0 t dtd� t| d��}t|ddd�S Q R X dS )z� Read a .plist from a path or file. pathOrFile should either be a file name, or a readable binary file object. This function is deprecated, use load instead. z8The readPlist function is deprecated, use load() instead� �rbNF)�fmt�use_builtin_types)r �DeprecationWarningr r )r r r r r r Y s c C s8 t dtd� t|d��}t| |tddd� W dQ R X dS )z� Write 'value' to a .plist file. 'pathOrFile' may either be a file name or a (writable) file object. This function is deprecated, use dump instead. z9The writePlist function is deprecated, use dump() insteadr �wbTF)r � sort_keys�skipkeysN)r r r r r )�valuer r r r r r f s c C s t dtd� tt| �ddd�S )z} Read a plist data from a bytes object. Return the root object. This function is deprecated, use loads instead. zBThe readPlistFromBytes function is deprecated, use loads() insteadr NF)r r )r r r r )�datar r r r s s c C s, t dtd� t� }t| |tddd� |�� S )zp Return 'value' as a plist-formatted bytes object. This function is deprecated, use dumps instead. zAThe writePlistToBytes function is deprecated, use dumps() insteadr TF)r r"