adriank / ObjectPath

The agile query language for semi-structured data
http://objectpath.org
MIT License
380 stars 93 forks source link

Add support for custom dictionaries (including OrderedDict) #25 #38

Closed hackerhelmut closed 8 years ago

hackerhelmut commented 9 years ago

This commit enables support for custom dictionaries. All types derived from list or dict or any other type used by ObjectPath will be supported.

Related to #25

adriank commented 9 years ago

Sorry for late response!

+# map and filter are build in functions not types. The returned type is always list +#try: ITER_TYPES+=[map, filter] +#except NameError: pass

This is not true. map and filter are different things in Py2 and Py3. Have you checked if OP works in both Python versions with this PR?

hackerhelmut commented 9 years ago

You are right, they are classes in python3. Anyway all tests pass in python2 and python3.

isinstance cannot handle non type objects in the type tuples therefore they have to disappear in python2. The try/except-block does not do the trick. The names filter and map are always defined either as function (python2) or as a class (python3). So I suggest to add the two classes only in python3 if needed.

if sys.version_info >= (3, 0):
    ITER_TYPES+=[map, filter]

Best regards

hackerhelmut commented 8 years ago

Hi again Adrian,

now that I could explain a little about the background of my work with ObjectPath in https://github.com/adriank/ObjectPath/pull/39#issuecomment-153342136 it might be more clear why I needed the changes from this pull request.

The YAML library I'm using is ruamel.yaml which extends the PyYAML library to be roundtrip capable (Preserves comments in the files in a load store cycle). The library makes heavy use of a extended objectdict base class and so far it works like a charm.

Best regards Rolf

adriank commented 8 years ago

Hi,

Sorry for not getting back to you sooner.

I'm supper busy nowadays doing my own startup. I will just accept the PR without much testing. If something breaks, I'll simply restore the previous version.

Accepting the PRs should be much quicker and thought out. The worst thing here is that I haven't used Python since last year. That's why I'm looking for someone to take over Python version of OP. Do you possibly know someone who would want to be one?

Greetings, Adrian Kalbarczyk

http://kalbarczyk.co/ http://about.me/akalbarczyk

On Tue, Nov 3, 2015 at 2:08 PM, Rolf Meyer notifications@github.com wrote:

Hi again Adrian,

now that I could explain a little about the background of my work with ObjectPath in #39 (comment) https://github.com/adriank/ObjectPath/pull/39#issuecomment-153342136 it might be more clear why I needed the changes from this pull request.

The YAML library I'm using is ruamel.yaml https://bitbucket.org/ruamel/yaml which extends the PyYAML library to be roundtrip capable (Preserves comments in the files in a load store cycle). The library makes heavy use of a extended objectdict base class and so far it works like a charm.

Best regards Rolf

— Reply to this email directly or view it on GitHub https://github.com/adriank/ObjectPath/pull/38#issuecomment-153347298.

hackerhelmut commented 8 years ago

Hi Adrian,

sorry for the long delay. I'm very busy at the moment too. One of my side projects makes great progress with ObjectPath, when I have time to spent on it. I've hoped I could bring the project into a presentable state before answering you, but I've hit a dead end. Until now I did not find a solution. Fortunately it might be solvable with ObjectPath as well, so after a few more retries I might come back to you ;-)

But to answer your question. Yes I would like to support you with OP. I'm a heavy user and hope to contribute more in the future.

Best regards Rolf

adriank commented 8 years ago

On Dec 15, 2015 2:25 PM, "Rolf Meyer" notifications@github.com wrote:

Hi Adrian,

sorry for the long delay. I'm very busy at the moment too. One of my side projects makes great progress with ObjectPath, when I have time to spent on it. I've hoped I could bring the project into a presentable state before answering you, but I've hit a dead end. Until now I did not find a solution. Fortunately it might be solvable with ObjectPath as well, so after a few more retries I might come back to you ;-)

You can throw this problem at me. Maybe a fresh look could save you time. :)

But to answer your question. Yes I would like to support you with OP. I'm a heavy user and hope to contribute more in the future.

Best regards Rolf

— Reply to this email directly or view it on GitHub https://github.com/adriank/ObjectPath/pull/38#issuecomment-164763842.