Loading
Remove dead code from utils
TL;DR
- Removes code in
tango/utils.pythat has no caller or cannot run:copy_doc,_get_env_var, and the Python 2 spellingsCaselessList.__getslice__,CaselessList.__setslice__,CaselessDict.has_keyand theim_funcfallback. - Removes thirteen
globalstatements that only read the name they declare.
Reported in #789. No behaviour change.
Key Facts
copy_docand_get_env_varwere verified unreferenced acrosstango/,tests/,ext/,doc/andPyTango/. Neither is exported or in the API reference._get_env_varis the one worth a second look before merging: it implements a~/.tangorcand/etc/tangorcfallback 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 tolist.__getslice__, which no longer exists, so calling it directly raisedAttributeError.CaselessListslicing is served by__getitem__and still returns aCaselessList— verified. - The scalar-to-array alias loop ran at module level and left
kandvbound as attributes oftango.utils. Moving it into a function keeps them local; the resulting map is unchanged, including the string aliases, soscalar_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
CaselessListandCaselessDicttests guard the slicing and mapping behaviour that stays. - Builds on !1076 (merged) and targets its branch. Retarget as the chain merges.