Skip to content

Commit 7c6c5ff

Browse files
committed
remove unused _parse_text
1 parent e756776 commit 7c6c5ff

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

astroquery/xmatch/core.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
from io import StringIO, BytesIO
44

5-
from astropy.io import ascii, votable
5+
from astropy.io import votable
66
import astropy.units as u
77
from astropy.table import Table
88
from requests import HTTPError
99

10-
1110
from astroquery.query import BaseQuery
1211
from astroquery.exceptions import InvalidQueryError
1312
from astroquery.utils import url_helpers, prepend_docstr_nosections, async_to_sync
@@ -78,7 +77,7 @@ def query(self, cat1, cat2, max_distance,
7877
if get_query_payload:
7978
return response
8079

81-
return Table.read(BytesIO(response.content), format='votable')
80+
return Table.read(BytesIO(response.content), format='votable', use_names_over_ids=True)
8281

8382
@prepend_docstr_nosections("\n" + query.__doc__)
8483
def query_async(self, cat1, cat2, max_distance, colRA1=None, colDec1=None,
@@ -190,22 +189,5 @@ def get_available_tables(self, cache=True):
190189
content = response.text
191190
return content.splitlines()
192191

193-
def _parse_text(self, text):
194-
"""
195-
Parse a CSV text file that has potentially duplicated header names
196-
"""
197-
header = text.split("\n")[0]
198-
colnames = header.split(",")
199-
for column in colnames:
200-
if colnames.count(column) > 1:
201-
counter = 1
202-
while colnames.count(column) > 0:
203-
colnames[colnames.index(column)] = column + "_{counter}".format(counter=counter)
204-
counter += 1
205-
new_text = ",".join(colnames) + "\n" + "\n".join(text.split("\n")[1:])
206-
result = ascii.read(new_text, format='csv', fast_reader=False)
207-
208-
return result
209-
210192

211193
XMatch = XMatchClass()

astroquery/xmatch/tests/test_xmatch.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,3 @@ def test_xmatch_query_cat1_table_local(monkeypatch):
104104
'errHalfMaj', 'errHalfMin', 'errPosAng', 'Jmag', 'Hmag', 'Kmag',
105105
'e_Jmag', 'e_Hmag', 'e_Kmag', 'Qfl', 'Rfl', 'X', 'MeasureJD']
106106
assert len(table) == 11
107-
108-
109-
@pytest.mark.parametrize('datafile', DATA_FILES.values())
110-
def test_parse_text(datafile):
111-
xm = XMatch()
112-
xm._parse_text(datafile)

0 commit comments

Comments
 (0)