This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CanBark { | |
func bark() -> String | |
} | |
class Animal { | |
func animalType() -> String { | |
return "Animal" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
1. Inherit from the normal RadioInput and copy the RadioInput __unicode__ method. Then change it up how you please: | |
""" | |
class RadioInputNoWrap(RadioInput): | |
def __unicode__(self): | |
if 'id' in self.attrs: | |
label_for = ' for="%s_%s"' % (self.attrs['id'], self.index) | |
else: | |
label_for = '' | |
choice_label = conditional_escape(force_unicode(self.choice_label)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyparsing import * | |
# By default, PyParsing treats \n as whitespace and ignores it | |
# In our grammer, \n is significant, so tell PyParsing not to ignore it | |
ParserElement.setDefaultWhitespaceChars(" \t") | |
def parse(input_string): | |
def convert_prop_to_dict(tokens): | |
"""Convert a list of field property tokens to a dict""" | |
prop_dict = {} |