Jonathan Eunice avatar Jonathan Eunice committed ee539af

added escape method; updated to take latest options

Comments (0)

Files changed (2)

         Make a say object with the given options.
         self.options = Say.options.push(kwargs)
+    @staticmethod
+    def escape(s):
+        """
+        Double { and } characters in a string to 'escape' them so ``str.format``
+        doesn't treat them as template characters. NB This is NOT idempotent!
+        Escaping more than once (when { or } are present ) = ERROR.
+        """
+        return s.replace('{', '{{').replace('}', '}}') 
     def hr(self, sep=six.u('\u2500'), width=40, vsep=0, **kwargs):
-    version=verno("0.829"),
+    version=verno("0.832"),
     author='Jonathan Eunice',
     description='Super-simple templated printing. E.g.: say("Hello, {whoever}!", indent=1)',
-    install_requires=['six', 'options>=0.4', 'stuf>=0.9.10'],
+    install_requires=['six', 'options>=0.426', 'stuf>=0.9.10'],
     tests_require = ['tox', 'pytest', 'six'],
     zip_safe = True,
     keywords='print format template interpolate say show',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.