MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Mac/Tools/plistlib_generate_testdata.py:24–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22
23
24def main():
25 pl = OrderedDict()
26
27 # Note: pl is an OrderedDict to control the order
28 # of keys, and hence have some control on the structure
29 # of the output file.
30 # New keys should be added in alphabetical order.
31
32 seconds = datetime.datetime(2004, 10, 26, 10, 33, 33, tzinfo=datetime.timezone(datetime.timedelta(0))).timestamp()
33 pl[nsstr('aBigInt')] = 2 ** 63 - 44
34 pl[nsstr('aBigInt2')] = NSNumber.numberWithUnsignedLongLong_(2 ** 63 + 44)
35 pl[nsstr('aDate')] = NSDate.dateWithTimeIntervalSince1970_(seconds)
36
37 pl[nsstr('aDict')] = d = OrderedDict()
38 d[nsstr('aFalseValue')] = False
39 d[nsstr('aTrueValue')] = True
40 d[nsstr('aUnicodeValue')] = "M\xe4ssig, Ma\xdf"
41 d[nsstr('anotherString')] = "<hello & 'hi' there!>"
42 d[nsstr('deeperDict')] = dd = OrderedDict()
43 dd[nsstr('a')] = 17
44 dd[nsstr('b')] = 32.5
45 dd[nsstr('c')] = a = NSMutableArray.alloc().init()
46 a.append(1)
47 a.append(2)
48 a.append(nsstr('text'))
49
50 pl[nsstr('aFloat')] = 0.5
51
52 pl[nsstr('aList')] = a = NSMutableArray.alloc().init()
53 a.append(nsstr('A'))
54 a.append(nsstr('B'))
55 a.append(12)
56 a.append(32.5)
57 aa = NSMutableArray.alloc().init()
58 a.append(aa)
59 aa.append(1)
60 aa.append(2)
61 aa.append(3)
62
63 pl[nsstr('aNegativeBigInt')] = -80000000000
64 pl[nsstr('aNegativeInt')] = -5
65 pl[nsstr('aString')] = nsstr('Doodah')
66
67 pl[nsstr('anEmptyDict')] = NSMutableDictionary.alloc().init()
68
69 pl[nsstr('anEmptyList')] = NSMutableArray.alloc().init()
70
71 pl[nsstr('anInt')] = 728
72
73 pl[nsstr('nestedData')] = a = NSMutableArray.alloc().init()
74 a.append(b'''<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03''')
75
76
77 pl[nsstr('someData')] = b'<binary gunk>'
78
79 pl[nsstr('someMoreData')] = b'''<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03<lots of binary gunk>\x00\x01\x02\x03'''
80
81 pl[nsstr('\xc5benraa')] = nsstr("That was a unicode key.")

Callers 1

Calls 8

OrderedDictClass · 0.90
nsstrFunction · 0.85
timestampMethod · 0.80
datetimeMethod · 0.80
_encode_base64Function · 0.70
initMethod · 0.45
appendMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…