Skip to content

Commit

Permalink
Update configuration item names in template
Browse files Browse the repository at this point in the history
The template core module allows users to set configuration items in two
ways, either through the `astropy` configuration system or through class
or instance attributes. The attribute names are no longer in capital
letters because the convention is to reserve such names for constants,
and the configuration item names now match the attribute names.
  • Loading branch information
eerovaher committed Mar 28, 2022
1 parent cbd4900 commit 5137807
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion astroquery/template_module/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `astroquery.template_module`.
"""
server = _config.ConfigItem(
url = _config.ConfigItem(
['http://dummy_server_mirror_1',
'http://dummy_server_mirror_2',
'http://dummy_server_mirror_n'],
Expand Down
8 changes: 4 additions & 4 deletions astroquery/template_module/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ class TemplateClass(BaseQuery):
# The private properties defined here allow the users to change the
# configuration values at runtime, or to completely override them with
# instance attributes.
URL = '' # A falsy default that cannot be mistaken for a valid value.
TIMEOUT = None # Use `None` if the falsy value could be valid.
url = '' # A falsy default that cannot be mistaken for a valid value.
timeout = None # Use `None` if the falsy value could be valid.

@property
def _url(self):
return self.URL or conf.server
return self.url or conf.url

@property
def _timeout(self):
return conf.timeout if self.TIMEOUT is None else self.TIMEOUT
return conf.timeout if self.timeout is None else self.timeout

# all query methods are implemented with an "async" method that handles
# making the actual HTTP request and returns the raw HTTP response, which
Expand Down

0 comments on commit 5137807

Please sign in to comment.