Skip to content

Commit ca0b6c4

Browse files
committed
utility clean up
1 parent f3f955c commit ca0b6c4

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

ellar_sql/model/utils.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import re
2-
import typing as t
3-
from io import BytesIO
42

53
import sqlalchemy as sa
64
import sqlalchemy.orm as sa_orm
@@ -9,25 +7,6 @@
97

108
from .database_binds import get_metadata, has_metadata, update_database_metadata
119

12-
KB = 1024
13-
MB = 1024 * KB
14-
15-
16-
def copy_stream(source: t.IO, target: t.IO, *, chunk_size: int = 16 * KB) -> int: # type:ignore[type-arg]
17-
length = 0
18-
while 1:
19-
buf = source.read(chunk_size)
20-
if not buf:
21-
break
22-
length += len(buf)
23-
target.write(buf)
24-
return length
25-
26-
27-
def get_length(source: t.IO) -> int: # type:ignore[type-arg]
28-
buffer = BytesIO()
29-
return copy_stream(source, buffer)
30-
3110

3211
def make_metadata(database_key: str) -> sa.MetaData:
3312
if has_metadata(database_key):

0 commit comments

Comments
 (0)