Skip to content

Develop catalogues#6

Closed
ashleythomasbarnes wants to merge 40 commits intoeso:develop-cataloguesfrom
ashleythomasbarnes:develop-catalogues
Closed

Develop catalogues#6
ashleythomasbarnes wants to merge 40 commits intoeso:develop-cataloguesfrom
ashleythomasbarnes:develop-catalogues

Conversation

@ashleythomasbarnes
Copy link
Collaborator

New PR from #4 to help @juanmcloaiza for review...

Stripped back now, only query_catalogue and list_catalogues that mirror functionality of other functions included.

@@ -19,7 +19,9 @@ class Conf(_config.ConfigNamespace):
tap_url = _config.ConfigItem(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename tap_url --> tap_obs_url and its explanation as well, so that it is symmetrical with the config entry for catalogues.

row_limit_plus_one = self.ROW_LIMIT + 1

table_with_an_extra_row = tap.search(query=query_str, maxrec=row_limit_plus_one).to_table()
table_with_an_extra_row = tap.search(query=query_str,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself: Either this 4-lines change 1) has no effect; 2) is wrong; or 3) the previous code is wrong. Double check...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashleythomasbarnes, you can safely discard these changes (i.e. keep the original code). Explanation:

The proposed code change has no effect. It seems that the AI didn't understand the purpose of the if clause, and it was natural for it to turn it into a if...else clause.

The original if clause is only a safeguard against increasing an infinite row limit. It was introduced to fix a bug appearing when the user set ROW_LIMIT = 0. If we want to sound very mathematically elegant, we can say that it simply derives from the fact that ∞ +1 = ∞

)

log.debug(f"Querying from {self._tap_url()}")
tap_url = self._tap_url() if which_tap == "tap_obs" else conf.tap_cat_url
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here... This is another instance of the situation not being symmetrical between tap_cat and tap_obs: One is read from self._tap_url(); the other from the config directly. It is OK to have tap_obs set as a default, but for the rest tap_cat and tap_obs should be symmetrical. Do we have a good argument for them NOT being treated the same?

f"\nNumber of records present in the table {table_name}:\n{num_records}\n")

@unlimited_maxrec
@deprecated_renamed_argument('cache', None, since='0.4.12')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for deprecating anything here, since it is a new function. We can remove the cache argument.

from dataclasses import dataclass
from typing import Dict, List, Optional, Union

import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numpy is not used. This line should be removed.

Copy link
Collaborator

@juanmcloaiza juanmcloaiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Only one change needed (about sys.maxsize), and one would-be-nice (about which_tap and tap_url) -- see the comments to the code.

The tests are still failing, but as soon as they pass, the PR can be merged.

table_with_an_extra_row = Table()

def message(query_str):
which_tap = tap.baseurl.split("/")[-1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks hacky. It works, but it doesn't give us freedom to define a new "which_tap" key or rename the existing ones, if they don't follow exactly this convention. I'd propose to create a very small helper function that is the inverse of _tap_url. Example:

# This one exists:
def _tap_url(self, which_tap: str = "tap_obs") -> str:
    # Returns the URL given the which_tap label
    # Raises if the label is not recognized

# Define this one, the inverse:
def _which_tap(self, tap_url: str = conf.tap_obs_url) -> str:
    # Returns the which_tap label given a URL
    # Raises if the URL is not recognized

Not a hard requirement to merge the PR, since this is the only instance where we need to recover which_tap from the tap_url, but it would make the code tidier.

@ashleythomasbarnes ashleythomasbarnes changed the base branch from develop to develop-catalogues February 13, 2026 13:46
@ashleythomasbarnes ashleythomasbarnes deleted the branch eso:develop-catalogues February 13, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants