ch01-12: clean up by @eumiro
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env jython
|
||||
# NOTE: Jython is still Python 2.7 in late2020
|
||||
|
||||
import Confidential
|
||||
|
||||
message = Confidential('top secret text')
|
||||
secret_field = Confidential.getDeclaredField('secret')
|
||||
secret_field.setAccessible(True) # break the lock!
|
||||
print('message.secret =', secret_field.get(message))
|
||||
print 'message.secret =', secret_field.get(message)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#!/usr/bin/env jython
|
||||
# NOTE: Jython is still Python 2.7 in late2020
|
||||
|
||||
from java.lang.reflect import Modifier
|
||||
import Confidential
|
||||
|
||||
@@ -7,5 +10,5 @@ for field in fields:
|
||||
# list private fields only
|
||||
if Modifier.isPrivate(field.getModifiers()):
|
||||
field.setAccessible(True) # break the lock
|
||||
print('field:', field)
|
||||
print('\t', field.getName(), '=', field.get(message))
|
||||
print 'field:', field
|
||||
print '\t', field.getName(), '=', field.get(message)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#!/usr/bin/env jython
|
||||
# NOTE: Jython is still Python 2.7 in late2020
|
||||
|
||||
"""
|
||||
In the Jython registry file there is this line:
|
||||
|
||||
@@ -13,4 +16,4 @@ message = Confidential('top secret text')
|
||||
for name in dir(message):
|
||||
attr = getattr(message, name)
|
||||
if not callable(attr): # non-methods only
|
||||
print(name + '\t=', attr)
|
||||
print name + '\t=', attr
|
||||
|
||||
@@ -83,8 +83,6 @@ Tests of hashing:
|
||||
>>> len({v1, v2})
|
||||
2
|
||||
|
||||
# end::VECTOR2D_V3_DEMO[]
|
||||
|
||||
"""
|
||||
|
||||
from array import array
|
||||
|
||||
Reference in New Issue
Block a user