Renamed classes.py into decrypted_accounts.py. Removed unnessesary elements from that file
This commit is contained in:
parent
3f744723a9
commit
50eb3057d5
@ -6,8 +6,8 @@ from . import (
|
|||||||
account_checks,
|
account_checks,
|
||||||
account_parsing,
|
account_parsing,
|
||||||
bot,
|
bot,
|
||||||
classes,
|
|
||||||
database,
|
database,
|
||||||
|
decrypted_account,
|
||||||
encryption,
|
encryption,
|
||||||
generate_password,
|
generate_password,
|
||||||
)
|
)
|
||||||
@ -16,7 +16,7 @@ __all__ = [
|
|||||||
"account_checks",
|
"account_checks",
|
||||||
"account_parsing",
|
"account_parsing",
|
||||||
"bot",
|
"bot",
|
||||||
"classes",
|
"decrypted_account",
|
||||||
"encryption",
|
"encryption",
|
||||||
"database",
|
"database",
|
||||||
"generate_password",
|
"generate_password",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import string
|
import string
|
||||||
|
|
||||||
from .classes import DecryptedAccount
|
from .decrypted_account import DecryptedAccount
|
||||||
|
|
||||||
FORBIDDEN_CHARS = frozenset("`\n")
|
FORBIDDEN_CHARS = frozenset("`\n")
|
||||||
PUNCTUATION = frozenset(string.punctuation).difference(FORBIDDEN_CHARS)
|
PUNCTUATION = frozenset(string.punctuation).difference(FORBIDDEN_CHARS)
|
||||||
|
@ -3,7 +3,7 @@ from typing import Iterable, Self
|
|||||||
|
|
||||||
import pydantic
|
import pydantic
|
||||||
|
|
||||||
from .classes import DecryptedAccount
|
from .decrypted_account import DecryptedAccount
|
||||||
|
|
||||||
|
|
||||||
class _Account(pydantic.BaseModel):
|
class _Account(pydantic.BaseModel):
|
||||||
|
@ -13,7 +13,7 @@ from ..account_checks import (
|
|||||||
check_password,
|
check_password,
|
||||||
)
|
)
|
||||||
from ..account_parsing import accounts_to_json, json_to_accounts
|
from ..account_parsing import accounts_to_json, json_to_accounts
|
||||||
from ..classes import DecryptedAccount
|
from ..decrypted_account import DecryptedAccount
|
||||||
|
|
||||||
Message = telebot.types.Message
|
Message = telebot.types.Message
|
||||||
|
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
from typing import Self, TypeAlias
|
|
||||||
|
|
||||||
import pydantic
|
|
||||||
|
|
||||||
from .database import models
|
|
||||||
|
|
||||||
Account: TypeAlias = models.Account
|
|
||||||
|
|
||||||
|
|
||||||
class DecryptedAccount(pydantic.BaseModel):
|
|
||||||
user_id: int
|
|
||||||
name: str
|
|
||||||
login: str
|
|
||||||
password: str
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_tuple(cls, tuple_: tuple[str, str, str]) -> Self:
|
|
||||||
return cls(name=tuple_[0], login=tuple_[1], password=tuple_[2])
|
|
||||||
|
|
||||||
def as_tuple(self) -> tuple[str, str, str]:
|
|
||||||
return (self.name, self.login, self.password)
|
|
8
src/decrypted_account.py
Normal file
8
src/decrypted_account.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import pydantic
|
||||||
|
|
||||||
|
|
||||||
|
class DecryptedAccount(pydantic.BaseModel):
|
||||||
|
user_id: int
|
||||||
|
name: str
|
||||||
|
login: str
|
||||||
|
password: str
|
@ -7,7 +7,7 @@ from cryptography.hazmat.backends import default_backend
|
|||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
||||||
|
|
||||||
from ..classes import DecryptedAccount
|
from ..decrypted_account import DecryptedAccount
|
||||||
from ..database.models import Account
|
from ..database.models import Account
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user