Remove dead code from utils

TL;DR

  • Removes code in tango/utils.py that has no caller or cannot run: copy_doc, _get_env_var, and the Python 2 spellings CaselessList.__getslice__, CaselessList.__setslice__, CaselessDict.has_key and the im_func fallback.
  • Removes thirteen global statements that only read the name they declare.

Reported in #789. No behaviour change.

Key Facts

  • copy_doc and _get_env_var were verified unreferenced across tango/, tests/, ext/, doc/ and PyTango/. Neither is exported or in the API reference.
  • _get_env_var is the one worth a second look before merging: it implements a ~/.tangorc and /etc/tangorc fallback for environment variables. If that is a feature someone still wants, it has had no caller to keep it honest. Removing it is the position this MR takes; say so if it should stay.
  • The slice hooks were not merely unused, they were broken. Python 3 never calls them, and __getslice__ delegated to list.__getslice__, which no longer exists, so calling it directly raised AttributeError. CaselessList slicing is served by __getitem__ and still returns a CaselessList — verified.
  • The scalar-to-array alias loop ran at module level and left k and v bound as attributes of tango.utils. Moving it into a function keeps them local; the resulting map is unchanged, including the string aliases, so scalar_to_array_type("int32") still resolves.
  • CaselessList's class docstring listed __getslice__ and __setslice__ among the methods it implements. That line is updated rather than left to mislead.

Caveats

  • No tests are added. Every item here is either unreachable or unobservable, so there is nothing to assert that is not already covered; the existing CaselessList and CaselessDict tests guard the slicing and mapping behaviour that stays.
  • Builds on !1076 (merged) and targets its branch. Retarget as the chain merges.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading