Skip to content

Commit 3bc2ad9

Browse files
matrixstonelqc
authored andcommitted
Add support for Python 3.11
Changes made: * Replace usage of Enum plus str mixin with StrEnum, as per python/cpython#100458
1 parent 295264d commit 3bc2ad9

File tree

79 files changed

+241
-241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+241
-241
lines changed

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
runs-on: ubuntu-latest
5151
strategy:
5252
matrix:
53-
python-version: ["3.8", "3.9", "3.10"]
53+
python-version: ["3.8", "3.9", "3.10", "3.11"]
5454
needs: check-code-quality
5555
steps:
5656
- uses: actions/checkout@v3

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-bookworm
1+
FROM python:3.11-bookworm
22
LABEL description="Deploy Mage on ECS"
33
ARG FEATURE_BRANCH
44
USER root

docs/contributing/charts/how-to-add.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebarTitle: "Charts"
88
Add a new type in [`mage_ai/data_preparation/models/widget/constants.py`](https://github.com/mage-ai/mage-ai/blob/master/mage_ai/data_preparation/models/widget/constants.py):
99

1010
```python
11-
class ChartType(str, Enum):
11+
class ChartType(StrEnum):
1212
# ...
1313
PIE_CHART = 'pie_chart'
1414
```

mage_ai/ai/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33

4-
class LLMUseCase(str, Enum):
4+
class LLMUseCase(StrEnum):
55
GENERATE_DOC_FOR_BLOCK = 'generate_doc_for_block'
66
GENERATE_DOC_FOR_PIPELINE = 'generate_doc_for_pipeline'
77
GENERATE_BLOCK_WITH_DESCRIPTION = 'generate_block_with_description'

mage_ai/api/constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33
from mage_ai.api.operations.constants import OperationType
44
from mage_ai.orchestration.db.models.oauth import Permission
55

66

7-
class AttributeOperationType(str, Enum):
7+
class AttributeOperationType(StrEnum):
88
QUERY = 'query'
99
READ = 'read'
1010
WRITE = 'write'
1111

1212

13-
class AttributeType(str, Enum):
13+
class AttributeType(StrEnum):
1414
ALL = '__*MAGE*__'
1515

1616

17-
class AuthorizeStatusType(str, Enum):
17+
class AuthorizeStatusType(StrEnum):
1818
ALL = 'all'
1919
FAILED = 'failed'
2020
SUCCEEDED = 'succeeded'

mage_ai/api/oauth_scope.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33

44
class OauthScope():
@@ -18,7 +18,7 @@ class OauthScope():
1818
TOKEN_SCOPES = []
1919

2020

21-
class OauthScopeType(str, Enum):
21+
class OauthScopeType(StrEnum):
2222
CLIENT_ALL = 'all'
2323
CLIENT_INTERNAL = 'internal'
2424
CLIENT_PRIVATE = 'private'

mage_ai/api/operations/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33
ALL = 'all'
44
CREATE = 'create'
@@ -20,7 +20,7 @@
2020
COOKIE_PREFIX = '__COOKIE__'
2121

2222

23-
class OperationType(str, Enum):
23+
class OperationType(StrEnum):
2424
ALL = ALL
2525
CREATE = CREATE
2626
DELETE = DELETE

mage_ai/authentication/oauth/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum
1+
from enum import StrEnum
22
from typing import Optional
33

44
from mage_ai.settings import get_settings_value
@@ -10,7 +10,7 @@
1010
GITHUB_STATE = '1337'
1111

1212

13-
class ProviderName(str, Enum):
13+
class ProviderName(StrEnum):
1414
ACTIVE_DIRECTORY = 'active_directory'
1515
AZURE_DEVOPS = 'azure_devops'
1616
BITBUCKET = 'bitbucket'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33
MAGE_OPERATION_HISTORY_DIRECTORY_DEFAULT = '.operation_history'
44
MAGE_OPERATION_HISTORY_DIRECTORY_ENVIRONMENT_VARIABLE_NAME = 'MAGE_OPERATION_HISTORY_DIRECTORY'
55

66

7-
class ResourceType(str, Enum):
7+
class ResourceType(StrEnum):
88
PIPELINE = 'pipeline'

mage_ai/authentication/permissions/constants.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from enum import Enum
1+
from enum import IntEnum, StrEnum
22

33
from mage_ai.api.operations.constants import OperationType
44
from mage_ai.data_preparation.models.constants import BlockType, PipelineType
55

66

7-
class EntityName(str, Enum):
7+
class EntityName(StrEnum):
88
ALL = 'ALL'
99
ALL_EXCEPT_RESERVED = 'ALL_EXCEPT_RESERVED'
1010
AutocompleteItem = 'AutocompleteItem'
@@ -103,7 +103,7 @@ class EntityName(str, Enum):
103103
]
104104

105105

106-
class BaseEntityType(str, Enum):
106+
class BaseEntityType(StrEnum):
107107
pass
108108

109109

@@ -131,7 +131,7 @@ class PipelineEntityType(BaseEntityType):
131131
STREAMING = PipelineType.STREAMING.value
132132

133133

134-
class PermissionAccess(int, Enum):
134+
class PermissionAccess(IntEnum):
135135
OWNER = 1
136136
ADMIN = 2
137137
# Editor: list, detail, create, update, delete
@@ -171,7 +171,7 @@ class PermissionAccess(int, Enum):
171171
DISABLE_UNLESS_CONDITIONS = 1073741824
172172

173173

174-
class PermissionCondition(str, Enum):
174+
class PermissionCondition(StrEnum):
175175
HAS_NOTEBOOK_EDIT_ACCESS = 'HAS_NOTEBOOK_EDIT_ACCESS'
176176
HAS_PIPELINE_EDIT_ACCESS = 'HAS_PIPELINE_EDIT_ACCESS'
177177
USER_OWNS_ENTITY = 'USER_OWNS_ENTITY'

0 commit comments

Comments
 (0)