Skip to content

Commit

Permalink
Fix 'None' syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed May 4, 2020
1 parent f906c88 commit e9957b6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PyQt5-stubs/Qt3DAnimation.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class Qt3DAnimation(sip.simplewrapper):
class QKeyframeAnimation('QAbstractAnimation'):

class RepeatMode(int): ...
None = ... # type: 'QKeyframeAnimation.RepeatMode'
None_ = ... # type: 'QKeyframeAnimation.RepeatMode'
Constant = ... # type: 'QKeyframeAnimation.RepeatMode'
Repeat = ... # type: 'QKeyframeAnimation.RepeatMode'

Expand Down
12 changes: 6 additions & 6 deletions PyQt5-stubs/Qt3DRender.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class Qt3DRender(sip.simplewrapper):
TargetBuffer = ... # type: 'QAbstractTexture.Target'

class Status(int): ...
None = ... # type: 'QAbstractTexture.Status'
None_ = ... # type: 'QAbstractTexture.Status'
Loading = ... # type: 'QAbstractTexture.Status'
Ready = ... # type: 'QAbstractTexture.Status'
Error = ... # type: 'QAbstractTexture.Status'
Expand Down Expand Up @@ -721,7 +721,7 @@ class Qt3DRender(sip.simplewrapper):
class QClearBuffers('QFrameGraphNode'):

class BufferType(int): ...
None = ... # type: 'QClearBuffers.BufferType'
None_ = ... # type: 'QClearBuffers.BufferType'
ColorBuffer = ... # type: 'QClearBuffers.BufferType'
DepthBuffer = ... # type: 'QClearBuffers.BufferType'
StencilBuffer = ... # type: 'QClearBuffers.BufferType'
Expand Down Expand Up @@ -1140,7 +1140,7 @@ class Qt3DRender(sip.simplewrapper):
class QMemoryBarrier('QFrameGraphNode'):

class Operation(int): ...
None = ... # type: 'QMemoryBarrier.Operation'
None_ = ... # type: 'QMemoryBarrier.Operation'
VertexAttributeArray = ... # type: 'QMemoryBarrier.Operation'
ElementArray = ... # type: 'QMemoryBarrier.Operation'
Uniform = ... # type: 'QMemoryBarrier.Operation'
Expand Down Expand Up @@ -1181,7 +1181,7 @@ class Qt3DRender(sip.simplewrapper):
class QMesh('QGeometryRenderer'):

class Status(int): ...
None = ... # type: 'QMesh.Status'
None_ = ... # type: 'QMesh.Status'
Loading = ... # type: 'QMesh.Status'
Ready = ... # type: 'QMesh.Status'
Error = ... # type: 'QMesh.Status'
Expand Down Expand Up @@ -1663,7 +1663,7 @@ class Qt3DRender(sip.simplewrapper):
CameraLensComponent = ... # type: 'QSceneLoader.ComponentType'

class Status(int): ...
None = ... # type: 'QSceneLoader.Status'
None_ = ... # type: 'QSceneLoader.Status'
Loading = ... # type: 'QSceneLoader.Status'
Ready = ... # type: 'QSceneLoader.Status'
Error = ... # type: 'QSceneLoader.Status'
Expand Down Expand Up @@ -2193,7 +2193,7 @@ class Qt3DRender(sip.simplewrapper):
class QTextureImage('QAbstractTextureImage'):

class Status(int): ...
None = ... # type: 'QTextureImage.Status'
None_ = ... # type: 'QTextureImage.Status'
Loading = ... # type: 'QTextureImage.Status'
Ready = ... # type: 'QTextureImage.Status'
Error = ... # type: 'QTextureImage.Status'
Expand Down
2 changes: 1 addition & 1 deletion PyQt5-stubs/QtQuick.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ class QSGTexture(QtCore.QObject):
Anisotropy16x = ... # type: 'QSGTexture.AnisotropyLevel'

class Filtering(int): ...
None = ... # type: 'QSGTexture.Filtering'
None_ = ... # type: 'QSGTexture.Filtering'
Nearest = ... # type: 'QSGTexture.Filtering'
Linear = ... # type: 'QSGTexture.Filtering'

Expand Down
22 changes: 22 additions & 0 deletions issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,25 @@ def Q_FLAGS(*a0) -> None: ...
Add type annotation of type `typing.Any`.

This should be fixed in the original PyQt5 stubs.

## #7 Can't assign to keyword

### Description

When "None" is used as an enum member, mypy will fail.

### Example

```python
class RepeatMode(int): ...
None = ... # type: 'QKeyframeAnimation.RepeatMode'
```

**mypy error:**
`error: can't assign to keyword`

### Solution

Rename `None` to `None_`.

This should be fixed in the original PyQt5 stubs -> [Reported upstream](https://www.riverbankcomputing.com/pipermail/pyqt/2020-May/042878.html)

0 comments on commit e9957b6

Please sign in to comment.