shelve

Selecting between shelve and sqlite for really large dictionary (Python)

冷暖自知 提交于 2019-12-03 16:56:14
问题 I have a large Python dictionary of vectors (150k vectors, 10k dimensions each) of float numbers that can't be loaded into memory, so I have to use one of the two methods for storing this on disk and retrieving specific vectors when appropriate. The vectors will be created and stored once, but might be read many (thousands of) times -- so it is really important to have efficient reading. After some tests with shelve module, I tend to believe that sqlite will be a better option for this kind

How to download TFS shelveset

拟墨画扇 提交于 2019-12-03 14:38:11
问题 I need to download a shelveset from TFS to a local folder. Is there any tools or add-in for Visual studio 2010 to download shelveset 回答1: If you just need to get the files from the shelveset to your local folder , this is a normal process and called Unshelve. It downloads the files to your local folder. For example, before unshelve you had the following in your local folder : File 1 File 2 The shelveset has: File 1 (Modified) File 3 (Created) After unshelve there will be: File 1 (Updated)

Selecting between shelve and sqlite for really large dictionary (Python)

白昼怎懂夜的黑 提交于 2019-12-03 07:01:28
I have a large Python dictionary of vectors (150k vectors, 10k dimensions each) of float numbers that can't be loaded into memory, so I have to use one of the two methods for storing this on disk and retrieving specific vectors when appropriate. The vectors will be created and stored once, but might be read many (thousands of) times -- so it is really important to have efficient reading. After some tests with shelve module, I tend to believe that sqlite will be a better option for this kind of task, but before I start writing code I would like to hear some more opinions on this... For example,

Using python shelve cross-platform

别等时光非礼了梦想. 提交于 2019-12-03 06:07:40
I am hoping for a little advice on shelves/databases in Python. Problem: I have a database created on the mac, that I want to use on windows 7. I use Python 3.2, MacOS 10.7, and win 7. When I open and save my shelve on the mac all is good and well. I get a file with a ".db" extension. On my windows-python it is not recognized. I can however create a new db on the pc and get files with ".bak, dat, .dir" extensions. I am guessing that the python on the pc does not have the same underlying database that my mac-python uses? I am not sure which is the correct approach here, but maybe I could:

How to download TFS shelveset

大憨熊 提交于 2019-12-03 05:23:55
I need to download a shelveset from TFS to a local folder. Is there any tools or add-in for Visual studio 2010 to download shelveset If you just need to get the files from the shelveset to your local folder , this is a normal process and called Unshelve . It downloads the files to your local folder. For example, before unshelve you had the following in your local folder : File 1 File 2 The shelveset has: File 1 (Modified) File 3 (Created) After unshelve there will be: File 1 (Updated) File 2 File 3 (Added) If you need to have only the files from the shelveset in your workspace folder without

Automatic shelve before pulling in Mercurial (with TortoiseHG)?

允我心安 提交于 2019-12-01 22:32:14
问题 I have some changed files I don't want to commit (e.g. web.config). Before I pull and update to new changesets, I have to shelve them. After the pull & update, I have to unshelve them. I'm currently using TortoiseHG. Is there any extension which can do this automatically? 回答1: I'd suggest something else: instead of always shelving and unshelving, you could use two different config files: one which is part of the repository and contains dummy/example data, and another one which each user

Automatic shelve before pulling in Mercurial (with TortoiseHG)?

时光怂恿深爱的人放手 提交于 2019-12-01 21:51:04
I have some changed files I don't want to commit (e.g. web.config). Before I pull and update to new changesets, I have to shelve them. After the pull & update, I have to unshelve them. I'm currently using TortoiseHG. Is there any extension which can do this automatically? Christian Specht I'd suggest something else: instead of always shelving and unshelving, you could use two different config files: one which is part of the repository and contains dummy/example data, and another one which each user really uses locally, which is ignored by Mercurial. Check out this answer for a more detailed

shelve db type could not be determined, whichdb is not recognizing gdb

我怕爱的太早我们不能终老 提交于 2019-12-01 12:29:19
Why shelve raise an error if I try to open a file just created by shelve? import shelve info_file_name = "/Users/bacon/myproject/temp/test.info" info_file = shelve.open(info_file_name) info_file['ok'] = 'wass' info_file.close() info_file = shelve.open(info_file_name) # raise exception db type could not be determined.. info_file.close() I'm running python 2.5 in case is relevant The precise error is raising is: db type could not be determined its raised by anydbm.py open method. I know it;s using gdbm. I checked on the whichdb.py file, and it tries to identify gdbm files with this # Read the

shelve db type could not be determined, whichdb is not recognizing gdb

限于喜欢 提交于 2019-12-01 10:26:51
问题 Why shelve raise an error if I try to open a file just created by shelve? import shelve info_file_name = "/Users/bacon/myproject/temp/test.info" info_file = shelve.open(info_file_name) info_file['ok'] = 'wass' info_file.close() info_file = shelve.open(info_file_name) # raise exception db type could not be determined.. info_file.close() I'm running python 2.5 in case is relevant The precise error is raising is: db type could not be determined its raised by anydbm.py open method. I know it;s

python populate a shelve object/dictionary with multiple keys

三世轮回 提交于 2019-11-30 16:25:56
问题 I have a list of 4-grams that I want to populate a dictionary object/shevle object with: ['I','go','to','work'] ['I','go','there','often'] ['it','is','nice','being'] ['I','live','in','NY'] ['I','go','to','work'] So that we have something like: four_grams['I']['go']['to']['work']=1 and any newly encountered 4-gram is populated with its four keys, with the value 1, and its value is incremented if it is encountered again. 回答1: You could do something like this: import shelve from collections