Skip to content

Commit c7979d8

Browse files
committed
Always use bare from astroquery import log
1 parent 2d724c6 commit c7979d8

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

astroquery/cosmosim/core.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Astropy imports
2020
from astropy.table import Table
2121
import astropy.io.votable as votable
22-
from astroquery import log as logging
22+
from astroquery import log
2323

2424
# Astroquery imports
2525
from ..query import QueryWithLogin
@@ -72,8 +72,8 @@ def _login(self, username=None, password=None, store_password=False,
7272

7373
# login after login (interactive)
7474
if hasattr(self, 'username'):
75-
logging.warning("Attempting to login while another user ({0}) "
76-
"is already logged in.".format(self.username))
75+
log.warning("Attempting to login while another user ({0}) "
76+
"is already logged in.".format(self.username))
7777
self.check_login_status()
7878
return
7979

@@ -144,7 +144,7 @@ def logout(self, deletepw=False):
144144
del self.username
145145
del self.password
146146
else:
147-
logging.error("You must log in before attempting to logout.")
147+
log.error("You must log in before attempting to logout.")
148148

149149
def check_login_status(self):
150150
"""
@@ -220,8 +220,8 @@ def run_sql_query(self, query_string, tablename=None, queue=None,
220220
gen_tablename = "{0}".format(phase)
221221
else:
222222
gen_tablename = str(soup.find(id="table").string)
223-
logging.warning("Table name {0} is already taken."
224-
.format(tablename))
223+
log.warning("Table name {0} is already taken."
224+
.format(tablename))
225225
warnings.warn("Generated table name: {0}".format(gen_tablename))
226226
elif tablename is None:
227227
result = self._request('POST', CosmoSim.QUERY_URL,
@@ -293,7 +293,7 @@ def check_job_status(self, jobid=None):
293293
auth=(self.username, self.password), data={'print': 'b'},
294294
cache=False)
295295

296-
logging.info("Job {}: {}".format(jobid, response.content))
296+
log.info("Job {}: {}".format(jobid, response.content))
297297
return response.content
298298

299299
def check_all_jobs(self, phase=None, regex=None, sortby=None):
@@ -586,7 +586,7 @@ def completed_job_info(self, jobid=None, output=False):
586586
elif len(dictkeys) == 1:
587587
print(self.response_dict_current[dictkeys[0]]['content'])
588588
else:
589-
logging.error('No completed jobs found.')
589+
log.error('No completed jobs found.')
590590
return
591591
else:
592592
return
@@ -680,7 +680,7 @@ def general_job_info(self, jobid=None, output=False):
680680
auth=(self.username, self.password), cache=False)]
681681

682682
if response_list[0].ok is False:
683-
logging.error('Must provide a valid jobid.')
683+
log.error('Must provide a valid jobid.')
684684
return
685685
else:
686686
self.response_dict_current = {}
@@ -940,7 +940,7 @@ def explore_db(self, db=None, table=None, col=None):
940940
for key in self.db_dict[db].keys()]
941941
size2 = len(max(slist, key=np.size))
942942
except (KeyError, NameError):
943-
logging.error("Must first specify a valid database.")
943+
log.error("Must first specify a valid database.")
944944
return
945945
# if col is specified, table must be specified, and I need to
946946
# check the max size of any given column in the structure
@@ -954,13 +954,13 @@ def explore_db(self, db=None, table=None, col=None):
954954
[table]['columns']
955955
[col].keys())))
956956
except(KeyError, NameError):
957-
logging.error("Must first specify a valid column "
958-
"of the `{0}` table within the `{1}`"
959-
" db".format(table, db))
957+
log.error("Must first specify a valid column "
958+
"of the `{0}` table within the `{1}`"
959+
" db".format(table, db))
960960
return
961961
except (KeyError, NameError):
962-
logging.error("Must first specify a valid table within "
963-
"the `{0}` db.".format(db))
962+
log.error("Must first specify a valid table within "
963+
"the `{0}` db.".format(db))
964964
return
965965

966966
t['Projects'] = (['--> @ {}:'.format(db)] +
@@ -1202,7 +1202,7 @@ def _check_phase(self, jobid):
12021202
time.sleep(1)
12031203

12041204
if jobid not in self.job_dict.keys():
1205-
logging.error("Job not present in job dictionary.")
1205+
log.error("Job not present in job dictionary.")
12061206
return
12071207

12081208
else:
@@ -1291,7 +1291,7 @@ def _initialize_alerting(self, jobid, mail=None, text=None):
12911291
self._smspw = password_from_keyring
12921292

12931293
if not password_from_keyring:
1294-
logging.warning("CosmoSim SMS alerting has not been initialized.")
1294+
log.warning("CosmoSim SMS alerting has not been initialized.")
12951295
warnings.warn("Initializing SMS alerting.")
12961296
keyring.set_password("astroquery:cosmosim.SMSAlert",
12971297
self._smsaddress, "LambdaCDM")

astroquery/gemini/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from datetime import date
1010

11-
from astroquery import log as logger
11+
from astroquery import log
1212
from astropy import units
1313
from astropy.table import Table, MaskedColumn
1414

@@ -128,7 +128,7 @@ def _login(self, username, password):
128128
params = dict(username=username, password=password)
129129
r = self._session.request('POST', 'https://archive.gemini.edu/login/', params=params)
130130
if b'<P>Welcome, you are sucessfully logged in' not in r.content:
131-
logger.error('Unable to login, please check your credentials')
131+
log.error('Unable to login, please check your credentials')
132132
return False
133133
return True
134134

0 commit comments

Comments
 (0)