Skip to content

Avoid strange name shadowing and simplify structure #174

@tfardet

Description

@tfardet

At the moment, pynsee is written with one file per class or function, with the files having the same name.
This seem to lead to name shadowing upon import (cf. #173) [1] and makes imports extremely cumbersome.

In my opinion, there is no good reason to have one file per function (especially not with the same name) as any good IDE will automatically locate definitions (even GitHub's web UI does this).

A simple way to do this with minimal changes would be to remove duplicate functions (no need to have get_geodata calling _get_geodata). So we can just keep _get_geodata.py which would contain get_geodata removing both one file, one function call, and the weird name shadowing issue.

For classes, we should follow the python convention and keep class files lowercase.

EDIT: we started doing this, this will continue progressively when time permits. Fixed classes and functions include:

  • GeoFrDataFrame, transform_overseas and zoom from geodata
  • SireneDataFrame from sirene
  • init_conn from utils
  • pynsee/macrodata (for dimensions, idbanks, and metdata) in Fix get_series_list #257

[1]: though this is not supposed to happen (declared variables are supposed to have precedence over modules) so I'm not really sure why this led to bugs in the CI

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions