From db4c4e485b47d5da35049e21c933431a9c5f6dd3 Mon Sep 17 00:00:00 2001 From: Miri Bar Date: Sun, 16 Jun 2024 15:47:09 +0300 Subject: [PATCH] fix: anyio -> aiofiles --- ai21_tokenizer/utils.py | 5 +++-- poetry.lock | 46 +++++++++++------------------------------ pyproject.toml | 4 +++- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/ai21_tokenizer/utils.py b/ai21_tokenizer/utils.py index 4ff468d..378a831 100644 --- a/ai21_tokenizer/utils.py +++ b/ai21_tokenizer/utils.py @@ -2,7 +2,8 @@ import json from pathlib import Path from typing import Any, Dict, Union, Optional, BinaryIO -from anyio import open_file + +import aiofiles _NUMBER_DIGITS = set("0123456789") PathLike = Union[Path, str] @@ -29,7 +30,7 @@ def load_binary(file_path: PathLike) -> bytes: async def aload_binary(file_path: PathLike) -> bytes: # file_path = _str_to_path(file_path) - async with await open_file(file_path, "rb") as f: + async with await aiofiles.open(file_path, "rb") as f: return await f.read() diff --git a/poetry.lock b/poetry.lock index d376067..2f4896e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,40 +1,29 @@ # This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] -name = "annotated-types" -version = "0.5.0" -description = "Reusable constraint types to use with typing.Annotated" +name = "aiofiles" +version = "23.2.1" +description = "File support for asyncio." optional = false python-versions = ">=3.7" files = [ - {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, - {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, + {file = "aiofiles-23.2.1-py3-none-any.whl", hash = "sha256:19297512c647d4b27a2cf7c34caa7e405c0d60b5560618a29a9fe027b18b0107"}, + {file = "aiofiles-23.2.1.tar.gz", hash = "sha256:84ec2218d8419404abcb9f0c02df3f34c6e0a68ed41072acfb1cef5cbc29051a"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} - [[package]] -name = "anyio" -version = "3.7.1" -description = "High level compatibility layer for multiple asynchronous event loop implementations" +name = "annotated-types" +version = "0.5.0" +description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.7" files = [ - {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, - {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, + {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, + {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, ] [package.dependencies] -exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} -idna = ">=2.8" -sniffio = ">=1.1" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} - -[package.extras] -doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] -test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (<0.22)"] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "authlib" @@ -1587,17 +1576,6 @@ files = [ {file = "smmap-5.0.1.tar.gz", hash = "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62"}, ] -[[package]] -name = "sniffio" -version = "1.3.1" -description = "Sniff out which async library your code is running under" -optional = false -python-versions = ">=3.7" -files = [ - {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, - {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, -] - [[package]] name = "tokenizers" version = "0.19.1" @@ -1870,4 +1848,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "ab15856a5557e9077b60de042b7dff4f4c2badce810cd3e5e4cb0c6b44dfa7ad" +content-hash = "107a77e9a1e38b745784f1aee0a1d6da5076c35a2eaeb9fcc339284cb589b053" diff --git a/pyproject.toml b/pyproject.toml index 30c83df..f59ba74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ packages = [ python = "^3.7" sentencepiece = ">=0.2.0,<1.0.0" tokenizers = ">=0.15.0,<1.0.0" -anyio = "3.7.1" +aiofiles = "^23.2" [tool.poetry.group.dev.dependencies] black = "*" @@ -108,6 +108,8 @@ newline_sequence = "\n" + + [tool.poetry.group.test.dependencies] coverage = "^7.1.0" pytest = "7.4.4"