rope icon indicating copy to clipboard operation
rope copied to clipboard

The Inline Method refactoring does not inline all the attributes

Open jonh-copin opened this issue 1 month ago • 0 comments

The Inline Method refactoring does not inline all the attributes, causing 'NameError'

Steps to reproduce the behavior:

  1. Code before refactoring:
_registry = {}

def get_registry():
    return _registry

def register(name, format_class):
    get_registry()[name] = format_class

def usa_register():
    print("antes:", get_registry())
    register("redis", "MockRedisFormat")
    print("depois:", get_registry())

usa_register()
  1. Apply the inline method to StringlikeMixin.find

  2. Code after refactoring:

_registry = {}

def get_registry():
    return _registry

def usa_register():
    print("antes:", get_registry())
    get_registry()[name] = "MockRedisFormat"
    print("depois:", get_registry())

usa_register()

jonh-copin avatar Nov 24 '25 19:11 jonh-copin