SHARE
TWEET

Untitled

a guest Sep 14th, 2011 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> from multiprocessing.managers import BaseManager
  2. >>>
  3. >>> class DataManager(BaseManager): pass
  4. ...
  5. >>> DataManager.register('get_data')
  6. >>> m = DataManager(address=('127.0.0.1', 7349), authkey='authKey')
  7. >>> m.connect()
  8. >>> q = m.get_data()
  9. >>>
  10. >>> dir(q)
  11. ['_Client', '__builtins__', '__class__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_address_to_local', '_after_fork', '_authkey', '_callmethod', '_close', '_connect', '_decref', '_exposed_', '_getvalue', '_id', '_idset', '_incref', '_isauto', '_manager', '_mutex', '_serializer', '_tls', '_token', 'close', 'create', 'delete', 'exists', 'finish', 'get', 'internalLock', 'isDir', 'isFile', 'open', 'remove', 'set', 'tree']
  12. >>> q.create('/testing')
  13. True
  14. >>> q.set('/testing/dir1/dir2/file1', Value='FFFFFFF')
  15. True
  16. >>> q.get('/testing/dir1/dir2/file1')
  17. "'FFFFFFF'"
  18. >>> q.tree()
  19. [('/', []), (u'/testing', []), (u'/testing/dir1', []), (u'/testing/dir1/dir2', [u'file1'])]
  20. >>> q.exists('/testing/dir1/dir2/file1')
  21. True
  22. >>> q.exists('/testing/dir1/dir2/file2')
  23. False
  24. >>> q.isDir('/testing')
  25. True
  26. >>> q.isDir('/testing/dir1/dir2/file1')
  27. False
  28. >>> q.delete('/testing/dir1')
  29. True
  30. >>> q.tree()
  31. [('/', []), (u'/testing', [])]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top