# Buggy code
def _container_generic_transform(arg, context, klass, iterables, build_elts):
    if isinstance(arg, klass):
        return arg
    elif isinstance(arg, iterables):
        if all(isinstance(elt, nodes.Const) for elt in arg.elts):
            elts = [elt.value for elt in arg.elts]
        else:
            # TODO: Does not handle deduplication for sets.
            elts = []
            for element in arg.elts:
                inferred = helpers.safe_infer(element, context=context)
                if inferred:
                    evaluated_object = nodes.EvaluatedObject(
                        original=element, value=inferred
                    )
                    elts.append(evaluated_object)
    elif isinstance(arg, nodes.Dict):
        # Dicts need to have consts as strings already.
        if not all(isinstance(elt[0], nodes.Const) for elt in arg.items):
            raise UseInferenceDefault()
        elts = [item[0].value for item in arg.items]
    elif isinstance(arg, nodes.Const) and isinstance(
        arg.value, (six.string_types, six.binary_type)
    ):
        elts = arg.value
    else:
        return
    return klass.from_elements(elts=build_elts(elts))


# Traceback (KeyError)
Traceback (most recent call last):
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/__init__.py", line 93, in _inference_tip_cached
return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x7f9bd8b34040>, <Call l.281 at 0x7f9bd3b28340>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/scratch2/anaconda3/envs/entos/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/__init__.py", line 22, in run_pylint
PylintRun(sys.argv[1:])
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/run.py", line 349, in __init__
linter.check(args)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 862, in check
self._check_files(
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 896, in _check_files
self._check_file(get_ast, check_astroid_module, name, filepath, modname)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 922, in _check_file
check_astroid_module(ast_node)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1054, in check_astroid_module
retval = self._check_astroid_module(
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1099, in _check_astroid_module
walker.walk(ast_node)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 75, in walk
self.walk(child)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 75, in walk
self.walk(child)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 72, in walk
callback(astroid)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/checkers/classes.py", line 1866, in visit_functiondef
inferred = _safe_infer_call_result(node, node)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/checkers/classes.py", line 449, in _safe_infer_call_result
next(inferit)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/scoped_nodes.py", line 1722, in infer_call_result
yield from returnnode.value.infer(context)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/node_classes.py", line 357, in infer
return self._explicit_inference(self, context, **kwargs)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/__init__.py", line 95, in _inference_tip_cached
result = func(*args, **kwargs)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 135, in _transform_wrapper
result = transform(node, context=context)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 219, in _infer_builtin_container
return _container_generic_inference(node, context, klass, transform_func)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 172, in _container_generic_inference
transformed = transform(inferred)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 188, in _container_generic_transform
inferred = helpers.safe_infer(element, context=context)
File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/helpers.py", line 153, in safe_infer
value = next(inferit)
TypeError: 'Uninferable' object is not an iterator

# Fixed code
def _container_generic_transform(arg, context, klass, iterables, build_elts):
    if isinstance(arg, klass):
        return arg
    elif isinstance(arg, iterables):
        if all(isinstance(elt, nodes.Const) for elt in arg.elts):
            elts = [elt.value for elt in arg.elts]
        else:
            # TODO: Does not handle deduplication for sets.
            elts = []
            for element in arg.elts:
                if not element:
                    continue
                inferred = helpers.safe_infer(element, context=context)
                if inferred:
                    evaluated_object = nodes.EvaluatedObject(
                        original=element, value=inferred
                    )
                    elts.append(evaluated_object)
    elif isinstance(arg, nodes.Dict):
        # Dicts need to have consts as strings already.
        if not all(isinstance(elt[0], nodes.Const) for elt in arg.items):
            raise UseInferenceDefault()
        elts = [item[0].value for item in arg.items]
    elif isinstance(arg, nodes.Const) and isinstance(
        arg.value, (six.string_types, six.binary_type)
    ):
        elts = arg.value
    else:
        return
    return klass.from_elements(elts=build_elts(elts))