Skip to content

Documentation and Code refactor #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 27, 2024
Prev Previous commit
Next Next commit
utility clean up
  • Loading branch information
eadwinCode committed Jan 21, 2024
commit ca0b6c4b378d3a24fae356de16b4086f97f7ffe8
21 changes: 0 additions & 21 deletions ellar_sql/model/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import re
import typing as t
from io import BytesIO

import sqlalchemy as sa
import sqlalchemy.orm as sa_orm
Expand All @@ -9,25 +7,6 @@

from .database_binds import get_metadata, has_metadata, update_database_metadata

KB = 1024
MB = 1024 * KB


def copy_stream(source: t.IO, target: t.IO, *, chunk_size: int = 16 * KB) -> int: # type:ignore[type-arg]
length = 0
while 1:
buf = source.read(chunk_size)
if not buf:
break
length += len(buf)
target.write(buf)
return length


def get_length(source: t.IO) -> int: # type:ignore[type-arg]
buffer = BytesIO()
return copy_stream(source, buffer)


def make_metadata(database_key: str) -> sa.MetaData:
if has_metadata(database_key):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy