def grammar_init(self): self.coefficient = default( self.find('coefficient'), Coefficient.from_attributes(numerator='1', denominator='1')) self.compound = self.find('compound') self.charge = default(self.find('charge'), Charge.from_attributes(value='0', sign='')) self.state = default(self.find('state'), State.from_attributes(state=''))
def grammar_init(self): self.item = self.get('element') or self.get('group') self.count = default(string(self.get('number')), '1')
def grammar_init(self): self.value = default(string(self.find('number')), '1') self.sign = string(self.find('sign'))