palankai / baluster Goto Github PK
View Code? Open in Web Editor NEWPython optionally nested factory and fixture
License: MIT License
Python optionally nested factory and fixture
License: MIT License
It's still a design question
lets rename make to factory and move it to class level
Being able to move it to beta state I have to try in a real(istic) application
Make sure the begin step actually works (without using the context manager)
Considering the close operation should has only effect those resources which was opened inside the context. Possible need to have some enter() method
Proxy
that encapsulates the root storeiscoroutinefunction
callsclass Root(Holder):
value = Holder.value_factory()
value_default = Holder.value_factory(default=1)
non_primitive_value = Holder.value_factory(default=lambda: dict())
Test lower level classes, remove redundant tests
obj = ApplicationContext()
obj['some_data'] = 'some data'
assert obj['some_data'] == 'some data'
If that's all possible, make it work regardless of the version
In some cases, the easiest way would be something like that to init the context:
class Context(Baluster):
@placeholders.factory
def some_value(self, root):
return 1
def setup(self):
# Do some initialisation, which better be not postponed
# like parsing, validating arguments is better at this point
clashs Root(Holder):
@Holder.factory(params='env', root=False)
def debug(self, params):
return params.get('DEBUG', False)
If the first level class (direct childclass of Baluster) inherited, that class doesn't work.
More info...
class BaseCxt(Baluster):
@placeholders.factory
def something(self):
retrurn 1
class Ctx(BaseCtx):
pass
c = Ctx()
c.somethging
It raise an ugly error
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.