Esempio n. 1
0
 def get_json(self, category):
     atomic_weight = elementParser.parseAtomicWeight(self.__process_atomic_weight())
     atomic_mass = atomic_weight[0]
     atomic_mass_uncertainty = atomic_weight[1]
     jsonElement = {
         "atomic_number":            elementParser.parseAtomicNumber(      self.tds[0].find(text=True)),
         "symbol":                   elementParser.parseSymbol(            self.tds[1].find(text=True)),
         # "name":                   tds[2].find(text=True),
         # "etymology":              tds[3].findAll(text=True),
         "group":                    elementParser.parseGroup(             self.tds[4].find(text=True)),
         "period":                   elementParser.parsePeriod(            self.tds[5].find(text=True)),
         "density":                  elementParser.parseDensity(           self.tds[7].find(text=True)),
         "melting_point":            elementParser.parseTemperatureKelvin( self.tds[8].find(text=True)),
         "boiling_point":            elementParser.parseTemperatureKelvin( self.tds[9].find(text=True)),
         "specific_heat_capacity":   elementParser.parseTemperatureKelvin( self.tds[10].find(text=True)),
         "electronegativity":        elementParser.parseElectronegativity( self.tds[11].find(text=True)),
         "atomic_mass":              atomic_mass,
         "atomic_mass_uncertainty":  atomic_mass_uncertainty,
         "category":                 category
         # "abundance":              tds[12].string
     }
     jsonElement["href"] = self.tds[2].a.get("href")
     return jsonElement
Esempio n. 2
0
 def get_json(self, category):
     atomic_weight = elementParser.parseAtomicWeight(
         self.__process_atomic_weight())
     atomic_mass = atomic_weight[0]
     atomic_mass_uncertainty = atomic_weight[1]
     jsonElement = {
         "atomic_number":
         elementParser.parseAtomicNumber(self.tds[0].find(text=True)),
         "symbol":
         elementParser.parseSymbol(self.tds[1].find(text=True)),
         # "name":                   tds[2].find(text=True),
         # "etymology":              tds[3].findAll(text=True),
         "group":
         elementParser.parseGroup(self.tds[4].find(text=True)),
         "period":
         elementParser.parsePeriod(self.tds[5].find(text=True)),
         "density":
         elementParser.parseDensity(self.tds[7].find(text=True)),
         "melting_point":
         elementParser.parseTemperatureKelvin(self.tds[8].find(text=True)),
         "boiling_point":
         elementParser.parseTemperatureKelvin(self.tds[9].find(text=True)),
         "specific_heat_capacity":
         elementParser.parseTemperatureKelvin(self.tds[10].find(text=True)),
         "electronegativity":
         elementParser.parseElectronegativity(self.tds[11].find(text=True)),
         "atomic_mass":
         atomic_mass,
         "atomic_mass_uncertainty":
         atomic_mass_uncertainty,
         "category":
         category
         # "abundance":              tds[12].string
     }
     jsonElement["href"] = self.tds[2].a.get("href")
     return jsonElement
Esempio n. 3
0
 def testParsePeriod(self):
     self.assertEqual(1, elementParser.parsePeriod("1"))
     self.assertEqual(2, elementParser.parsePeriod(" 2"))
     self.assertEqual(3, elementParser.parsePeriod("3 "))
 def testParsePeriod(self):
     self.assertEqual(1, elementParser.parsePeriod("1"))
     self.assertEqual(2, elementParser.parsePeriod(" 2"))
     self.assertEqual(3, elementParser.parsePeriod("3 "))