Skip to content

Commit

Permalink
chore(core): bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Dec 18, 2023
1 parent 3f5e5c1 commit f22cf8c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .mina/console.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
includes = ["avilla/console"]
raw-dependencies = [
"avilla-core >= 1.0.0a6",
"avilla-core >= 1.0.0a18",
]

[project]
name = "avilla-console"
version = "1.0.0a9" # WIP for release.
version = "1.0.0a18" # WIP for release.
authors = [
{name = "RF-Tar-Railt", email = "[email protected]"},
]
Expand Down
2 changes: 1 addition & 1 deletion .mina/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ includes = [

[project]
name = "avilla-core"
version = "1.0.0a17"
version = "1.0.0a18"
authors = [
{name = "GreyElaina", email = "[email protected]"},
{name = "BlueGlassBlock", email = "[email protected]"},
Expand Down
23 changes: 17 additions & 6 deletions avilla/core/builtins/resource_fetch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from __future__ import annotations

from aiohttp import ClientSession
from avilla.core.resource import LocalFileResource, RawResource, UrlResource
from avilla.core.ryanvk.collector.application import ApplicationCollector

try:
from aiohttp import ClientSession
aio = True
except ImportError:
ClientSession = None
aio = False

from .capability import CoreCapability


Expand All @@ -16,8 +22,13 @@ async def fetch_localfile(self, resource: LocalFileResource):
async def fetch_raw(self, resource: RawResource):
return resource.data

@m.entity(CoreCapability.fetch, resource=UrlResource)
async def fetch_url(self, resource: UrlResource):
async with ClientSession() as session:
async with session.get(resource.url) as resp:
return await resp.read()
if aio:
@m.entity(CoreCapability.fetch, resource=UrlResource)
async def fetch_url(self, resource: UrlResource):
async with ClientSession() as session:
async with session.get(resource.url) as resp:
return await resp.read()
else:
@m.entity(CoreCapability.fetch, resource=UrlResource)
async def fetch_url(self, resource: UrlResource):
raise NotImplementedError("aiohttp is not installed")

0 comments on commit f22cf8c

Please sign in to comment.