question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module name in decorator isn't renamed

See original GitHub issue

Input file:

import attr


@attr.s()
class A:
  ...

Code:

import bowler
bowler.Query('tmp.py').select_module('attr').rename('testme').execute(write=True, silent=True)

Output file:

import testme


@attr.s()
class A:
  ...

Attr was renamed in the import statement, but not in the decorator.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thatchcommented, Oct 5, 2020

A test for this should go near https://github.com/facebookincubator/Bowler/blob/master/bowler/tests/query.py#L187

To see what the lib2to3 pattern would look like, you can use python -m bowler dump [--selector-pattern] <filename>.

The bug is probably a missing piece of the pattern in https://github.com/facebookincubator/Bowler/blob/master/bowler/query.py#L120 that involves {dotted_name}

Getting started docs are at https://github.com/facebookincubator/Bowler/blob/master/CONTRIBUTING.md

0reactions
amyreesecommented, Oct 19, 2020

This is also a more general problem with a number of selectors in Bowler where they don’t catch 100% of uses of the name, or where being 100% thorough is potentially catching cases where a local could be shadowing the global module name and Bowler doesn’t actually know that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

django - Is it possible to change the name of a class (type ...
The model doesn't exist in the module definition with the new name and I can't use it without it looking in the decorator...
Read more >
No module named 'decorator' exception, fixed by installing ...
Describe the bug. Command Name az webapp list. Errors: No module named 'decorator' Traceback (most recent call last): python3 ...
Read more >
Primer on Python Decorators
In this introductory tutorial, we'll look at what Python decorators are and how to create and use them.
Read more >
Module Interfaces being renamed in synthesis - Xilinx Support
I've attached a picture that shows a piece of a design with some interfaces being renamed. In the picture the left side is...
Read more >
Glossary — Python 3.11.1 documentation
Arguments are assigned to the named local variables in a function body. ... for function definitions and class definitions for more about decorators....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found