ipython / ipython/traitlets

Pyright diagnostic type incompatible

Open
#853 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
653
Forks
217
Avg merge
2d 21h
Merged PRs (30d)
2

Description

```python
@magics_class
class SimpleGPTMagics(Magics):
api_type = Unicode("openai", help="The type of api that will be used to query the models").tag(config=True)

```
[pyright](https://microsoft.github.io/pyright/) report
```
Diagnostics:
1. Argument of type "Literal['openai']" cannot be assigned to parameter "default_value" of type "Sentinel" in function "__init__"
  "Literal['openai']" is incompatible with "Sentinel" [reportGeneralTypeIssues]

```

https://github.com/ipython/traitlets/blob/05d6ecb6b1f90736cdeacf41c7d5e84b147c1dbd/traitlets/traitlets.py#L479-L497

https://github.com/ipython/traitlets/blob/05d6ecb6b1f90736cdeacf41c7d5e84b147c1dbd/traitlets/traitlets.py#L135-L141

Obviously, the argument of `TraitType.__init__`, `default_vaue` is infered to `Sentinel`, what can I do to suppress the diagnostic?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.