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 the dummy variable _ to avoid conflict with lazy_gettext #427

Merged
merged 1 commit into from
May 4, 2016

Conversation

x4base
Copy link
Contributor

@x4base x4base commented May 3, 2016

Otherwise "local variable '_' referenced before assignment" will be raised

Otherwise "local variable '_' referenced before assignment" will be raised
@landscape-bot
Copy link

Code Health
Repository health increased by 0.14% when pulling 6f3d559 on x4base:underscore_conflict into 88c9516 on airbnb:master.

@coveralls
Copy link

coveralls commented May 3, 2016

Coverage Status

Coverage remained the same at 80.869% when pulling 6f3d559 on x4base:underscore_conflict into 88c9516 on airbnb:master.

@mistercrunch
Copy link
Member

Hmmm, _ is a common convention for throwaway variables. Can you share the stack trace that prompted this PR?

@x4base
Copy link
Contributor Author

x4base commented May 4, 2016

Surely I know it's a convention, but I won't bother to fix it if it hasn't caused any problem.
It is causing problem because it is used in the same scope as the for loop.
And I chose the name 'unsed' after seeing this comment: http://programmers.stackexchange.com/a/147271

You can decide whether you prefer __, unused, or dummy.

Here is the stack trace.

2016-05-04 09:05:06,285:ERROR:root:local variable '' referenced before assignment
Traceback (most recent call last):
File "/projects/druid/panoramix/caravel/views.py", line 549, in explore
payload = obj.get_json()
File "/projects/druid/panoramix/caravel/viz.py", line 257, in get_json
'data': self.get_data(),
File "/projects/druid/panoramix/caravel/viz.py", line 364, in get_data
df = self.get_df()
File "/projects/druid/panoramix/caravel/viz.py", line 356, in get_df
df = super(TableViz, self).get_df(query_obj)
File "/projects/druid/panoramix/caravel/viz.py", line 143, in get_df
self.results = self.datasource.query(**query_obj)
File "/projects/druid/panoramix/caravel/models.py", line 1196, in query
raise Exception(
("No data was returned."))
UnboundLocalError: local variable '_' referenced before assignment
2016-05-04 09:05:06,295:INFO:werkzeug:127.0.0.1 - - [04/May/2016 09:05:06] "GET /caravel/explore/druid/2/?viz_type=table&granularity=one+day&druid_time_origin=&since=7+days+ago&until=now&row_limit=50000&include_search=false&metrics=count&flt_col_0=category_id&flt_op_0=in&flt_eq_0=&slice_id=&slice_name=&collapsed_fieldsets=&action=&datasource_name=live_bi_event&datasource_id=2&datasource_type=druid&previous_viz_type=table&json=true&force=true HTTP/1.1" 500 -
Traceback (most recent call last):
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/Users/clu/.pyenv/versions/druid/lib/python2.7/site-packages/Flask_AppBuilder-1.6.0-py2.7.egg/flask_appbuilder/security/decorators.py", line 26, in wraps
return f(self, _args, *_kwargs)
File "/projects/druid/panoramix/caravel/models.py", line 1254, in wrapper
return f(_args, *kwargs)
File "/projects/druid/panoramix/caravel/views.py", line 553, in explore
raise e
UnboundLocalError: local variable '
' referenced before assignment

@x4base
Copy link
Contributor Author

x4base commented May 4, 2016

And coveralls warned about this: https://landscape.io/diff/340487/fixed

@mistercrunch
Copy link
Member

Oh I didn't see the scope issue. Merging.

@mistercrunch mistercrunch merged commit 1d0863a into apache:master May 4, 2016
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 17, 2021
* feat: migrate xy-chart to use encodable (apache#420)

* feat: use encodable in BoxPlot

* feat: migrate legend

* docs: update storybook

* fix: label overlap

* fix: lint

* fix: remove comments

* fix: path

* feat: migrate scatterplot to use encodable (apache#421)

* feat: migrate scatter plot

(cherry picked from commit 0d607a60cdab8037ece7f29a74bef1c0a5432c5d)

* fix: legend

* feat: migrate line chart to use encodable (apache#427)

* feat: migrate line to use encodable

* fix: storybook ts

* fix: remove comment

* refactor: delete deprecated files (apache#430)

* refactor: delete outdated files

* feat: update index exports and add test

* refactor: delete more files

* fix: import order

* fix: update dependency

* fix: update dependency

* build: fix babel

* fix: remvoe comments

* fix: babel

* refactor: move files (apache#432)

* refactor: move files

* refactor: move files

* fix: small issues with charts post-migration (apache#433)

* fix: scatterplot issue

* fix: bump encodable and fix time scale nicing

* fix: issue with label rotation

* refactor: remove deep import

* fix: demo import

* feat: bump and remove unnecessary dependencies (apache#436)

* feat: bump dependencies

* feat: remove unnecessary dependencies
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 17, 2021
* chore: rename directory

* chore: correct naming
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 24, 2021
* feat: migrate xy-chart to use encodable (apache#420)

* feat: use encodable in BoxPlot

* feat: migrate legend

* docs: update storybook

* fix: label overlap

* fix: lint

* fix: remove comments

* fix: path

* feat: migrate scatterplot to use encodable (apache#421)

* feat: migrate scatter plot

(cherry picked from commit 0d607a60cdab8037ece7f29a74bef1c0a5432c5d)

* fix: legend

* feat: migrate line chart to use encodable (apache#427)

* feat: migrate line to use encodable

* fix: storybook ts

* fix: remove comment

* refactor: delete deprecated files (apache#430)

* refactor: delete outdated files

* feat: update index exports and add test

* refactor: delete more files

* fix: import order

* fix: update dependency

* fix: update dependency

* build: fix babel

* fix: remvoe comments

* fix: babel

* refactor: move files (apache#432)

* refactor: move files

* refactor: move files

* fix: small issues with charts post-migration (apache#433)

* fix: scatterplot issue

* fix: bump encodable and fix time scale nicing

* fix: issue with label rotation

* refactor: remove deep import

* fix: demo import

* feat: bump and remove unnecessary dependencies (apache#436)

* feat: bump dependencies

* feat: remove unnecessary dependencies
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 24, 2021
* chore: rename directory

* chore: correct naming
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 25, 2021
* feat: migrate xy-chart to use encodable (apache#420)

* feat: use encodable in BoxPlot

* feat: migrate legend

* docs: update storybook

* fix: label overlap

* fix: lint

* fix: remove comments

* fix: path

* feat: migrate scatterplot to use encodable (apache#421)

* feat: migrate scatter plot

(cherry picked from commit 0d607a60cdab8037ece7f29a74bef1c0a5432c5d)

* fix: legend

* feat: migrate line chart to use encodable (apache#427)

* feat: migrate line to use encodable

* fix: storybook ts

* fix: remove comment

* refactor: delete deprecated files (apache#430)

* refactor: delete outdated files

* feat: update index exports and add test

* refactor: delete more files

* fix: import order

* fix: update dependency

* fix: update dependency

* build: fix babel

* fix: remvoe comments

* fix: babel

* refactor: move files (apache#432)

* refactor: move files

* refactor: move files

* fix: small issues with charts post-migration (apache#433)

* fix: scatterplot issue

* fix: bump encodable and fix time scale nicing

* fix: issue with label rotation

* refactor: remove deep import

* fix: demo import

* feat: bump and remove unnecessary dependencies (apache#436)

* feat: bump dependencies

* feat: remove unnecessary dependencies
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 25, 2021
* chore: rename directory

* chore: correct naming
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 26, 2021
* feat: migrate xy-chart to use encodable (apache#420)

* feat: use encodable in BoxPlot

* feat: migrate legend

* docs: update storybook

* fix: label overlap

* fix: lint

* fix: remove comments

* fix: path

* feat: migrate scatterplot to use encodable (apache#421)

* feat: migrate scatter plot

(cherry picked from commit 0d607a60cdab8037ece7f29a74bef1c0a5432c5d)

* fix: legend

* feat: migrate line chart to use encodable (apache#427)

* feat: migrate line to use encodable

* fix: storybook ts

* fix: remove comment

* refactor: delete deprecated files (apache#430)

* refactor: delete outdated files

* feat: update index exports and add test

* refactor: delete more files

* fix: import order

* fix: update dependency

* fix: update dependency

* build: fix babel

* fix: remvoe comments

* fix: babel

* refactor: move files (apache#432)

* refactor: move files

* refactor: move files

* fix: small issues with charts post-migration (apache#433)

* fix: scatterplot issue

* fix: bump encodable and fix time scale nicing

* fix: issue with label rotation

* refactor: remove deep import

* fix: demo import

* feat: bump and remove unnecessary dependencies (apache#436)

* feat: bump dependencies

* feat: remove unnecessary dependencies
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 26, 2021
* chore: rename directory

* chore: correct naming
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.9.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants