Comments (3)
An instance of a class does not have an attribute __qualname__
, while a class does:
In [1]: class A:
...: pass
...:
In [2]: getattr(A, '__qualname__')
Out[2]: 'A'
In [3]: a = A()
In [4]: getattr(a, '__qualname__')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-b3b9d698fe71> in <module>()
----> 1 getattr(a, '__qualname__')
The fact that the Goblin
class attribute __mapping__
is an instance of Mapping
seems to throw a wrench in napoleon
's member checking for doc inclusion (though I haven't looked into this in depth):
In [5]: from goblin import Edge
In [6]: class MyEdge(Edge):
...: pass
...:
In [7]: getattr(MyEdge.__mapping__, '__qualname__')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/home/davebshow/git/goblin/goblin/mapper.py in __getattr__(self, value)
207 try:
--> 208 mapping, _ = self._ogm_properties[value]
209 return mapping
KeyError: '__qualname__'
During handling of the above exception, another exception occurred:
MappingError Traceback (most recent call last)
<ipython-input-8-0082f3e0d57c> in <module>()
----> 1 getattr(MyEdge.__mapping__, '__qualname__')
/home/davebshow/git/goblin/goblin/mapper.py in __getattr__(self, value)
211 raise exception.MappingError(
212 "unrecognized property {} for class: {}".format(
--> 213 value, self._element_type))
214
215 def _map_properties(self, properties):
MappingError: unrecognized property __qualname__ for class: edge
Based on Python's data model, I believe this is the expected behavior in this case. Maybe this could be fixed in the napoleon
source code by checking isinstance(obj, type)
before looking for __qualname__
...but again, I haven't looked into it really, so I'm not positive
from goblin.
I agree with your analysis. I just looked into the napoleon source code and their documentation indicates that obj
is expected to be "module, class, exception, function, method, or attribute". They clearly weren't thinking of the case where a class attribute is actually a class instance. Adding isinstance(obj, type)
should fix that. Though it may be a little more complicated since functions are technically not an instance of type. I'll submit an issue on napoleon for this.
from goblin.
Hi @rosenbrockc. I was just curious, what project is this for? I am interested to know how you are using goblin. Thanks!
from goblin.
Related Issues (20)
- Reference instance to test goblin against HOT 3
- How to change version of Goblin OGM Serializer for Janusgraph (TinkerPop 3.2.6) HOT 3
- TypeError: unhashable type: 'dict' when creating an Edge HOT 10
- goblin does not work with aiohttp>=3.0.0 HOT 5
- Question about using a multi-value/set VertexProperty HOT 6
- Vertex property gets changed from Gremlin Console but not from Python/Goblin script HOT 2
- goblin not working with aiohttp (server) HOT 2
- Mocking JanusGraph Connection for unit tests
- Add method to easily remove Vertex HOT 1
- The project appears idle, can I take over? HOT 10
- Problem with Edge data type HOT 5
- App/Cluster configuration using URL HOT 3
- Schema generator HOT 3
- Belated License change HOT 5
- Question: Extent to which OO modeling is supported in Goblin HOT 7
- How to use mixed index in goblin? HOT 4
- AttributeError: AsyncGraphTraversal.last_traverser HOT 1
- [Proposal] - OGM distinct from driver HOT 7
- Ability to set vertex or edge ID HOT 5
- Unexpected results when updating property HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goblin.