Skip to content

Rename helper function to avoid name collision with class method #15

Description

@bestill3

Branch name: main

File affected: /influpaint/utils/season_axis.py

Description:
There are two methods/functions with the same name in this module. One is class-level method get_season_week(self, ts) which is an instance method and belongs to the class namespace. The other is get_season_week(ts, start_month, start_day) which is a standalone function (module-level), it lives in the global namespace.

This is valid but slightly risky design because:

  • same name could cause cognitive confusion for developers
  • debugging stack traces become harder to read

Cleaner alternative is to rename the standalone function as below:
def compute_season_week(ts, start_month, start_day)

Then the class method becomes

def get_season_week(self, ts):
    return compute_season_week(ts, ...)

I will let Joseph review and decide if we want to make this change.

Metadata

Metadata

Assignees

Labels

code qualityDesign improvements that are not bugs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions