comparison piecrust/sources/interfaces.py @ 242:f130365568ff

internal: Code reorganization to put less stuff in `sources.base`. Interfaces that sources can implement are in `sources.interfaces`. The default page source is in `sources.default`. The `SimplePageSource` is gone since most subclasses only wanted to do *some* stuff the same, but *lots* of stuff slightly different. I may have to revisit the code to extract exactly the code that's in common.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 18 Feb 2015 18:35:03 -0800
parents
children 0c74a6c4533d
comparison
equal deleted inserted replaced
241:85a6c7ba5e3b 242:f130365568ff
1
2
3 class IPaginationSource(object):
4 """ Defines the interface for a source that can be used as the data
5 for an iterator or a pagination.
6 """
7 def getItemsPerPage(self):
8 raise NotImplementedError()
9
10 def getSourceIterator(self):
11 raise NotImplementedError()
12
13 def getSorterIterator(self, it):
14 raise NotImplementedError()
15
16 def getTailIterator(self, it):
17 raise NotImplementedError()
18
19 def getPaginationFilter(self, page):
20 raise NotImplementedError()
21
22 def getSettingAccessor(self):
23 raise NotImplementedError()
24
25
26 class IListableSource:
27 """ Defines the interface for a source that can be iterated on in a
28 hierarchical manner, for use with the `family` data endpoint.
29 """
30 def listPath(self, rel_path):
31 raise NotImplementedError()
32
33 def getDirpath(self, rel_path):
34 raise NotImplementedError()
35
36 def getBasename(self, rel_path):
37 raise NotImplementedError()
38
39
40 class IPreparingSource:
41 """ Defines the interface for a source whose pages can be created by the
42 `chef prepare` command.
43 """
44 def setupPrepareParser(self, parser, app):
45 raise NotImplementedError()
46
47 def buildMetadata(self, args):
48 raise NotImplementedError()
49
50