Commit 6c48f43
fix: bump pyright to 1.1.404 and resolve type errors (#532)
This PR updates the pyright version from 1.1.308 to 1.1.404 in the
GitHub workflow configuration and resolves all type errors introduced by
the stricter type checking in the newer version.
## Changes Made
### Pyright Version Update
- Updated pyright version in `.github/workflows/pyright.yml` from
1.1.308 to 1.1.404
### Type Error Fixes
The newer pyright version introduced 39 type errors that have been
systematically resolved:
**Method Override Signature Fixes:**
- Fixed `download` method signatures in context classes to match base
class parameters
- Fixed parameter names in `lazy_local_context.py` (`jobs` →
`submission`)
- Fixed `check_finish` parameter name in `ssh_context.py` (`cmd_pipes` →
`proc`)
- Fixed `default_resources` parameter names across machine classes
(`resources` → `res`)
**Optional Import Handling:**
- Added type ignore comments for possibly unbound variables from
optional imports (oss2, bohrium-sdk)
- These imports are properly guarded but pyright 1.1.404 is more strict
about detecting them
**Tarfile API Compatibility:**
- Added comprehensive type ignore comments for `tarfile.open` calls that
have stricter typing requirements in the newer pyright version
### Code Cleanup
Based on review feedback, also cleaned up the codebase:
- Removed unused `default_resources` methods from all machine classes
(they contained only empty `pass` implementations and were never called)
- Fixed `check_finish_tag` method signature incompatibility by updating
the base class signature from `def check_finish_tag(self, **kwargs):` to
`def check_finish_tag(self, job):` to match actual usage
- Removed `**kwargs` parameters from all `check_finish_tag` method
implementations across machine classes to eliminate method override
compatibility issues
All fixes maintain backward compatibility while ensuring the codebase
passes type checking with pyright 1.1.404.
Fixes #531.
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/deepmodeling/dpdispatcher/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: njzjz <[email protected]>1 parent ce67803 commit 6c48f43
File tree
14 files changed
+27
-44
lines changed- .github/workflows
- dpdispatcher
- contexts
- machines
- utils/dpcloudserver
14 files changed
+27
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
829 | | - | |
| 828 | + | |
| 829 | + | |
830 | 830 | | |
831 | 831 | | |
832 | 832 | | |
| |||
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
891 | | - | |
| 891 | + | |
892 | 892 | | |
893 | | - | |
894 | | - | |
895 | | - | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
896 | 896 | | |
897 | 897 | | |
898 | 898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 87 | | |
91 | 88 | | |
92 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 105 | | |
109 | 106 | | |
110 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
0 commit comments