Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Command class and stream_has_colours #15

Merged
merged 6 commits into from
Oct 26, 2014

Conversation

gmatteo
Copy link
Contributor

@gmatteo gmatteo commented Oct 25, 2014

Hi Shyue, could you release a new minor version of monty and update the requirement in pymatgen? Thanks in advance

@shyuep
Copy link
Contributor

shyuep commented Oct 26, 2014

Hi Matteo, I don't think the command class belongs in shutil. Probably subprocess or even os?

Also, what's the use case for MongoDict? Just a note that there is a package called mongomock that does mocking of a Mongo DB.

@gmatteo
Copy link
Contributor Author

gmatteo commented Oct 26, 2014

Hi Shyue,

I've moved Command to monty.subprocess.

MongoDict is a dict-like object that allows one to access the entries in a nested dict as attributes.
Entries (attributes) cannot be modified. It also provides Ipython tab completion hence this object
is particularly useful if you need to analyze a nested dict interactively (e.g. documents
extracted from a MongoDB database) or if you have to access a key in one of the nested dict
Example:

foo = {"k1": {"k2": {"k3": 3}}}
m = MongoDict(foo)

Now one can access foo["k1"]["k2"]["k3"] with the much simpler notation
m.k1.k2.k3

I decided to call it MongoDict, just to remind me that the keys in the dictionary must be strings
but the object is not directly related to the pymongo API

Matteo

@computron
Copy link

Regarding mongodict there may be existing solutions, eg
https://pypi.python.org/pypi/easydict/

@shyuep
Copy link
Contributor

shyuep commented Oct 26, 2014

 I will merge Matteo’s contributions. I think this is easy enough to implement and include in monty without relying on an outside solution.

Shyue Ping

On October 26, 2014 at 07:48:48, Anubhav Jain (notifications@github.com) wrote:

Regarding mongodict there may be existing solutions, eg
https://pypi.python.org/pypi/easydict/


Reply to this email directly or view it on GitHub.

shyuep added a commit that referenced this pull request Oct 26, 2014
Add Command class and stream_has_colours
@shyuep shyuep merged commit 9e1c544 into materialsvirtuallab:master Oct 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants