refactoring

This commit is contained in:
frankknoll
2023-10-10 09:12:36 +02:00
parent fde9844b88
commit e457568ef6
4 changed files with 11 additions and 37 deletions

View File

@@ -1,21 +1,7 @@
from bs4 import BeautifulSoup
from SymptomsCausedByVaccines.OptionsSetter import OptionsSetter
class BatchcodeOptionsSetter:
def setBatchcodeOptions(self, html, options):
soup = self._setBatchcodeOptions(self._parse(html), self._parseOptions(options))
return str(soup)
def _setBatchcodeOptions(self, soup, options):
batchcodeSelect = soup.find(id = "batchCodeSelect")
batchcodeSelect.clear()
for option in options:
batchcodeSelect.append(option)
return soup
def _parseOptions(self, options):
return [self._parse(option).option for option in options]
def _parse(self, html):
return BeautifulSoup(html, 'lxml')
return OptionsSetter().setOptions(html, 'batchCodeSelect', options)