Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c8dc239f
Commit
c8dc239f
authored
Jan 10, 1997
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return preferences of unknown type as opaque data
parent
1754cdee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
Mac/Lib/ic.py
Mac/Lib/ic.py
+14
-1
No files found.
Mac/Lib/ic.py
View file @
c8dc239f
...
@@ -28,13 +28,24 @@ icReadOnlyPerm = 1
...
@@ -28,13 +28,24 @@ icReadOnlyPerm = 1
icReadWritePerm
=
2
icReadWritePerm
=
2
# End of ictypes.h
# End of ictypes.h
class
ICOpaqueData
:
"""An unparseable IC entry"""
def
__init__
(
self
,
data
):
self
.
data
=
data
def
__repr__
(
self
):
return
"ICOpaqueData(%s)"
%
`self.data`
_ICOpaqueDataType
=
type
(
ICOpaqueData
(
''
))
def
_decode_default
(
data
,
key
):
def
_decode_default
(
data
,
key
):
if
len
(
data
)
==
0
:
if
len
(
data
)
==
0
:
return
data
return
data
if
ord
(
data
[
0
])
==
len
(
data
)
-
1
:
if
ord
(
data
[
0
])
==
len
(
data
)
-
1
:
# Assume Pstring
# Assume Pstring
return
data
[
1
:]
return
data
[
1
:]
raise
error
,
"Unknown data format for key "
+
key
return
ICOpaqueData
(
data
)
def
_decode_multistr
(
data
,
key
):
def
_decode_multistr
(
data
,
key
):
numstr
=
ord
(
data
[
0
])
<<
8
|
ord
(
data
[
1
])
numstr
=
ord
(
data
[
0
])
<<
8
|
ord
(
data
[
1
])
...
@@ -134,6 +145,8 @@ def _decode(data, key):
...
@@ -134,6 +145,8 @@ def _decode(data, key):
return
decoder
(
data
,
key
)
return
decoder
(
data
,
key
)
def
_code
(
data
,
key
):
def
_code
(
data
,
key
):
if
type
(
data
)
==
_ICOpaqueDataType
:
return
data
.
data
if
'
\
245
'
in
key
:
if
'
\
245
'
in
key
:
key2
=
key
[:
string
.
index
(
key
,
'
\
245
'
)
+
1
]
key2
=
key
[:
string
.
index
(
key
,
'
\
245
'
)
+
1
]
else
:
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment