shelve

Hg (Mercurial): any way to “set aside” the working copy for later?

社会主义新天地 提交于 2019-11-30 07:21:21
Scenario: After your last commit, you decided to do some extensive refactoring of the codebase. After a time, you realize it is taking longer than expected, and you'd really rather put off the refactoring for another time, and work on more pressing tasks. But you don't want to lose all of the refactoring work you've done so far. So, is there a way to "archive" or "branch" the working copy (essentially, set it aside but keep it in the repository for later access), and then revert to the last good commit and resume from there, without fear of creating multiple heads or getting the two mixed up?

Shelve is too slow for large dictionaries, what can I do to improve performance?

只谈情不闲聊 提交于 2019-11-30 04:59:50
I am storing a table using python and I need persistence. Essentially I am storing the table as a dictionary string to numbers. And the whole is stored with shelve self.DB=shelve.open("%s%sMoleculeLibrary.shelve"%(directory,os.sep),writeback=True) I use writeback to True as I found the system tends to be unstable if I don't. After the computations the system needs to close the database, and store it back. Now the database (the table) is about 540MB, and it is taking ages. The time exploded after the table grew to about 500MB. But I need a much bigger table. In fact I need two of them. I am

Hg (Mercurial): any way to “set aside” the working copy for later?

爷,独闯天下 提交于 2019-11-29 09:14:31
问题 Scenario: After your last commit, you decided to do some extensive refactoring of the codebase. After a time, you realize it is taking longer than expected, and you'd really rather put off the refactoring for another time, and work on more pressing tasks. But you don't want to lose all of the refactoring work you've done so far. So, is there a way to "archive" or "branch" the working copy (essentially, set it aside but keep it in the repository for later access), and then revert to the last

What is the difference between pickle and shelve?

对着背影说爱祢 提交于 2019-11-28 16:57:10
I am learning about object serialization for the first time. I tried reading and 'googling' for differences in the modules pickle and shelve but I am not sure I understand it. When to use which one? Pickle can turn every python object into stream of bytes which can be persisted into a file. Then why do we need the module shelve? Isn't pickle faster? pickle is for serializing some object (or objects) as a single bytestream in a file. shelve builds on top of pickle and implements a serialization dictionary where objects are pickled, but associated with a key (some string), so you can load your

Can I unshelve to a different branch in tfs 2008?

空扰寡人 提交于 2019-11-28 15:08:45
Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt) Curt Hagenlocher The Visual Studio Power Tools should let you do this. C:\src\2\Merlin\Main>tfpt unshelve /? tfpt unshelve - Unshelve into workspace with pending changes Allows a shelveset to be unshelved into a workspace with pending changes. Merges content between local and shelved changes. Allows migration of shelved changes from one branch into another by rewriting server paths. Usage: tfpt unshelve

Shelve Code gives KeyError

拜拜、爱过 提交于 2019-11-28 09:16:56
问题 I wanted to use the following code from here: How can I save all the variables in the current python session? import shelve T='Hiya' val=[1,2,3] filename='/tmp/shelve.out' my_shelf = shelve.open(filename,'n') # 'n' for new for key in dir(): try: my_shelf[key] = globals()[key] except TypeError: # # __builtins__, my_shelf, and imported modules can not be shelved. # print('ERROR shelving: {0}'.format(key)) my_shelf.close() But it gives the following error: Traceback (most recent call last): File

Pickle versus shelve storing large dictionaries in Python

社会主义新天地 提交于 2019-11-28 07:28:45
If I am storing a large directory as a pickle file, does loading it via cPickle mean that it will all be consumed into memory at once? If so, is there a cross platform way to get something like pickle , but access each entry one key at a item (i.e. avoid loading all of the dictionary into memory and only load each entry by name)? I know shelve is supposed to do this: is that as portable as pickle though? I know shelve is supposed to do this: is that as portable as pickle though? Yes. shelve is part of The Python Standard Library and is written in Python. Edit So if you have a large dictionary:

Python shelve module question

余生颓废 提交于 2019-11-27 18:33:37
问题 Does the Python shelve module have any protection built in to make sure two processes aren't writing to a file at the same time? 回答1: The shelve module uses an underlying database package (such as dbm, gdbm or bsddb) . The restrictions pragraph says (my emphasis): The shelve module does not support concurrent read/write access to shelved objects . (Multiple simultaneous read accesses are safe.) When a program has a shelf open for writing, no other program should have it open for reading or

What is Shelving in TFS?

半世苍凉 提交于 2019-11-27 09:57:19
Is shelving in TFS merely a soft checkin so other team members can see the source code? i.e. the shelved code will not be compiled right? TJB Shelving has many uses. The main ones are: Context Switching : Saving the work on your current task so you can switch to another high priority task. Say you're working on a new feature, minding your own business, when your boss runs in and says "Ahhh! Bug Bug Bug!" and you have to drop your current changes on the feature and go fix the bug. You can shelve your work on the feature, fix the bug, then come back and unshelve to work on your changes later.

What is the difference between pickle and shelve?

喜夏-厌秋 提交于 2019-11-27 09:56:22
问题 I am learning about object serialization for the first time. I tried reading and 'googling' for differences in the modules pickle and shelve but I am not sure I understand it. When to use which one? Pickle can turn every python object into stream of bytes which can be persisted into a file. Then why do we need the module shelve? Isn't pickle faster? 回答1: pickle is for serializing some object (or objects) as a single bytestream in a file. shelve builds on top of pickle and implements a