-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[type annotation] add type hint for flowchart #2867
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
@j9ac9k, after adding the type hint, the github CodeQL start to scan the code, and reject the PR because mismatch override etc So how about disable the CodeQL until we're ready? |
Depending on the reason codeql is failing, we can merge with it giving a red checkmark. CodeQL is intended to be a check for some basic stuff like unused imports; referencing potentially unassigned variables and so on. That said the reason for the errors is using I would be good with adding typing-extensions as a dependency if using new type syntax results in inline annotations that are far easier to read/simplified. |
@j9ac9k , Good catch! Firstly, codeQL can support python 3.5~3.11 codeql-overview, Secondly, codeQL said "Overriding method process has signature mismatch with overridden method", def process(self, **kargs: Unpack) -> dict: but in the child class (like def process(self, data: Optional[np.ndarray], display: bool = True) -> None: the signature of method in the parent & child class are Different. I guess this is the real reason to fail. |
I wouldn't worry about the CodeQL issue, it being red on a PR is not a deal breaker on it merging; there are inherent shortcomings w/ that check. Right now, there are 418 CodeQL issues in the codebase (there used to be ~1,000 but periodically I make a PR to address some of the low-hanging fruit). |
b1ac07f
to
abc1966
Compare
You're right, I didn't check the detail of failed checks before. |
f465d79
to
c493f4a
Compare
@j9ac9k , |
c493f4a
to
88dbad2
Compare
88dbad2
to
dccd350
Compare
@j9ac9k , please merge it if it's no problem :) |
Hi @longqzh Sorry for the silence on my end. I'm moved across the country, and am preparing for an international move in a few months so my time on this library came to a standstill for a while. Given the NEP-29 timeline we will be dropping Python 3.9 support is just a few months. This will take away the need for using the |
self.items = {} | ||
|
||
def disconnected(self, localTerm, remoteTerm): | ||
self.plot: Optional[PlotWidget] = None # currently selected plot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instance properties should be typed at the class level, not in the __init__
function (see here)... like this:
class PlotWidgetNode(Node):
items: dict[int, QGraphicsItem | PlotDataItem
plot: PlotWidget | PlotItem | None # personal preference, but I only use `Optional` for function args
plots: dict[str, PlotWidget | PlotItem]
ui: ComboBox | None
def __init__(self, name: str) -> None:
Node.__init__(self, name, terminals={'In': {'io': 'in', 'multi': True}})
self.plot = None # <-- no need for typing here! Type is defined at class level.
This is the second PR in the PR's sequence to add type annotation.
type hints are added in
flowchart
folder.Discussion : #2833
Other Tasks
Bump Dependency Versions
Files that need updates
Confirm the following files have been either updated or there has been a determination that no update is needed.
README.md
setup.py
tox.ini
.github/workflows/main.yml
and associatedrequirements.txt
and condaenvironemt.yml
filespyproject.toml
binder/requirements.txt
Pre-Release Checklist
Pre Release Checklist
__init__.py
CHANGELOG
primarily using contents from automated changelog generation in GitHub release pagePost-Release Checklist
Steps To Complete
.dev0
to__version__
in__init__.py