Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Method refactoring allows you to rename a nested method with a parameter name #776

Closed
Tracked by #779
jonhnanthan opened this issue Feb 27, 2024 · 1 comment

Comments

@jonhnanthan
Copy link

Rename Method refactoring allows you to rename a nested method with the parameter name of the outer method.
It would be nice if Rope sent an alert to avoid missing annotations

Steps to reproduce the behavior:

  1. Code before refactoring:
def _calculate_tk(source):
    def c_int(x, nbits=32):
        return (x & ((1 << (nbits - 1)) - 1)) - (x & (1 << (nbits - 1)))

    def c_uint(x, nbits=32):
        return x & ((1 << nbits) - 1)

    tkk = [406398, 561666268 + 1526272306]
    b = tkk[0]

    d = source.encode('utf-8')

    def RL(a, b):
        for c in range(0, len(b) - 2, 3):
            d = b[c + 2]
            d = ord(d) - 87 if d >= 'a' else int(d)
            xa = c_uint(a)
            d = xa >> d if b[c + 1] == '+' else xa << d
            a = a + d & 4294967295 if b[c] == '+' else a ^ d
        return c_int(a)

    a = b

    for di in d:
        a = RL(a + di, "+-a^+6")

    a = RL(a, "+-3^+b+-f")
    a ^= tkk[1]
    a = a if a >= 0 else ((a & 2147483647) + 2147483648)
    a %= pow(10, 6)

    tk = '{0:d}.{1:d}'.format(a, a ^ b)
    return tk
  1. Apply the Rename Method refactoring with the new name 'source' to the method 'c_int'
@jonhnanthan jonhnanthan added the bug Unexpected or incorrect user-visible behavior label Feb 27, 2024
@lieryan
Copy link
Member

lieryan commented Mar 12, 2024

Closing. Ticket merged into #779.

@lieryan lieryan closed this as completed Mar 12, 2024
@lieryan lieryan closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
@lieryan lieryan added enhancement and removed bug Unexpected or incorrect user-visible behavior labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants