kerchunk icon indicating copy to clipboard operation
kerchunk copied to clipboard

added new module and necessary refactorings

Open Anu-Ra-g opened this issue 1 year ago • 6 comments

This PR adds a new module called _grib_idx.py with private functions and added necessary refactorings

Anu-Ra-g avatar Sep 08 '24 18:09 Anu-Ra-g

How does this one relate to #499 ?

martindurant avatar Sep 09 '24 15:09 martindurant

@martindurant I've made the changes as you asked. But the pre-commit is failing on the unused imports when I made the function as user facing in kerchunk.grib2 module.

Anu-Ra-g avatar Sep 10 '24 13:09 Anu-Ra-g

the pre-commit is failing on the unused imports

You can fix this by including an __all__, which should be a list of strings to be considered as "public" in the module. Making this list has two effects:

  • making the imports look like they are used
  • defining what gets imported if you were to do from kerchunk.grib import *.

martindurant avatar Sep 10 '24 13:09 martindurant

Should I add the original functions like scan_grib, grib_tree etc to the list or only the indexing functions? __all__ = ["build_idx_grib_mapping", "map_from_index"]

Anu-Ra-g avatar Sep 10 '24 14:09 Anu-Ra-g

Yes please, add all the public functions, just incase some one does do a "*" import.

martindurant avatar Sep 10 '24 14:09 martindurant

@martindurant made the changes

Anu-Ra-g avatar Sep 10 '24 14:09 Anu-Ra-g