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

False unreachable code #2224

Closed
mmzeynalli opened this issue Jan 7, 2022 · 6 comments
Closed

False unreachable code #2224

mmzeynalli opened this issue Jan 7, 2022 · 6 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@mmzeynalli
Copy link

Environment data

  • Language Server version: 2022.1.0
  • OS and version: Ubuntu 20.04
  • Python version: 3.7.12
  • Django version - 2.2

Expected behaviour

While writing tests for Django, I faced some unreachable code segments (which was okay couple days ago). Upon searching for cause, I saw that, new version of PyLance has come yesterday, so I reverted to previous version, and it worked how it is supposed to be.

Version 2012.12.2

image

Actual behaviour

Version 2022.1.0
image

Logs

Background analysis message: setFileOpened
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
[FG] parsing: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (21ms)
[FG] binding: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (6ms)
Background analysis message: getSemanticTokens full
[BG(1)] getSemanticTokens full at /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py ...
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (81ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (6ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/datetime.pyi [fs read 0ms] (12ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/datetime.pyi (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/files/base.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/files/base.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/files/utils.pyi [fs read 1ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/files/utils.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/__init__.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/base.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/base.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/conf.pyi [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/conf.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/resolvers.pyi [fs read 0ms] (8ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/urls/resolvers.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/http/response.pyi [fs read 0ms] (7ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/http/response.pyi (3ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/conf/urls/__init__.pyi [fs read 1ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/conf/urls/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/django_capture_on_commit_callbacks.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/django_capture_on_commit_callbacks.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/contextlib.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/contextlib.pyi (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/utils.pyi [fs read 1ms] (4ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/utils.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/permissions.py [fs read 1ms] (12ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/permissions.py (3ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/six.pyi [fs read 0ms] (4ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/six.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/test.py [fs read 0ms] (21ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/test.py (4ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/test/client.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/test/client.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/api/starxpress/views.py [fs read 0ms] (7ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/api/starxpress/views.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/__init__.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/__init__.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/generics.py [fs read 0ms] (5ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/generics.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/decorators.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/decorators.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/generic/base.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/generic/base.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/__init__.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/__init__.py ...
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/_models.py [fs read 1ms] (91ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/_models.py (15ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/insurance.py [fs read 0ms] (4ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/insurance.py (2ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/status.py [fs read 0ms] (8ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/status.py (2ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/warehouse.py [fs read 0ms] (4ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/warehouse.py (2ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/models/__init__.py (128ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/mixins.py [fs read 0ms] (27ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/mixins.py (14ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/deletion.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/deletion.pyi (4ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/validators.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/validators.pyi (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/fields/files.pyi [fs read 0ms] (5ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/fields/files.pyi (3ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/pathlib.pyi [fs read 0ms] (4ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/pathlib.pyi (4ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/files/storage.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/files/storage.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/contenttypes/fields.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/contenttypes/fields.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/mixins.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/mixins.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/views.py [fs read 0ms] (9ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/views.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/generic/__init__.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/generic/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/core/utils/helpers.py [fs read 0ms] (4ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/utils/helpers.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/__init__.py [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/__init__.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/querysets.py [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/querysets.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/decorators/debug.pyi [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/decorators/debug.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/starxpress.py [fs read 1ms] (21ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/starxpress.py (10ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/tests/core/factories.py [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/tests/core/factories.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/factories.py [fs read 1ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/factories.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/factory/faker.py [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/factory/faker.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/cache/__init__.pyi [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/cache/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/timezone.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/timezone.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/core/models/__init__.py [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/models/__init__.py ...
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/core/models/_models.py [fs read 0ms] (25ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/core/models/_models.py (9ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/core/models/notification.py [fs read 0ms] (8ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/core/models/notification.py (3ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/models/__init__.py (46ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/api.pyi [fs read 1ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/api.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/sessions.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/sessions.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/models.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/requests/requests/models.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/json/decoder.pyi [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/json/decoder.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/decorators/csrf.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/views/decorators/csrf.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/encoding.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/encoding.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/http.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/http.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/handlers/wsgi.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/core/handlers/wsgi.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/http/__init__.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/http/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/http/request.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/http/request.pyi (3ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/io.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/io.pyi (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/auth/base_user.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/auth/base_user.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/tasks.py [fs read 2ms] (24ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/tasks.py (9ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/__init__.py [fs read 0ms] (7ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/__init__.py (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/app/__init__.py [fs read 1ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/app/__init__.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/starex/db_routing.py [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/starex/db_routing.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/starex/celery.py [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/starex/celery.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/local.py [fs read 0ms] (10ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/local.py (3ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/_state.py [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/_state.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/five.py [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/celery/five.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/transaction.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/transaction.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/core/utils/admin_log.py [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/utils/admin_log.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/core/utils/tools.py [fs read 0ms] (7ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/utils/tools.py (2ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/campaign/services/__init__.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/campaign/services/__init__.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/campaign/services/_services.py [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/campaign/services/_services.py (2ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/campaign/models.py [fs read 0ms] (12ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/campaign/models.py (5ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/campaign/services/utils.py [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/campaign/services/utils.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/crypto.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/utils/crypto.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/payment/utils/exchange.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/payment/utils/exchange.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/apps/__init__.pyi [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/apps/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/apps/registry.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/apps/registry.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/sites/models.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/sites/models.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/helpers.py [fs read 0ms] (6ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/fulfillment/utils/helpers.py (6ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/tasks.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/base_user/tasks.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/core/utils/mixins.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/utils/mixins.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/pytz/pytz/__init__.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/pytz/pytz/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/pytz/pytz/tzinfo.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/pytz/pytz/tzinfo.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/linecache.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/linecache.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/traceback.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/traceback.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/sys.pyi [fs read 0ms] (4ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/sys.pyi (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/settings.py [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/rest_framework/settings.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/importlib/__init__.pyi [fs read 1ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/importlib/__init__.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/core/utils/options.py [fs read 0ms] (7ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/core/utils/options.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/payment/utils/options.py [fs read 0ms] (5ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/payment/utils/options.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/pycountry/__init__.py [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/pycountry/__init__.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/pycountry/db.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.local/share/virtualenvs/starex_backend-YtCqeANe/lib/python3.7/site-packages/pycountry/db.py (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/threading.pyi [fs read 1ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stdlib/threading.pyi (2ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi [fs read 0ms] (3ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/fields/related_descriptors.pyi [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/fields/related_descriptors.pyi (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/__init__.py [fs read 0ms] (0ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/base_user/__init__.py (0ms)
[BG(1)]   parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/__init__.py [fs read 0ms] (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/__init__.py ...
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/activation.py [fs read 0ms] (0ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/activation.py (1ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/audience.py [fs read 0ms] (2ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/audience.py (5ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/group.py [fs read 0ms] (0ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/group.py (0ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/ltv.py [fs read 0ms] (1ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/ltv.py (0ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/profile.py [fs read 0ms] (0ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/profile.py (1ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/sales_operator.py [fs read 0ms] (0ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/sales_operator.py (1ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/session.py [fs read 0ms] (1ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/session.py (0ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/user.py [fs read 0ms] (14ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/user.py (3ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/utm.py [fs read 0ms] (0ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/utm.py (1ms)
[BG(1)]     parsing: /home/mmzeynalli/Desktop/starex_backend/base_user/models/wallet.py [fs read 0ms] (0ms)
[BG(1)]     binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/wallet.py (1ms)
[BG(1)]   binding: /home/mmzeynalli/Desktop/starex_backend/base_user/models/__init__.py (32ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/auth/models.pyi [fs read 0ms] (2ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/contrib/auth/models.pyi (1ms)
[BG(1)]   parsing: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/options.pyi [fs read 0ms] (4ms)
[BG(1)]   binding: /home/mmzeynalli/.vscode/extensions/ms-python.vscode-pylance-2022.1.0/dist/bundled/stubs/django/db/models/options.pyi (2ms)
[BG(1)] getSemanticTokens full at /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (1275ms)
Background analysis message: getSemanticTokens range
[BG(1)] getSemanticTokens range 762:0 - 864:65 at /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (1ms)
Background analysis message: analyze
[BG(1)] analyzing: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py ...
[BG(1)]   checking: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (101ms)
[BG(1)] analyzing: /home/mmzeynalli/Desktop/starex_backend/tests/fulfillment/utils/test_starxpress.py (101ms)
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange

Code Snippet / Additional information

class TransactionDataGetSetTestCase(StarexTestCase):
    def setUp(self):
        super().setUp()

        self.transaction1: Transaction = pf.TransactionFactory(data=None)
        self.transaction2: Transaction = pf.TransactionFactory(data=dict())
        self.transaction3: Transaction = pf.TransactionFactory(data={"data_key": None})
        self.transaction4: Transaction = pf.TransactionFactory(
            data={"data_key": "data_value"}
        )
        self.transaction5: Transaction = pf.TransactionFactory(data=None)
@github-actions github-actions bot added the triage label Jan 7, 2022
@erictraut
Copy link
Contributor

Thanks for the bug report, but we'll need more context. Could you please provide a minimal, self-contained sample (including any required import statements)? In particular, where are the symbols Transaction, StarexTestCase and pf defined?

@Rildlanster
Copy link

Rildlanster commented Jan 7, 2022

Same here. Since v2022.1.0 I've got many incorrect unreachable code in my Django tests. It didn't happen in non-test code so far. In my case, all the unreachable code are shown after any FactoryBoy model instantiation.

image

image

On v2021.12.2 the same code is shown as expected:

image

image

@erictraut
Copy link
Contributor

@Rildlanster, as I mentioned to the OP, we'll need more context. Could you provide a self-contained, minimal example in code form? The code within the screen shots you've pasted includes symbols that are defined outside of the sample, and I don't know where these are coming from.

@Rildlanster
Copy link

Rildlanster commented Jan 7, 2022

Hello @erictraut, here is a minimal project I've created:

  • Create a new folder pylancetest and install virtualenv on it: python3.9.exe -m venv .venv

image

  • Install Django and factory-boy dependencies: .\.venv\Scripts\python.exe -m pip install django factory-boy
  • Activate virtualenv and create a Django project: & .venv/Scripts/Activate.ps1, django-admin.exe startproject test .

image

  • Create a file test.py

image

  • Copy and paste the test.py content given bellow:
from factory.django import DjangoModelFactory
from django.contrib.auth.models import User
from django.test import TestCase


class UserFactory(DjangoModelFactory):
    class Meta:
        model = User


class StaffUserTest(TestCase):
    def test_pylance(self):
        UserFactory()
        print("Is it unreachable?")

You will see the unreachable code in the print statement:

image

  • Run the test and see the Is it unreachable? printed in terminal: .\.venv\Scripts\python.exe .\manage.py test

image

@erictraut
Copy link
Contributor

Thanks for the repro steps. I was able to find and fix the underlying cause.

The UserFactory class derives from factory.base.Factory. This class derives from factory.base.BaseFactory, which defines a __new__ method that always raises an exception. That's why pylance thought the code afterward was unreachable. However, factory.base.BaseFactory is also using a custom metaclass that defines a __call__ method. This is invoked instead of the __new__ method in this case.

This will be fixed in the next release of pylance.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Jan 7, 2022
@bschnurr
Copy link
Member

This issue has been fixed in version 2022.1.1, which we've just released. You can find the changelog here: CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants