chore: import upstream snapshot with attribution
Integ / changes (push) Has been skipped
Pre-commit / pre-commit (push) Failing after 1s
CLI exit codes / changes (push) Has been skipped
Test (Install) / changes (push) Has been skipped
Test (Python) / changes (push) Has been skipped
Test (TypeScript) / changes (push) Has been skipped
CLI exit codes / cli-gate (push) Has been cancelled
Test (Install) / test-install-gate (push) Has been cancelled
Integ / integ-gate (push) Has been cancelled
Test (Python) / test-python-gate (push) Has been cancelled
Test (TypeScript) / test-typescript-gate (push) Has been cancelled
Test (Install) / python-minimal (3.12) (push) Has been cancelled
Test (Install) / python-minimal (3.11) (push) Has been cancelled
Test (Install) / python-extra (agno, mirage.agents.agno) (push) Has been cancelled
Test (Install) / python-extra (chroma, mirage.resource.chroma) (push) Has been cancelled
Test (Install) / python-extra (pdf, mirage.core.filetype.pdf) (push) Has been cancelled
Integ / integ (push) Has been cancelled
Integ / integ-database (push) Has been cancelled
Integ / integ-database-ts (push) Has been cancelled
Integ / integ-data (push) Has been cancelled
Integ / integ-ssh (push) Has been cancelled
Integ / integ-ssh-ts (push) Has been cancelled
Test (Python) / audit (push) Has been cancelled
Test (TypeScript) / test (push) Has been cancelled
Test (TypeScript) / python-fs-shim (push) Has been cancelled
CLI exit codes / Python CLI (push) Has been cancelled
CLI exit codes / TypeScript CLI (push) Has been cancelled
CLI exit codes / Cross-language snapshot interop (push) Has been cancelled
Test (Python) / test (push) Has been cancelled
Test (Python) / import-isolation (deepagents, openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Python) / import-isolation (deepagents, pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Integ / integ-ts (push) Has been cancelled
Integ / integ-fuse (push) Has been cancelled
Test (Install) / python-extra (databricks, mirage.resource.databricks_volume) (push) Has been cancelled
Test (Install) / python-extra (deepagents, mirage.agents.langchain) (push) Has been cancelled
Test (Install) / python-extra (email, mirage.resource.email) (push) Has been cancelled
Test (Install) / python-extra (fuse, mirage.fuse.mount) (push) Has been cancelled
Test (Install) / python-extra (hdf5, mirage.core.filetype.hdf5) (push) Has been cancelled
Test (Install) / python-extra (hf, mirage.resource.hf_buckets) (push) Has been cancelled
Test (Install) / python-extra (lancedb, mirage.resource.lancedb) (push) Has been cancelled
Test (Install) / python-extra (langfuse, mirage.resource.langfuse) (push) Has been cancelled
Test (Install) / python-extra (mongodb, mirage.resource.mongodb) (push) Has been cancelled
Test (Install) / python-extra (nextcloud, mirage.resource.nextcloud) (push) Has been cancelled
Test (Install) / python-extra (openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Install) / python-extra (openhands, mirage.agents.openhands, 3.12) (push) Has been cancelled
Test (Install) / python-extra (parquet, mirage.core.filetype.parquet) (push) Has been cancelled
Test (Install) / python-extra (postgres, mirage.resource.postgres) (push) Has been cancelled
Test (Install) / python-extra (pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Test (Install) / python-extra (qdrant, mirage.resource.qdrant) (push) Has been cancelled
Test (Install) / python-extra (redis, mirage.resource.redis) (push) Has been cancelled
Test (Install) / python-extra (s3, mirage.resource.s3) (push) Has been cancelled
Test (Install) / python-extra (ssh, mirage.resource.ssh) (push) Has been cancelled
Test (Install) / ts-minimal (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:30:44 +08:00
commit bcbd1bdb22
5748 changed files with 562488 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.ops import Ops
__all__ = ["Ops"]
+7
View File
@@ -0,0 +1,7 @@
from mirage.ops.chroma.grep import grep
from mirage.ops.chroma.read import read
from mirage.ops.chroma.readdir import readdir
from mirage.ops.chroma.search import search
from mirage.ops.chroma.stat import stat
OPS = [read, readdir, stat, grep, search]
+10
View File
@@ -0,0 +1,10 @@
from mirage.core.chroma.grep import grep_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("grep", resource="chroma")
async def grep(accessor, paths: list[PathSpec], pattern: str, *, index,
**kwargs) -> bytes:
output, _reads = await grep_bytes(accessor, paths, pattern, index)
return output
+8
View File
@@ -0,0 +1,8 @@
from mirage.core.chroma.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="chroma")
async def read(accessor, path: PathSpec, *, index, **kwargs) -> bytes:
return await read_bytes(accessor, path, index)
+8
View File
@@ -0,0 +1,8 @@
from mirage.core.chroma.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="chroma")
async def readdir(accessor, path: PathSpec, *, index, **kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+18
View File
@@ -0,0 +1,18 @@
from mirage.core.chroma import search as search_core
from mirage.ops.registry import op
from mirage.types import PathSpec
from mirage.utils.key_prefix import mount_prefix_of
@op("search", resource="chroma")
async def search(accessor, paths: list[PathSpec], query: str, *, index,
**kwargs) -> bytes:
explicit_prefix = kwargs.pop("mount_prefix", "")
mount_prefix = mount_prefix_of(
paths[0].virtual, paths[0].resource_path) if paths else explicit_prefix
return await search_core.search_segments(accessor,
query,
paths,
index,
mount_prefix=mount_prefix,
**kwargs)
+8
View File
@@ -0,0 +1,8 @@
from mirage.core.chroma.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="chroma")
async def stat(accessor, path: PathSpec, *, index, **kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+29
View File
@@ -0,0 +1,29 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from dataclasses import dataclass, field
from mirage.accessor.base import Accessor
from mirage.cache.index import IndexCacheStore
from mirage.types import MountMode
@dataclass
class OpsMount:
prefix: str
resource_type: str
accessor: Accessor
index: IndexCacheStore
mode: MountMode
ops: list = field(default_factory=list)
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.databricks_volume.create import create
from mirage.ops.databricks_volume.mkdir import mkdir
from mirage.ops.databricks_volume.read import read
from mirage.ops.databricks_volume.readdir import readdir
from mirage.ops.databricks_volume.rename import rename
from mirage.ops.databricks_volume.rmdir import rmdir
from mirage.ops.databricks_volume.stat import stat
from mirage.ops.databricks_volume.unlink import unlink
from mirage.ops.databricks_volume.write import write
OPS = [read, readdir, stat, write, create, unlink, mkdir, rmdir, rename]
@@ -0,0 +1,29 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.create import create as create_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("create", resource="databricks_volume", write=True)
async def create(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
*,
index,
**kwargs,
) -> None:
await create_core(accessor, path, index)
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.mkdir import mkdir as mkdir_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("mkdir", resource="databricks_volume", write=True)
async def mkdir(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
**kwargs,
) -> None:
await mkdir_core(accessor, path, kwargs.get("index"), parents=True)
@@ -0,0 +1,29 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="databricks_volume")
async def read(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
*,
index,
**kwargs,
) -> bytes:
return await read_bytes(accessor, path, index)
@@ -0,0 +1,29 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.readdir import readdir as readdir_impl
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="databricks_volume")
async def readdir(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
*,
index,
**kwargs,
) -> list[str]:
return await readdir_impl(accessor, path, index)
@@ -0,0 +1,28 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.rename import rename as rename_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("rename", resource="databricks_volume", write=True)
async def rename(
accessor: DatabricksVolumeAccessor,
src: PathSpec,
dst: PathSpec,
**kwargs,
) -> None:
await rename_core(accessor, src, dst, kwargs.get("index"))
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.rmdir import rmdir as rmdir_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("rmdir", resource="databricks_volume", write=True)
async def rmdir(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
**kwargs,
) -> None:
await rmdir_core(accessor, path, kwargs.get("index"))
@@ -0,0 +1,29 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.stat import stat as stat_impl
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="databricks_volume")
async def stat(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
*,
index,
**kwargs,
) -> FileStat:
return await stat_impl(accessor, path, index)
@@ -0,0 +1,29 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.unlink import unlink as unlink_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("unlink", resource="databricks_volume", write=True)
async def unlink(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
*,
index,
**kwargs,
) -> None:
await unlink_core(accessor, path, index)
@@ -0,0 +1,30 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.databricks_volume import DatabricksVolumeAccessor
from mirage.core.databricks_volume.write import write_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("write", resource="databricks_volume", write=True)
async def write(
accessor: DatabricksVolumeAccessor,
path: PathSpec,
data: bytes,
*,
index,
**kwargs,
) -> None:
await write_bytes(accessor, path, data, index)
+7
View File
@@ -0,0 +1,7 @@
from mirage.ops.dify.grep import grep
from mirage.ops.dify.read import read
from mirage.ops.dify.readdir import readdir
from mirage.ops.dify.search import search
from mirage.ops.dify.stat import stat
OPS = [read, readdir, stat, grep, search]
+10
View File
@@ -0,0 +1,10 @@
from mirage.core.dify.grep import grep_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("grep", resource="dify")
async def grep(accessor, paths: list[PathSpec], pattern: str, *, index,
**kwargs) -> bytes:
output, _reads = await grep_bytes(accessor, paths, pattern, index)
return output
+8
View File
@@ -0,0 +1,8 @@
from mirage.core.dify.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="dify")
async def read(accessor, path: PathSpec, *, index, **kwargs) -> bytes:
return await read_bytes(accessor, path, index)
+8
View File
@@ -0,0 +1,8 @@
from mirage.core.dify.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="dify")
async def readdir(accessor, path: PathSpec, *, index, **kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+18
View File
@@ -0,0 +1,18 @@
from mirage.core.dify import search as search_core
from mirage.ops.registry import op
from mirage.types import PathSpec
from mirage.utils.key_prefix import mount_prefix_of
@op("search", resource="dify")
async def search(accessor, paths: list[PathSpec], query: str, *, index,
**kwargs) -> bytes:
explicit_prefix = kwargs.pop("mount_prefix", "")
mount_prefix = mount_prefix_of(
paths[0].virtual, paths[0].resource_path) if paths else explicit_prefix
return await search_core.search_segments(accessor,
query,
paths,
index,
mount_prefix=mount_prefix,
**kwargs)
+8
View File
@@ -0,0 +1,8 @@
from mirage.core.dify.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="dify")
async def stat(accessor, path: PathSpec, *, index, **kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.discord.read import read
from mirage.ops.discord.readdir import readdir
from mirage.ops.discord.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.discord import DiscordAccessor
from mirage.core.discord.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="discord")
async def read(accessor: DiscordAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.discord import DiscordAccessor
from mirage.core.discord.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="discord")
async def readdir(accessor: DiscordAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.discord import DiscordAccessor
from mirage.core.discord.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="discord")
async def stat(accessor: DiscordAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+45
View File
@@ -0,0 +1,45 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
import logging
from mirage.commands.optional import try_load_command
from mirage.ops.disk.append import append_bytes
from mirage.ops.disk.create import create
from mirage.ops.disk.mkdir import mkdir
from mirage.ops.disk.read.read import read
from mirage.ops.disk.readdir import readdir
from mirage.ops.disk.rename import rename
from mirage.ops.disk.rmdir import rmdir
from mirage.ops.disk.stat import stat
from mirage.ops.disk.truncate import truncate
from mirage.ops.disk.unlink import unlink
from mirage.ops.disk.write import write as write_bytes
_logger = logging.getLogger(__name__)
read_feather = try_load_command("mirage.ops.disk.read.read_feather",
"read_feather", "parquet")
read_hdf5 = try_load_command("mirage.ops.disk.read.read_hdf5", "read_hdf5",
"hdf5")
read_orc = try_load_command("mirage.ops.disk.read.read_orc", "read_orc",
"parquet")
read_parquet = try_load_command("mirage.ops.disk.read.read_parquet",
"read_parquet", "parquet")
OPS = [
c for c in (append_bytes, create, mkdir, read, read_feather, read_hdf5,
read_orc, read_parquet, readdir, rename, rmdir, stat, truncate,
unlink, write_bytes) if c is not None
]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.append import append_bytes as _core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("append", resource="disk", write=True)
async def append_bytes(accessor: DiskAccessor, path: PathSpec, data: bytes,
**kwargs) -> None:
return await _core(accessor, path, data)
+23
View File
@@ -0,0 +1,23 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.create import create as core_create
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("create", resource="disk", write=True)
async def create(accessor: DiskAccessor, path: PathSpec, **kwargs) -> None:
await core_create(accessor, path)
+23
View File
@@ -0,0 +1,23 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.mkdir import mkdir as core_mkdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("mkdir", resource="disk", write=True)
async def mkdir(accessor: DiskAccessor, path: PathSpec, **kwargs) -> None:
await core_mkdir(accessor, path, parents=True)
+13
View File
@@ -0,0 +1,13 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="disk")
async def read(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await read_bytes(accessor, path, index)
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.read import read_bytes
from mirage.core.filetype.feather import cat as feather_cat
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="disk", filetype=".feather")
async def read_feather(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return feather_cat(raw)
+26
View File
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.read import read_bytes
from mirage.core.filetype.hdf5 import cat as hdf5_cat
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="disk", filetype=".hdf5")
async def read_hdf5(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return hdf5_cat(raw)
+26
View File
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.read import read_bytes
from mirage.core.filetype.orc import cat as orc_cat
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="disk", filetype=".orc")
async def read_orc(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return orc_cat(raw)
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.read import read_bytes
from mirage.core.filetype.parquet import cat as parquet_cat
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="disk", filetype=".parquet")
async def read_parquet(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return parquet_cat(raw)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="disk")
async def readdir(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.rename import rename as core_rename
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("rename", resource="disk", write=True)
async def rename(accessor: DiskAccessor, src: PathSpec, dst: PathSpec,
**kwargs) -> None:
await core_rename(accessor, src, dst)
+23
View File
@@ -0,0 +1,23 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.rmdir import rmdir as core_rmdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("rmdir", resource="disk", write=True)
async def rmdir(accessor: DiskAccessor, path: PathSpec, **kwargs) -> None:
await core_rmdir(accessor, path)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="disk")
async def stat(accessor: DiskAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.truncate import truncate as core_truncate
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("truncate", resource="disk", write=True)
async def truncate(accessor: DiskAccessor, path: PathSpec, length: int,
**kwargs) -> None:
await core_truncate(accessor, path, length)
+23
View File
@@ -0,0 +1,23 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.unlink import unlink as core_unlink
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("unlink", resource="disk", write=True)
async def unlink(accessor: DiskAccessor, path: PathSpec, **kwargs) -> None:
await core_unlink(accessor, path)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.disk import DiskAccessor
from mirage.core.disk.write import write_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("write", resource="disk", write=True)
async def write(accessor: DiskAccessor, path: PathSpec, data: bytes,
**kwargs) -> None:
await write_bytes(accessor, path, data)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.email.read import read
from mirage.ops.email.readdir import readdir
from mirage.ops.email.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.email import EmailAccessor
from mirage.core.email.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="email")
async def read(accessor: EmailAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.email import EmailAccessor
from mirage.core.email.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="email")
async def readdir(accessor: EmailAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.email import EmailAccessor
from mirage.core.email.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="email")
async def stat(accessor: EmailAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+145
View File
@@ -0,0 +1,145 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
import asyncio
import io
from mirage.bridge.sync import run_async_from_sync
from mirage.ops import Ops
class MirageFile:
def __init__(
self,
ops: Ops,
path: str,
mode: str = "r",
loop: asyncio.AbstractEventLoop | None = None,
**kwargs,
) -> None:
self._ops = ops
self._path = path
self._mode = mode
self._loop = loop
self._encoding = kwargs.get("encoding", "utf-8")
self._binary = "b" in mode
self._closed = False
self._buf: io.BytesIO | io.StringIO | None = None
def _run(self, coro):
return run_async_from_sync(coro, self._loop)
def _load(self) -> None:
if self._buf is not None:
return
if "w" in self._mode:
if self._binary:
self._buf = io.BytesIO()
else:
self._buf = io.StringIO()
return
if "a" in self._mode:
try:
data = self._run(self._ops.read(self._path))
except FileNotFoundError:
data = b""
if self._binary:
self._buf = io.BytesIO(data)
else:
self._buf = io.StringIO(data.decode(self._encoding))
self._buf.seek(0, 2)
return
data = self._run(self._ops.read(self._path))
if self._binary:
self._buf = io.BytesIO(data)
else:
self._buf = io.StringIO(data.decode(self._encoding))
@property
def closed(self) -> bool:
return self._closed
@property
def name(self) -> str:
return self._path
@property
def mode(self) -> str:
return self._mode
def readable(self) -> bool:
return "r" in self._mode
def writable(self) -> bool:
return "w" in self._mode or "a" in self._mode
def read(self, size: int = -1) -> bytes | str:
self._load()
return self._buf.read(size)
def readline(self) -> bytes | str:
self._load()
return self._buf.readline()
def readlines(self) -> list:
self._load()
return self._buf.readlines()
def write(self, data) -> int:
self._load()
return self._buf.write(data)
def writelines(self, lines) -> None:
self._load()
self._buf.writelines(lines)
def seek(self, offset: int, whence: int = 0) -> int:
self._load()
return self._buf.seek(offset, whence)
def tell(self) -> int:
self._load()
return self._buf.tell()
def flush(self) -> None:
pass
def close(self) -> None:
if self._closed:
return
self._closed = True
if "w" in self._mode or "a" in self._mode:
if self._buf is not None:
val = self._buf.getvalue()
if not self._binary:
val = val.encode(self._encoding)
self._run(self._ops.write(self._path, val))
def __del__(self) -> None:
self.close()
def __enter__(self):
return self
def __exit__(self, *exc):
self.close()
def __iter__(self):
self._load()
return iter(self._buf)
def __next__(self):
self._load()
return next(self._buf)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.gdocs.read import read
from mirage.ops.gdocs.readdir import readdir
from mirage.ops.gdocs.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdocs import GDocsAccessor
from mirage.core.gdocs.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=["gdocs", "gdrive"], filetype=".gdoc.json")
async def read(accessor: GDocsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdocs import GDocsAccessor
from mirage.core.gdocs.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="gdocs")
async def readdir(accessor: GDocsAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdocs import GDocsAccessor
from mirage.core.gdocs.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="gdocs")
async def stat(accessor: GDocsAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+36
View File
@@ -0,0 +1,36 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
import logging
from mirage.commands.optional import try_load_command
from mirage.ops.gdrive.read.read import read
from mirage.ops.gdrive.readdir import readdir
from mirage.ops.gdrive.stat import stat
_logger = logging.getLogger(__name__)
read_feather = try_load_command("mirage.ops.gdrive.read.read_feather",
"read_feather", "parquet")
read_hdf5 = try_load_command("mirage.ops.gdrive.read.read_hdf5", "read_hdf5",
"hdf5")
read_orc = try_load_command("mirage.ops.gdrive.read.read_orc", "read_orc",
"parquet")
read_parquet = try_load_command("mirage.ops.gdrive.read.read_parquet",
"read_parquet", "parquet")
OPS = [
c for c in (read, read_feather, read_hdf5, read_orc, read_parquet, readdir,
stat) if c is not None
]
+13
View File
@@ -0,0 +1,13 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.gdrive.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="gdrive")
async def read(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.filetype.feather import cat as feather_cat
from mirage.core.gdrive.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="gdrive", filetype=".feather")
async def read_feather(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await core_read(accessor, path, index)
return feather_cat(raw)
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.filetype.hdf5 import cat as hdf5_cat
from mirage.core.gdrive.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="gdrive", filetype=".hdf5")
async def read_hdf5(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await core_read(accessor, path, index)
return hdf5_cat(raw)
+26
View File
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.filetype.orc import cat as orc_cat
from mirage.core.gdrive.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="gdrive", filetype=".orc")
async def read_orc(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await core_read(accessor, path, index)
return orc_cat(raw)
@@ -0,0 +1,26 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.filetype.parquet import cat as parquet_cat
from mirage.core.gdrive.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="gdrive", filetype=".parquet")
async def read_parquet(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await core_read(accessor, path, index)
return parquet_cat(raw)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.gdrive.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="gdrive")
async def readdir(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gdrive import GDriveAccessor
from mirage.core.gdrive.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="gdrive")
async def stat(accessor: GDriveAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.github.read import read
from mirage.ops.github.readdir import readdir
from mirage.ops.github.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.github import GitHubAccessor
from mirage.core.github.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="github")
async def read(accessor: GitHubAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.github import GitHubAccessor
from mirage.core.github.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="github")
async def readdir(accessor: GitHubAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.github import GitHubAccessor
from mirage.core.github.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="github")
async def stat(accessor: GitHubAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.github_ci.read import read
from mirage.ops.github_ci.readdir import readdir
from mirage.ops.github_ci.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.github_ci import GitHubCIAccessor
from mirage.core.github_ci.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="github_ci")
async def read(accessor: GitHubCIAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.github_ci import GitHubCIAccessor
from mirage.core.github_ci.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="github_ci")
async def readdir(accessor: GitHubCIAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.github_ci import GitHubCIAccessor
from mirage.core.github_ci.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="github_ci")
async def stat(accessor: GitHubCIAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.gmail.read import read
from mirage.ops.gmail.readdir import readdir
from mirage.ops.gmail.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gmail import GmailAccessor
from mirage.core.gmail.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="gmail")
async def read(accessor: GmailAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gmail import GmailAccessor
from mirage.core.gmail.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="gmail")
async def readdir(accessor: GmailAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gmail import GmailAccessor
from mirage.core.gmail.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="gmail")
async def stat(accessor: GmailAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.gsheets.read import read
from mirage.ops.gsheets.readdir import readdir
from mirage.ops.gsheets.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gsheets import GSheetsAccessor
from mirage.core.gsheets.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=["gsheets", "gdrive"], filetype=".gsheet.json")
async def read(accessor: GSheetsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gsheets import GSheetsAccessor
from mirage.core.gsheets.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="gsheets")
async def readdir(accessor: GSheetsAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gsheets import GSheetsAccessor
from mirage.core.gsheets.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="gsheets")
async def stat(accessor: GSheetsAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.gslides.read import read
from mirage.ops.gslides.readdir import readdir
from mirage.ops.gslides.stat import stat
OPS = [read, readdir, stat]
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gslides import GSlidesAccessor
from mirage.core.gslides.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=["gslides", "gdrive"], filetype=".gslide.json")
async def read(accessor: GSlidesAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gslides import GSlidesAccessor
from mirage.core.gslides.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="gslides")
async def readdir(accessor: GSlidesAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+24
View File
@@ -0,0 +1,24 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.gslides import GSlidesAccessor
from mirage.core.gslides.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="gslides")
async def stat(accessor: GSlidesAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)
+36
View File
@@ -0,0 +1,36 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.commands.optional import try_load_command
from mirage.ops.hf_buckets.create import create
from mirage.ops.hf_buckets.mkdir import mkdir
from mirage.ops.hf_buckets.read.read import read
from mirage.ops.hf_buckets.readdir import readdir
from mirage.ops.hf_buckets.stat import stat
from mirage.ops.hf_buckets.unlink import unlink
from mirage.ops.hf_buckets.write import write
read_feather = try_load_command("mirage.ops.hf_buckets.read.read_feather",
"read_feather", "parquet")
read_hdf5 = try_load_command("mirage.ops.hf_buckets.read.read_hdf5",
"read_hdf5", "hdf5")
read_orc = try_load_command("mirage.ops.hf_buckets.read.read_orc", "read_orc",
"parquet")
read_parquet = try_load_command("mirage.ops.hf_buckets.read.read_parquet",
"read_parquet", "parquet")
OPS = [
c for c in (read, read_feather, read_hdf5, read_orc, read_parquet, readdir,
stat, write, create, unlink, mkdir) if c is not None
]
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.create import create as create_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("create", resource=HF_RESOURCES, write=True)
async def create(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> None:
await create_core(accessor, path, index)
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.mkdir import mkdir as mkdir_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("mkdir", resource=HF_RESOURCES, write=True)
async def mkdir(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> None:
await mkdir_core(accessor, path, index)
@@ -0,0 +1,13 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=HF_RESOURCES)
async def read(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
return await read_bytes(accessor, path, index)
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.filetype.feather import cat as feather_cat
from mirage.core.hf_buckets.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=HF_RESOURCES, filetype=".feather")
async def read_feather(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return feather_cat(raw)
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.filetype.hdf5 import cat as hdf5_cat
from mirage.core.hf_buckets.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=HF_RESOURCES, filetype=".hdf5")
async def read_hdf5(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return hdf5_cat(raw)
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.filetype.orc import cat as orc_cat
from mirage.core.hf_buckets.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=HF_RESOURCES, filetype=".orc")
async def read_orc(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return orc_cat(raw)
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.filetype.parquet import cat as parquet_cat
from mirage.core.hf_buckets.read import read_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource=HF_RESOURCES, filetype=".parquet")
async def read_parquet(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> bytes:
raw = await read_bytes(accessor, path, index)
return parquet_cat(raw)
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.readdir import readdir as readdir_impl
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource=HF_RESOURCES)
async def readdir(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> list[str]:
return await readdir_impl(accessor, path, index)
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.stat import stat as stat_impl
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource=HF_RESOURCES)
async def stat(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> FileStat:
return await stat_impl(accessor, path, index)
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.unlink import unlink as unlink_core
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("unlink", resource=HF_RESOURCES, write=True)
async def unlink(accessor: HfBucketsAccessor, path: PathSpec, *, index,
**kwargs) -> None:
await unlink_core(accessor, path, index)
+25
View File
@@ -0,0 +1,25 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor._hf import HF_RESOURCES
from mirage.accessor.hf_buckets import HfBucketsAccessor
from mirage.core.hf_buckets.write import write_bytes
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("write", resource=HF_RESOURCES, write=True)
async def write(accessor: HfBucketsAccessor, path: PathSpec, data: bytes, *,
index, **kwargs) -> None:
await write_bytes(accessor, path, data, index)
+19
View File
@@ -0,0 +1,19 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.ops.history.read import read
from mirage.ops.history.readdir import readdir
from mirage.ops.history.stat import stat
OPS = [read, readdir, stat]
+27
View File
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.history import HistoryAccessor
from mirage.core.history.read import read as core_read
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("read", resource="history")
async def read(accessor: HistoryAccessor,
path: PathSpec,
*,
index=None,
**kwargs) -> bytes:
return await core_read(accessor, path, index)
+27
View File
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.history import HistoryAccessor
from mirage.core.history.readdir import readdir as core_readdir
from mirage.ops.registry import op
from mirage.types import PathSpec
@op("readdir", resource="history")
async def readdir(accessor: HistoryAccessor,
path: PathSpec,
*,
index=None,
**kwargs) -> list[str]:
return await core_readdir(accessor, path, index)
+27
View File
@@ -0,0 +1,27 @@
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
from mirage.accessor.history import HistoryAccessor
from mirage.core.history.stat import stat as core_stat
from mirage.ops.registry import op
from mirage.types import FileStat, PathSpec
@op("stat", resource="history")
async def stat(accessor: HistoryAccessor,
path: PathSpec,
*,
index=None,
**kwargs) -> FileStat:
return await core_stat(accessor, path, index)

Some files were not shown because too many files have changed in this diff Show More