Skip to content

Commit bafbef8

Browse files
committed
MAINT: remove deprecated usage of BeautifulSoup
1 parent b8df567 commit bafbef8

9 files changed

Lines changed: 16 additions & 16 deletions

File tree

astroquery/alma/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,9 +1162,9 @@ def _cycle0_tarfile_content(self):
11621162
# <tr width="blah"> which the default parser does not pick up
11631163
root = BeautifulSoup(response.content, 'html.parser')
11641164
html_table = root.find('table', class_='grid listing')
1165-
data = list(zip(*[(x.findAll('td')[0].text,
1166-
x.findAll('td')[1].text)
1167-
for x in html_table.findAll('tr')]))
1165+
data = list(zip(*[(x.find_all('td')[0].text,
1166+
x.find_all('td')[1].text)
1167+
for x in html_table.find_all('tr')]))
11681168
columns = [Column(data=data[0], name='ID'),
11691169
Column(data=data[1], name='Files')]
11701170
tbl = Table(columns)

astroquery/cosmosim/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ def download(self, jobid=None, filename=None, format=None, cache=True):
11091109
auth=(self.username, self.password))
11101110
soup = BeautifulSoup(results.content, "lxml")
11111111
urls = [i.get('xlink:href')
1112-
for i in soup.findAll({'uws:result'})]
1112+
for i in soup.find_all({'uws:result'})]
11131113
formatlist = [urls[i].split('/')[-1].upper()
11141114
for i in range(len(urls))]
11151115

astroquery/eso/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ def list_surveys(self, *, cache=True):
348348
collections_table = root.find('table', id='collections_table')
349349
other_collections = root.find('select', id='collection_name_option')
350350
# it is possible to have empty collections or other collections...
351-
collection_elts = (collections_table.findAll('input', type='checkbox')
351+
collection_elts = (collections_table.find_all('input', type='checkbox')
352352
if collections_table is not None
353353
else [])
354-
other_elts = (other_collections.findAll('option')
354+
other_elts = (other_collections.find_all('option')
355355
if other_collections is not None
356356
else [])
357357
for element in (collection_elts + other_elts):
@@ -969,7 +969,7 @@ def _print_surveys_help(self, url, *, cache=True):
969969

970970
# hovertext from different labels are used to give more info on forms
971971
helptext_dict = {abbr['title'].split(":")[0].strip(): ":".join(abbr['title'].split(":")[1:])
972-
for abbr in form.findAll('abbr')
972+
for abbr in form.find_all('abbr')
973973
if 'title' in abbr.attrs and ":" in abbr['title']}
974974

975975
for fieldset in form.select('fieldset'):

astroquery/ipac/irsa/ibe/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def list_missions(self, *, cache=True):
271271
cache=cache)
272272

273273
root = BeautifulSoup(response.text, 'html5lib')
274-
links = root.findAll('a')
274+
links = root.find_all('a')
275275

276276
missions = [os.path.basename(a.attrs['href'].rstrip('/')) for a in links]
277277
self._missions = missions
@@ -309,7 +309,7 @@ def list_datasets(self, *, mission=None, cache=True):
309309
cache=cache)
310310

311311
root = BeautifulSoup(response.text, 'html5lib')
312-
links = root.findAll('a')
312+
links = root.find_all('a')
313313
datasets = [a.text for a in links
314314
if a.attrs['href'].count('/') >= 4 # shown as '..'; ignore
315315
]
@@ -364,7 +364,7 @@ def list_tables(self, *, mission=None, dataset=None, cache=True):
364364
cache=cache)
365365

366366
root = BeautifulSoup(response.text, 'html5lib')
367-
return [tr.find('td').string for tr in root.findAll('tr')[1:]]
367+
return [tr.find('td').string for tr in root.find_all('tr')[1:]]
368368

369369
# Unfortunately, the URL construction for each data set is different, and
370370
# they're not obviously accessible via API

astroquery/linelists/cdms/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def query_lines_async(self, min_frequency, max_frequency, *,
156156
soup = BeautifulSoup(response.text, 'html.parser')
157157

158158
ok = False
159-
urls = [x.attrs['src'] for x in soup.findAll('frame',)]
159+
urls = [x.attrs['src'] for x in soup.find_all('frame',)]
160160
for url in urls:
161161
if 'tab' in url and 'head' not in url:
162162
ok = True

astroquery/simbad/get_votable_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def reload_votable_fields_json():
1717
# Find the first <table> tag that follows it
1818
table = foundtext.findNext('table')
1919
outd = {}
20-
for row in table.findAll('tr'):
20+
for row in table.find_all('tr'):
2121
cols = row.findChildren('td')
2222
if len(cols) > 1:
2323
smallest_child = cols[0].find_all()[-1]

astroquery/skyview/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,10 @@ def survey_dict(self):
283283
response = self._request('GET', self.URL, cache=False)
284284
response.raise_for_status()
285285
page = BeautifulSoup(response.content, "html.parser")
286-
surveys = page.findAll('select', {'name': 'survey'})
286+
surveys = page.find_all('select', {'name': 'survey'})
287287

288288
self._survey_dict = {
289-
sel['id']: [x.text for x in sel.findAll('option')]
289+
sel['id']: [x.text for x in sel.find_all('option')]
290290
for sel in surveys
291291
if 'overlay' not in sel['id']
292292
}

astroquery/splatalogue/build_species_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_json_species_ids(*, outfile='splat-species.json', base_url=conf.base_url
5353
result = requests.get(f'{base_url}/b.php')
5454
page = bs4.BeautifulSoup(result.content, 'html5lib')
5555
# The ID needs to be checked periodically if Splatalogue is updated
56-
sid = page.findAll('select', attrs={'id': 'speciesselectbox'})[0]
56+
sid = page.find_all('select', attrs={'id': 'speciesselectbox'})[0]
5757

5858
species_types = set()
5959
for kid in sid.children:

astroquery/wfau/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def _get_databases(self):
665665

666666
root = BeautifulSoup(response.content, features='html5lib')
667667
databases = [xrf.attrs['value'] for xrf in
668-
root.find('select').findAll('option')]
668+
root.find('select').find_all('option')]
669669
return databases
670670

671671
def list_databases(self):

0 commit comments

Comments
 (0)