This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gui): parameter assignment filter (#540)
* feat(gui): parse filters for usages/usefulness * feat(gui): update filter help text * feat(gui): pass usage data around * feat(gui): implement usage filter * feat(gui): implement usefulness filter * style: apply automatic fixes of linters * feat(gui): implement assignedBy filters * style: apply automatic fixes of linters * fix: build error * style: apply automatic fixes of linters * fix: linter errors * fix: build error Co-authored-by: lars-reimann <lars-reimann@users.noreply.github.com>
- Loading branch information
1 parent
9880366
commit 6038d05
Showing
5 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
api-editor/gui/src/features/packageData/model/filters/ParameterAssignmentFilter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import AbstractPythonFilter from './AbstractPythonFilter'; | ||
import PythonModule from '../PythonModule'; | ||
import PythonClass from '../PythonClass'; | ||
import PythonFunction from '../PythonFunction'; | ||
import { AnnotationsState } from '../../../annotations/annotationSlice'; | ||
import { UsageCountStore } from '../../../usages/model/UsageCountStore'; | ||
import PythonParameter, { PythonParameterAssignment } from '../PythonParameter'; | ||
|
||
export default class ParameterAssignmentFilter extends AbstractPythonFilter { | ||
constructor(readonly assignedBy: PythonParameterAssignment) { | ||
super(); | ||
} | ||
|
||
shouldKeepModule(_pythonModule: PythonModule, _annotations: AnnotationsState, _usages: UsageCountStore): boolean { | ||
return false; | ||
} | ||
|
||
shouldKeepClass(_pythonClass: PythonClass, _annotations: AnnotationsState, _usages: UsageCountStore): boolean { | ||
return false; | ||
} | ||
|
||
shouldKeepFunction( | ||
_pythonFunction: PythonFunction, | ||
_annotations: AnnotationsState, | ||
_usages: UsageCountStore, | ||
): boolean { | ||
return false; | ||
} | ||
|
||
shouldKeepParameter( | ||
pythonParameter: PythonParameter, | ||
_annotations: AnnotationsState, | ||
_usages: UsageCountStore, | ||
): boolean { | ||
if (this.assignedBy === PythonParameterAssignment.IMPLICIT) { | ||
return !pythonParameter.isExplicitParameter(); | ||
} else if (!pythonParameter.isExplicitParameter()) { | ||
return false; | ||
} else { | ||
return pythonParameter.assignedBy === this.assignedBy; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters