From 60a99d3a44df897cd94cc02c8ad1fb41c2799d23 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Wed, 20 Jul 2016 21:09:54 +0200 Subject: [PATCH] change method name: to_dict --- patacrep/content/__init__.py | 2 +- patacrep/content/section.py | 2 +- patacrep/content/setcounter.py | 2 +- patacrep/content/song.py | 2 +- patacrep/content/songsection.py | 2 +- patacrep/content/tex.py | 2 +- patacrep/tools/content/__main__.py | 2 +- .../datadir/python/content/customplugin.py | 2 +- .../datadir_zippedcontent/python/content | Bin 418 -> 416 bytes test/test_content/test_content.py | 2 +- 10 files changed, 9 insertions(+), 9 deletions(-) diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index 3edc0cf3..12e9bed9 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -116,7 +116,7 @@ class ContentItem: """Return the string to end a block.""" return "" - def file_entry(self): + def to_dict(self): """Return the dict representation (as in the yaml file).""" raise NotImplementedError() diff --git a/patacrep/content/section.py b/patacrep/content/section.py index 403e2072..78776d5c 100755 --- a/patacrep/content/section.py +++ b/patacrep/content/section.py @@ -28,7 +28,7 @@ class Section(ContentItem): else: return r'\{}[{}]{{{}}}'.format(self.keyword, self.short, self.name) - def file_entry(self): + def to_dict(self): if self.short is None or self.keyword not in KEYWORDS: return {self.keyword: self.name} else: diff --git a/patacrep/content/setcounter.py b/patacrep/content/setcounter.py index 0b20b223..400ce26b 100755 --- a/patacrep/content/setcounter.py +++ b/patacrep/content/setcounter.py @@ -14,7 +14,7 @@ class CounterSetter(ContentItem): """Set the value of the counter.""" return r'\setcounter{{{}}}{{{}}}'.format(self.name, self.value) - def file_entry(self): + def to_dict(self): return {'setcounter': {'name': self.name, 'value': self.value}} #pylint: disable=unused-argument diff --git a/patacrep/content/song.py b/patacrep/content/song.py index 73ace8cf..dc35b5ae 100755 --- a/patacrep/content/song.py +++ b/patacrep/content/song.py @@ -63,7 +63,7 @@ class SongRenderer(ContentItem): """Order by song path""" return self.song.fullpath < other.song.fullpath - def file_entry(self): + def to_dict(self): return {'song': self.song.fullpath} #pylint: disable=unused-argument diff --git a/patacrep/content/songsection.py b/patacrep/content/songsection.py index 57d4e5e7..132c0666 100755 --- a/patacrep/content/songsection.py +++ b/patacrep/content/songsection.py @@ -19,7 +19,7 @@ class SongSection(ContentItem): """Render this section or chapter.""" return r'\{}{{{}}}'.format(self.keyword, self.name) - def file_entry(self): + def to_dict(self): return {self.keyword: self.name} #pylint: disable=unused-argument diff --git a/patacrep/content/tex.py b/patacrep/content/tex.py index 9346e725..ef588d04 100755 --- a/patacrep/content/tex.py +++ b/patacrep/content/tex.py @@ -20,7 +20,7 @@ class LaTeX(ContentItem): os.path.dirname(context['filename']), ))) - def file_entry(self): + def to_dict(self): return {'tex': self.filename} #pylint: disable=unused-argument diff --git a/patacrep/tools/content/__main__.py b/patacrep/tools/content/__main__.py index a2b65977..0d64c480 100644 --- a/patacrep/tools/content/__main__.py +++ b/patacrep/tools/content/__main__.py @@ -50,7 +50,7 @@ def do_content_items(namespace): yaml_dir = os.path.dirname(os.path.abspath(namespace.songbook)) ref_dir = os.path.join(yaml_dir, 'songs') content_items = [ - normalize_song_path(item.file_entry(), ref_dir) + normalize_song_path(item.to_dict(), ref_dir) for item in content_items ] sys.stdout.write(yaml.safe_dump(content_items, allow_unicode=True, default_flow_style=False)) diff --git a/test/test_content/datadir/python/content/customplugin.py b/test/test_content/datadir/python/content/customplugin.py index d579aca8..b835459c 100755 --- a/test/test_content/datadir/python/content/customplugin.py +++ b/test/test_content/datadir/python/content/customplugin.py @@ -5,7 +5,7 @@ from patacrep.content import ContentItem, ContentList, validate_parser_argument class FakeContent(ContentItem): """Fake content.""" - def file_entry(self): + def to_dict(self): return {'customname':''} def parse(keyword, argument, config): diff --git a/test/test_content/datadir_zippedcontent/python/content b/test/test_content/datadir_zippedcontent/python/content index 9c4371ffabcccf1b23b62812e5283125317ec209..2c5e1ee5d2b83ddf2659a4c0e18c2736892ceb6e 100644 GIT binary patch delta 334 zcmZ3)yntCYz?+#xgn@y9gW>jyFCKmmGI<{WdAW=X45AD&lj9gA>Ny#h&z|lNKL^C6 z72FJrEH9WD7{Eks|G})o20U%=>$o0z3vtvo9P&$*Zk@z;ZSFA+wQ0?nGSZRvZXCN; z`|*(z-(_EqU;F)oPO+D|as*4g?vvb37U~txbjR- zGWW9G_@&GW7&I@5lvYZJM-TVI;#Rix#bZ=qk6UF`l&Ub+6q&xfAd3nph7 zpSZDc$273;6I_lI8t;?fFk21b?_%nS@* zBDdey`-p)++xwrQ&U(2E-|$C#*s?-LC$zw}bIJujuNyUnGqqO#xSyLNR#lKU`C;vR z^`KMirH&nC^Lp52IV6Og=V-RIWU4O}aSARF5MAA9@UHEFq-}Gdp}^t9*#4e%dv(<( z?`Y*utv|a$;`a&-#jjnfx;TPZv?`|E3gUk25Klk_Z%da1A>^*RI|C6aZF4Qvycr!A|i7;acm&qQC`b<~bCs#5m LvKcZ0Ly7?apSO#r diff --git a/test/test_content/test_content.py b/test/test_content/test_content.py index 14a56800..78fef0ea 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -54,7 +54,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): with logging_reduced('patacrep.content.song'): expandedlist = content.process_content(sbcontent, config) - sourcelist = [cls._clean_path(elem.file_entry()) for elem in expandedlist] + sourcelist = [cls._clean_path(elem.to_dict()) for elem in expandedlist] controlname = "{}.control".format(base) if not os.path.exists(controlname):