From 0687c64bbf42aecded1af93e108763f08eabb6db Mon Sep 17 00:00:00 2001 From: DavoudTaghawiNejad Date: Tue, 5 Sep 2017 11:20:15 -0300 Subject: [PATCH] Documents plugins --- .flake8 | 4 ++++ docs/index.rst | 1 + docs/plugins.rst | 35 +++++++++++++++++++++++++++++++++++ setup.py | 2 +- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .flake8 create mode 100644 docs/plugins.rst diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..1bc729e0 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +ignore = E501 +exclude = .git,__pycache__,docs/conf.py,old,build,dist + diff --git a/docs/index.rst b/docs/index.rst index 459418ac..12f9d51e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -58,6 +58,7 @@ Advanced MultiCurrencyTrade Quote spatial + plugins Graphical User Interface and Results ==================================== diff --git a/docs/plugins.rst b/docs/plugins.rst new file mode 100644 index 00000000..c8387ab6 --- /dev/null +++ b/docs/plugins.rst @@ -0,0 +1,35 @@ +Plugins +======= + +ABCE has one plugin so far. The ABCESL accounting framework. If +you want to author your own plugin - its dead simple. All you +have to do is write a class that inherits from Agent in agent.py. +This class can overwrite:: + + def init(self, parameter, agent_parameter) + def _begin_subround(self): + def _end_subround(self): + def _advance_round(self, time): + +For example like this:: + + class UselessAgent(abce.Agent): + def init(self, parameter, agent_parameter): + super().init() + print("Here i begin") + + def _begin_subround(self): + super()._begin_subround() + print('subround begins') + print("its %r o'clock" % self.time) + + def _end_subround(self): + super()._end_subround() + print('subround finishes') + + def _advance_round(self, time): + super()._advance_round(time) + print('Super I made it to the next round') + + def ability(self): + print("the simulation called my ability") diff --git a/setup.py b/setup.py index b8442de8..0124854f 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def build_extension(self, ext): 'bokeh == 0.12.7'] -version = '0.8.2a1' +version = '0.8.2a5' setup(name='abce',