From 7286ae9b61e32a80cff2b965dc20d206eb576525 Mon Sep 17 00:00:00 2001 From: Adam Ginsburg Date: Mon, 2 Mar 2015 14:03:31 +0100 Subject: [PATCH 1/2] SIMBAD: return strings in python3 instead of bytes (plus a really minor edit to ALMA logging) --- astroquery/alma/core.py | 1 + astroquery/simbad/core.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/astroquery/alma/core.py b/astroquery/alma/core.py index e327fb25ea..b42b15f9fe 100644 --- a/astroquery/alma/core.py +++ b/astroquery/alma/core.py @@ -226,6 +226,7 @@ def stage_data(self, uids): #'ALMA+uid___A002_X391d0b_X7b' #payload = [('dataset','ALMA+'+clean_uid(uid)) for uid in uids] payload = {'dataset':['ALMA+'+clean_uid(uid) for uid in uids]} + self._staging_log['first_post_url'] = url log.debug("First request payload: {0}".format(payload)) self._staging_log = {} diff --git a/astroquery/simbad/core.py b/astroquery/simbad/core.py index 6fe7b89e93..7649ab6f69 100644 --- a/astroquery/simbad/core.py +++ b/astroquery/simbad/core.py @@ -892,17 +892,20 @@ def nb_errors(self): class SimbadVOTableResult(SimbadResult): """VOTable-type Simbad result""" def __init__(self, txt, verbose=False, pedantic=False): - SimbadResult.__init__(self, txt, verbose=verbose) self.__pedantic = pedantic self.__table = None - if not self.verbose: + if not verbose: commons.suppress_vo_warnings() + super(SimbadVOTableResult, self).__init__(txt, verbose=verbose) @property def table(self): if self.__table is None: - self.__table = votable.parse_single_table(BytesIO(self.data.encode('utf8')), pedantic=False).to_table() + self.bytes = BytesIO(self.data.encode('utf8')) + tbl = votable.parse_single_table(self.bytes, pedantic=False) + self.__table = tbl.to_table() + self.__table.convert_bytestring_to_unicode() return self.__table bibcode_regex = re.compile(r'query\s+bibcode\s+(wildcard)?\s+([\w]*)') From 79b08cc6807f963fc46512b760bd14a433d93cd3 Mon Sep 17 00:00:00 2001 From: Adam Ginsburg Date: Mon, 2 Mar 2015 15:49:40 +0100 Subject: [PATCH 2/2] that silly little ALMA change broke all the tests. --- astroquery/alma/core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/astroquery/alma/core.py b/astroquery/alma/core.py index b42b15f9fe..078c9b70a5 100644 --- a/astroquery/alma/core.py +++ b/astroquery/alma/core.py @@ -226,10 +226,9 @@ def stage_data(self, uids): #'ALMA+uid___A002_X391d0b_X7b' #payload = [('dataset','ALMA+'+clean_uid(uid)) for uid in uids] payload = {'dataset':['ALMA+'+clean_uid(uid) for uid in uids]} - self._staging_log['first_post_url'] = url log.debug("First request payload: {0}".format(payload)) - self._staging_log = {} + self._staging_log = {'first_post_url':url} # Request staging for the UIDs # This component cannot be cached, since the returned data can change