tarvitz / composite Goto Github PK
View Code? Open in Web Editor NEWcomposite
composite
Сейчас это воткнуто непосредственно в Document
There's iterate through lxml document that looks like this:
class XMLDocumentBuilder(BaseDocumentBuilder):
# ...
@classmethod
def iterate(cls, source):
"""
iterate through source document
:param lxml.etree.Element source: xml document
:rtype: generator
:return: tuple[node name, node]
"""
if isinstance(source, etree._Element):
for node in source.getchildren():
yield (node.tag, node)
else:
for name, item in source.items():
yield (name, item)
I suppose builder should not include check the type of object it iterates. Possible it could be resolved by somehow.
There's some magic numbers
inside of code should be resolved or stay.
Think about it, resolve if needed.
After making #6 there should be easily add other formats without making dependency hell.
to и некоторые from, а также то что используется внутри будут являться лишними, так как их ответственность выполняет builder классы
В процессе работы с библиотекой выяснилось, что обращение к дискриптору __dict__
инстанса класса Attributes происходит с ошибкой:
>>>offer.attributes.__dict__
*** TypeError: descriptor '__dict__' for 'Attributes' objects doesn't apply to 'Attributes' object
>>> type(offer.attributes)
<class '__main__.Attributes'>
using Field inside Attribute subclass would cause a problem with xml parser, this is not bug just because AttributeField should be use instead. Lock or think something suitable solution for that programming interface lock
from composite import Document
from composite.fields import Field, AttributeField
class UserAttributes(Document):
class Attribute:
age = Field('age', int) #: should be AttributeField
Now lxml is hard requirement, some would need to make xml-> conversions, some won't.
There should be possibility to weaken dependency coupling for lxml.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.