36
36
@async_to_sync
37
37
class TemplateClass (BaseQuery ):
38
38
39
- """
40
- Not all the methods below are necessary but these cover most of the common
41
- cases, new methods may be added if necessary, follow the guidelines at
42
- <http://astroquery.readthedocs.io/en/latest/api.html>
43
- """
39
+ # `__init__()` allows the user to conveniently set the instance attributes
40
+ # to override the configuration items. The default attribute values should
41
+ # be falsy (`x` is called falsy if `bool(x)` is `False`) or `None`.
42
+ def __init__ (self , url = '' , timeout = None ):
43
+ self .url = url # A falsy default that cannot be mistaken for a valid value.
44
+ self .timeout = timeout # Use `None` as default if the falsy value could be valid.
44
45
45
46
# The private properties defined here allow the users to change the
46
- # configuration values at runtime, or to completely override them with
47
- # instance attributes.
48
- url = '' # A falsy default that cannot be mistaken for a valid value.
49
- timeout = None # Use `None` if the falsy value could be valid.
47
+ # configuration values at runtime if the corresponding instance attributes
48
+ # have default values.
50
49
51
50
@property
52
51
def _url (self ):
@@ -56,6 +55,12 @@ def _url(self):
56
55
def _timeout (self ):
57
56
return conf .timeout if self .timeout is None else self .timeout
58
57
58
+ """
59
+ Not all the methods below are necessary but these cover most of the common
60
+ cases, new methods may be added if necessary, follow the guidelines at
61
+ <http://astroquery.readthedocs.io/en/latest/api.html>
62
+ """
63
+
59
64
# all query methods are implemented with an "async" method that handles
60
65
# making the actual HTTP request and returns the raw HTTP response, which
61
66
# should be parsed by a separate _parse_result method. The query_object
@@ -332,7 +337,7 @@ def extract_image_urls(self, html_str):
332
337
pass
333
338
334
339
335
- # the default tool for users to interact with is an instance of the Class
340
+ # the default tool for users to interact with is a default instance of the Class
336
341
Template = TemplateClass ()
337
342
338
343
# once your class is done, tests should be written
0 commit comments