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

Fix "Code is unreachable Pylance" warning for NumberPlane #1709

Merged
merged 1 commit into from
Jan 17, 2022
Merged

Fix "Code is unreachable Pylance" warning for NumberPlane #1709

merged 1 commit into from
Jan 17, 2022

Conversation

TurkeyBilly
Copy link
Contributor

@TurkeyBilly TurkeyBilly commented Jan 17, 2022

Motivation

  • After initializing a NumberPlane object, the code area below will be marked as "unreachable" by Pylance
  • This grey out the code and disables syntax highlighting

8df6ec7f74f4c701fa4e3b5e3058afa

(When I was writing the code)

T$X{NC77UQ6E_@N2TFNWI8C
(In the source code)

def get_axes(self):
    raise Exception("Not implemented")

however without adding an abstract class decorator

@absrtactclass
def get_axes(self):
    raise Exception("Not implemented")

(Jumping was due to the fact that get_x_axis() and get_y_axis are not overrode again under Axes class)

This pull request aims to improve the structure and make it convenient especially for Pylance user writing and tracking codes

Proposed changes

  • added @abstractclass for two abstract methods
  • overrides get_axis, get_x_axis, get_y_axis, get_z_axis so that when using these/writing these methods, Pylance and users can track back to re-implemented methods under Axes class instead of CoordinateSystem where they will find nothing but a raise Exception

Test

image

Tested by initializing a Numberline object and no error occurred.

@TonyCrane TonyCrane requested a review from 3b1b January 17, 2022 14:14
@TurkeyBilly TurkeyBilly changed the title Fix "Code is unreachable Pylance" warning for Numberline Fix "Code is unreachable Pylance" warning for NumberPlane Jan 17, 2022
@3b1b 3b1b merged commit 2318c9e into 3b1b:master Jan 17, 2022
TonyCrane added a commit that referenced this pull request Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants