Beispiel #1
0
 def format(self, string):
     """format string and return html"""
     kwargs = dict()
     for key in format_keys.keys(string):
         value = getattr(self, key, None)
         kwargs[key] = value if value else ""
     return string.format(**kwargs)
Beispiel #2
0
 def format(self, string):
     """format string"""
     kwargs = dict()
     for key in format_keys.keys(string):
         value = getattr(self, key, None)
         if value is None:
             value = ""
         kwargs[key] = value
     return string.format(**kwargs).replace(" ", "%20")
Beispiel #3
0
 def format(self, string):
     """format string"""
     kwargs = dict()
     for key in format_keys.keys(string):
         value = getattr(self, key, None)
         if value is None:
             value = ""
         kwargs[key] = value
     return string.format(**kwargs).replace(" ", "%20")
Beispiel #4
0
#!/usr/bin/env python
import format_keys

string = "https://api.travis-ci.org/{fullname}.svg?branch={branch}"
keys = format_keys.keys(string)
print(keys)