mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 21:06:03 +00:00
style: introduce ruff as linter and formatter (#1356)
* style: remove necessary imports * style: fix F841 * style: fix F401 * style: fix F811 * style: fix E402 * style: fix E721 * style: fix E722 * style: fix E722 * style: fix F541 * style: ruff format * style: all passed * style: add ruff in deps * style: more ignores in ruff.toml * style: add pre-commit
This commit is contained in:
committed by
GitHub
parent
09e70d70e9
commit
209f16af76
@@ -5,29 +5,31 @@ from ... import group
|
||||
|
||||
@group.group_class('adapters', '/api/v1/platform/adapters')
|
||||
class AdaptersRouterGroup(group.RouterGroup):
|
||||
|
||||
async def initialize(self) -> None:
|
||||
@self.route('', methods=['GET'])
|
||||
async def _() -> str:
|
||||
return self.success(data={
|
||||
'adapters': self.ap.platform_mgr.get_available_adapters_info()
|
||||
})
|
||||
|
||||
return self.success(
|
||||
data={'adapters': self.ap.platform_mgr.get_available_adapters_info()}
|
||||
)
|
||||
|
||||
@self.route('/<adapter_name>', methods=['GET'])
|
||||
async def _(adapter_name: str) -> str:
|
||||
adapter_info = self.ap.platform_mgr.get_available_adapter_info_by_name(adapter_name)
|
||||
adapter_info = self.ap.platform_mgr.get_available_adapter_info_by_name(
|
||||
adapter_name
|
||||
)
|
||||
|
||||
if adapter_info is None:
|
||||
return self.http_status(404, -1, 'adapter not found')
|
||||
|
||||
return self.success(data={
|
||||
'adapter': adapter_info
|
||||
})
|
||||
|
||||
return self.success(data={'adapter': adapter_info})
|
||||
|
||||
@self.route('/<adapter_name>/icon', methods=['GET'])
|
||||
async def _(adapter_name: str) -> quart.Response:
|
||||
|
||||
adapter_manifest = self.ap.platform_mgr.get_available_adapter_manifest_by_name(adapter_name)
|
||||
adapter_manifest = (
|
||||
self.ap.platform_mgr.get_available_adapter_manifest_by_name(
|
||||
adapter_name
|
||||
)
|
||||
)
|
||||
|
||||
if adapter_manifest is None:
|
||||
return self.http_status(404, -1, 'adapter not found')
|
||||
@@ -37,4 +39,4 @@ class AdaptersRouterGroup(group.RouterGroup):
|
||||
if icon_path is None:
|
||||
return self.http_status(404, -1, 'icon not found')
|
||||
|
||||
return await quart.send_file(icon_path)
|
||||
return await quart.send_file(icon_path)
|
||||
|
||||
Reference in New Issue
Block a user