Commit 078cce2
authored
fix: declare sync_every and sync_every_tasks as class attributes, not properties (#217)
## Summary
`Scheduler.sync_every` and `Scheduler.sync_every_tasks` are declared as `@property` in `celery-stubs/beat.pyi`, but in celery's source code ([`celery/beat.py` lines 242-245](https://github.com/celery/celery/blob/main/celery/beat.py#L242-L245)) they are plain class attributes:
```python
class Scheduler:
sync_every = 3 * 60
sync_every_tasks = None
```
This causes `reportAssignmentType` errors in pyright when subclasses override them as class variables, which is the intended usage pattern:
```python
class MyScheduler(Scheduler):
sync_every = 60 # error: Type "Literal[60]" is not assignable to declared type "property"
```
## Fix
Changed both from `@property` to plain class attribute declarations:
```python
# Before
@Property
def sync_every(self) -> int: ...
@Property
def sync_every_tasks(self) -> int | None: ...
# After
sync_every: int
sync_every_tasks: int | None
```
Related: #2161 parent 8dd6242 commit 078cce2
1 file changed
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 126 | + | |
| 127 | + | |
130 | 128 | | |
131 | 129 | | |
132 | 130 | | |
| |||
0 commit comments