Skip to content

Commit

Permalink
Allow alphanumeric block module name + fix slant3d import (#8857)
Browse files Browse the repository at this point in the history
- Merges into #8805
- Resolves #8858

### Changes
- Allows block module names to be alphanumeric
- Renames `slantthreed` to `slant3d`
  • Loading branch information
Pwuts authored Dec 2, 2024
1 parent 2591206 commit eee787c
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions autogpt_platform/backend/backend/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
if f.is_file() and f.name != "__init__.py"
]
for module in modules:
if not re.match("^[a-z_.]+$", module):
if not re.match("^[a-z0-9_.]+$", module):
raise ValueError(
f"Block module {module} error: module name must be lowercase, "
"separated by underscores, and contain only alphabet characters"
"and contain only alphanumeric characters and underscores."
)

importlib.import_module(f".{module}", package=__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Any, Dict

from backend.blocks.slantthreed._api import Color, CustomerDetails, OrderItem, Profile
from backend.data.block import Block
from backend.util.request import requests

from ._api import Color, CustomerDetails, OrderItem, Profile


class Slant3DBlockBase(Block):
"""Base block class for Slant3D API interactions"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import TYPE_CHECKING

from backend.integrations.webhooks.slantthreed import Slant3DWebhooksManager

from .github import GithubWebhooksManager
from .slant3d import Slant3DWebhooksManager

if TYPE_CHECKING:
from .base import BaseWebhooksManager
Expand Down

0 comments on commit eee787c

Please sign in to comment.