From 87a5b8239c4995ee7ed98b2e58637e1c64ad4987 Mon Sep 17 00:00:00 2001 From: David Carmichael Date: Thu, 19 Sep 2024 19:47:13 +0100 Subject: [PATCH] make packages private --- src/flask_imp/__init__.py | 4 +-- .../{exceptions.py => _exceptions.py} | 0 src/flask_imp/{imp.py => _imp.py} | 6 ++--- .../{imp_blueprint.py => _imp_blueprint.py} | 4 +-- src/flask_imp/{protocols.py => _protocols.py} | 0 .../{registeries.py => _registries.py} | 0 src/flask_imp/{utilities.py => _utilities.py} | 2 +- src/flask_imp/auth/__init__.py | 26 +++++++++---------- ..._password.py => _authenticate_password.py} | 2 +- .../auth/{dataclasses.py => _dataclasses.py} | 0 ...crypt_password.py => _encrypt_password.py} | 2 +- ...py => _generate_alphanumeric_validator.py} | 0 ..._csrf_token.py => _generate_csrf_token.py} | 0 ...idator.py => _generate_email_validator.py} | 2 +- ...ator.py => _generate_numeric_validator.py} | 0 ...rate_password.py => _generate_password.py} | 4 +-- ...rivate_key.py => _generate_private_key.py} | 0 .../{generate_salt.py => _generate_salt.py} | 0 ...ss_valid.py => _is_email_address_valid.py} | 0 ...sername_valid.py => _is_username_valid.py} | 0 .../auth/{__legacy__.py => _legacy.py} | 22 ++++++++-------- ...__private_funcs__.py => _private_funcs.py} | 0 src/flask_imp/config/__init__.py | 12 ++++----- ...database_config.py => _database_config.py} | 0 .../{flask_config.py => _flask_config.py} | 0 ...int_config.py => _imp_blueprint_config.py} | 2 +- .../config/{imp_config.py => _imp_config.py} | 0 ...base_config.py => _sql_database_config.py} | 0 ...e_config.py => _sqlite_database_config.py} | 0 src/flask_imp/security/__init__.py | 10 +++---- ...api_login_check.py => _api_login_check.py} | 2 +- .../{include_csrf.py => _include_csrf.py} | 0 .../{login_check.py => _login_check.py} | 2 +- ...ction_check.py => _pass_function_check.py} | 0 ...rmission_check.py => _permission_check.py} | 2 +- ...__private_funcs__.py => _private_funcs.py} | 0 36 files changed, 52 insertions(+), 52 deletions(-) rename src/flask_imp/{exceptions.py => _exceptions.py} (100%) rename src/flask_imp/{imp.py => _imp.py} (98%) rename src/flask_imp/{imp_blueprint.py => _imp_blueprint.py} (98%) rename src/flask_imp/{protocols.py => _protocols.py} (100%) rename src/flask_imp/{registeries.py => _registries.py} (100%) rename src/flask_imp/{utilities.py => _utilities.py} (99%) rename src/flask_imp/auth/{authenticate_password.py => _authenticate_password.py} (98%) rename src/flask_imp/auth/{dataclasses.py => _dataclasses.py} (100%) rename src/flask_imp/auth/{encrypt_password.py => _encrypt_password.py} (97%) rename src/flask_imp/auth/{generate_alphanumeric_validator.py => _generate_alphanumeric_validator.py} (100%) rename src/flask_imp/auth/{generate_csrf_token.py => _generate_csrf_token.py} (100%) rename src/flask_imp/auth/{generate_email_validator.py => _generate_email_validator.py} (85%) rename src/flask_imp/auth/{generate_numeric_validator.py => _generate_numeric_validator.py} (100%) rename src/flask_imp/auth/{generate_password.py => _generate_password.py} (92%) rename src/flask_imp/auth/{generate_private_key.py => _generate_private_key.py} (100%) rename src/flask_imp/auth/{generate_salt.py => _generate_salt.py} (100%) rename src/flask_imp/auth/{is_email_address_valid.py => _is_email_address_valid.py} (100%) rename src/flask_imp/auth/{is_username_valid.py => _is_username_valid.py} (100%) rename src/flask_imp/auth/{__legacy__.py => _legacy.py} (90%) rename src/flask_imp/auth/{__private_funcs__.py => _private_funcs.py} (100%) rename src/flask_imp/config/{database_config.py => _database_config.py} (100%) rename src/flask_imp/config/{flask_config.py => _flask_config.py} (100%) rename src/flask_imp/config/{imp_blueprint_config.py => _imp_blueprint_config.py} (97%) rename src/flask_imp/config/{imp_config.py => _imp_config.py} (100%) rename src/flask_imp/config/{sql_database_config.py => _sql_database_config.py} (100%) rename src/flask_imp/config/{sqlite_database_config.py => _sqlite_database_config.py} (100%) rename src/flask_imp/security/{api_login_check.py => _api_login_check.py} (96%) rename src/flask_imp/security/{include_csrf.py => _include_csrf.py} (100%) rename src/flask_imp/security/{login_check.py => _login_check.py} (98%) rename src/flask_imp/security/{pass_function_check.py => _pass_function_check.py} (100%) rename src/flask_imp/security/{permission_check.py => _permission_check.py} (98%) rename src/flask_imp/security/{__private_funcs__.py => _private_funcs.py} (100%) diff --git a/src/flask_imp/__init__.py b/src/flask_imp/__init__.py index c45769f6..4ab84228 100644 --- a/src/flask_imp/__init__.py +++ b/src/flask_imp/__init__.py @@ -1,8 +1,8 @@ from .__version__ import __version__ from .auth import Auth as Auth from .auth import PasswordGeneration as PasswordGeneration -from .imp import Imp as Imp -from .imp_blueprint import ImpBlueprint +from ._imp import Imp as Imp +from ._imp_blueprint import ImpBlueprint __all__ = [ "__version__", diff --git a/src/flask_imp/exceptions.py b/src/flask_imp/_exceptions.py similarity index 100% rename from src/flask_imp/exceptions.py rename to src/flask_imp/_exceptions.py diff --git a/src/flask_imp/imp.py b/src/flask_imp/_imp.py similarity index 98% rename from src/flask_imp/imp.py rename to src/flask_imp/_imp.py index 3406eadb..96e2af71 100644 --- a/src/flask_imp/imp.py +++ b/src/flask_imp/_imp.py @@ -8,9 +8,9 @@ from flask_sqlalchemy.model import DefaultMeta from .config import ImpConfig -from .imp_blueprint import ImpBlueprint -from .registeries import ModelRegistry -from .utilities import cast_to_import_str, build_database_main, build_database_binds +from ._imp_blueprint import ImpBlueprint +from ._registries import ModelRegistry +from ._utilities import cast_to_import_str, build_database_main, build_database_binds class Imp: diff --git a/src/flask_imp/imp_blueprint.py b/src/flask_imp/_imp_blueprint.py similarity index 98% rename from src/flask_imp/imp_blueprint.py rename to src/flask_imp/_imp_blueprint.py index b5fb69e8..56deb788 100644 --- a/src/flask_imp/imp_blueprint.py +++ b/src/flask_imp/_imp_blueprint.py @@ -9,8 +9,8 @@ from .config import DatabaseConfig from .config import ImpBlueprintConfig -from .exceptions import NoConfigProvided -from .utilities import ( +from ._exceptions import NoConfigProvided +from ._utilities import ( cast_to_import_str, slug, _partial_models_import, diff --git a/src/flask_imp/protocols.py b/src/flask_imp/_protocols.py similarity index 100% rename from src/flask_imp/protocols.py rename to src/flask_imp/_protocols.py diff --git a/src/flask_imp/registeries.py b/src/flask_imp/_registries.py similarity index 100% rename from src/flask_imp/registeries.py rename to src/flask_imp/_registries.py diff --git a/src/flask_imp/utilities.py b/src/flask_imp/_utilities.py similarity index 99% rename from src/flask_imp/utilities.py rename to src/flask_imp/_utilities.py index 55c5e6be..67aab32c 100644 --- a/src/flask_imp/utilities.py +++ b/src/flask_imp/_utilities.py @@ -8,7 +8,7 @@ from flask import Flask from flask_imp.config import DatabaseConfig, SQLDatabaseConfig, SQLiteDatabaseConfig -from .protocols import Imp +from ._protocols import Imp class Sprinkles: diff --git a/src/flask_imp/auth/__init__.py b/src/flask_imp/auth/__init__.py index 4d88c295..013b66c1 100644 --- a/src/flask_imp/auth/__init__.py +++ b/src/flask_imp/auth/__init__.py @@ -1,16 +1,16 @@ -from .__legacy__ import Auth -from .authenticate_password import authenticate_password -from .dataclasses import PasswordGeneration -from .encrypt_password import encrypt_password -from .generate_alphanumeric_validator import generate_alphanumeric_validator -from .generate_csrf_token import generate_csrf_token -from .generate_email_validator import generate_email_validator -from .generate_numeric_validator import generate_numeric_validator -from .generate_password import generate_password -from .generate_private_key import generate_private_key -from .generate_salt import generate_salt -from .is_email_address_valid import is_email_address_valid -from .is_username_valid import is_username_valid +from ._legacy import Auth +from ._authenticate_password import authenticate_password +from ._dataclasses import PasswordGeneration +from ._encrypt_password import encrypt_password +from ._generate_alphanumeric_validator import generate_alphanumeric_validator +from ._generate_csrf_token import generate_csrf_token +from ._generate_email_validator import generate_email_validator +from ._generate_numeric_validator import generate_numeric_validator +from ._generate_password import generate_password +from ._generate_private_key import generate_private_key +from ._generate_salt import generate_salt +from ._is_email_address_valid import is_email_address_valid +from ._is_username_valid import is_username_valid __all__ = [ "PasswordGeneration", diff --git a/src/flask_imp/auth/authenticate_password.py b/src/flask_imp/auth/_authenticate_password.py similarity index 98% rename from src/flask_imp/auth/authenticate_password.py rename to src/flask_imp/auth/_authenticate_password.py index 732723af..688a83a3 100644 --- a/src/flask_imp/auth/authenticate_password.py +++ b/src/flask_imp/auth/_authenticate_password.py @@ -5,7 +5,7 @@ from more_itertools import batched -from .__private_funcs__ import _guess_block +from ._private_funcs import _guess_block def authenticate_password( diff --git a/src/flask_imp/auth/dataclasses.py b/src/flask_imp/auth/_dataclasses.py similarity index 100% rename from src/flask_imp/auth/dataclasses.py rename to src/flask_imp/auth/_dataclasses.py diff --git a/src/flask_imp/auth/encrypt_password.py b/src/flask_imp/auth/_encrypt_password.py similarity index 97% rename from src/flask_imp/auth/encrypt_password.py rename to src/flask_imp/auth/_encrypt_password.py index 3b05b8aa..9becf312 100644 --- a/src/flask_imp/auth/encrypt_password.py +++ b/src/flask_imp/auth/_encrypt_password.py @@ -3,7 +3,7 @@ from random import choice from string import ascii_letters -from .__private_funcs__ import _pps, _ppe +from ._private_funcs import _pps, _ppe def encrypt_password( diff --git a/src/flask_imp/auth/generate_alphanumeric_validator.py b/src/flask_imp/auth/_generate_alphanumeric_validator.py similarity index 100% rename from src/flask_imp/auth/generate_alphanumeric_validator.py rename to src/flask_imp/auth/_generate_alphanumeric_validator.py diff --git a/src/flask_imp/auth/generate_csrf_token.py b/src/flask_imp/auth/_generate_csrf_token.py similarity index 100% rename from src/flask_imp/auth/generate_csrf_token.py rename to src/flask_imp/auth/_generate_csrf_token.py diff --git a/src/flask_imp/auth/generate_email_validator.py b/src/flask_imp/auth/_generate_email_validator.py similarity index 85% rename from src/flask_imp/auth/generate_email_validator.py rename to src/flask_imp/auth/_generate_email_validator.py index 11be048c..0ed34522 100644 --- a/src/flask_imp/auth/generate_email_validator.py +++ b/src/flask_imp/auth/_generate_email_validator.py @@ -1,4 +1,4 @@ -from .generate_alphanumeric_validator import generate_alphanumeric_validator +from ._generate_alphanumeric_validator import generate_alphanumeric_validator def generate_email_validator() -> str: diff --git a/src/flask_imp/auth/generate_numeric_validator.py b/src/flask_imp/auth/_generate_numeric_validator.py similarity index 100% rename from src/flask_imp/auth/generate_numeric_validator.py rename to src/flask_imp/auth/_generate_numeric_validator.py diff --git a/src/flask_imp/auth/generate_password.py b/src/flask_imp/auth/_generate_password.py similarity index 92% rename from src/flask_imp/auth/generate_password.py rename to src/flask_imp/auth/_generate_password.py index 50827636..f0b2b8fa 100644 --- a/src/flask_imp/auth/generate_password.py +++ b/src/flask_imp/auth/_generate_password.py @@ -1,7 +1,7 @@ from random import choice -from .dataclasses import PasswordGeneration -from .generate_numeric_validator import generate_numeric_validator +from ._dataclasses import PasswordGeneration +from ._generate_numeric_validator import generate_numeric_validator def generate_password(style: str = "mixed", length: int = 3) -> str: diff --git a/src/flask_imp/auth/generate_private_key.py b/src/flask_imp/auth/_generate_private_key.py similarity index 100% rename from src/flask_imp/auth/generate_private_key.py rename to src/flask_imp/auth/_generate_private_key.py diff --git a/src/flask_imp/auth/generate_salt.py b/src/flask_imp/auth/_generate_salt.py similarity index 100% rename from src/flask_imp/auth/generate_salt.py rename to src/flask_imp/auth/_generate_salt.py diff --git a/src/flask_imp/auth/is_email_address_valid.py b/src/flask_imp/auth/_is_email_address_valid.py similarity index 100% rename from src/flask_imp/auth/is_email_address_valid.py rename to src/flask_imp/auth/_is_email_address_valid.py diff --git a/src/flask_imp/auth/is_username_valid.py b/src/flask_imp/auth/_is_username_valid.py similarity index 100% rename from src/flask_imp/auth/is_username_valid.py rename to src/flask_imp/auth/_is_username_valid.py diff --git a/src/flask_imp/auth/__legacy__.py b/src/flask_imp/auth/_legacy.py similarity index 90% rename from src/flask_imp/auth/__legacy__.py rename to src/flask_imp/auth/_legacy.py index fd1d0342..4e2131d4 100644 --- a/src/flask_imp/auth/__legacy__.py +++ b/src/flask_imp/auth/_legacy.py @@ -2,17 +2,17 @@ from random import choice from string import ascii_letters -from .authenticate_password import authenticate_password -from .encrypt_password import encrypt_password -from .generate_alphanumeric_validator import generate_alphanumeric_validator -from .generate_csrf_token import generate_csrf_token -from .generate_email_validator import generate_email_validator -from .generate_numeric_validator import generate_numeric_validator -from .generate_password import generate_password -from .generate_private_key import generate_private_key -from .generate_salt import generate_salt -from .is_email_address_valid import is_email_address_valid -from .is_username_valid import is_username_valid +from ._authenticate_password import authenticate_password +from ._encrypt_password import encrypt_password +from ._generate_alphanumeric_validator import generate_alphanumeric_validator +from ._generate_csrf_token import generate_csrf_token +from ._generate_email_validator import generate_email_validator +from ._generate_numeric_validator import generate_numeric_validator +from ._generate_password import generate_password +from ._generate_private_key import generate_private_key +from ._generate_salt import generate_salt +from ._is_email_address_valid import is_email_address_valid +from ._is_username_valid import is_username_valid def auth_password( diff --git a/src/flask_imp/auth/__private_funcs__.py b/src/flask_imp/auth/_private_funcs.py similarity index 100% rename from src/flask_imp/auth/__private_funcs__.py rename to src/flask_imp/auth/_private_funcs.py diff --git a/src/flask_imp/config/__init__.py b/src/flask_imp/config/__init__.py index 093726b1..7bdb3cd6 100644 --- a/src/flask_imp/config/__init__.py +++ b/src/flask_imp/config/__init__.py @@ -1,9 +1,9 @@ -from .database_config import DatabaseConfig -from .sql_database_config import SQLDatabaseConfig -from .sqlite_database_config import SQLiteDatabaseConfig -from .flask_config import FlaskConfig -from .imp_blueprint_config import ImpBlueprintConfig -from .imp_config import ImpConfig +from ._database_config import DatabaseConfig +from ._sql_database_config import SQLDatabaseConfig +from ._sqlite_database_config import SQLiteDatabaseConfig +from ._flask_config import FlaskConfig +from ._imp_blueprint_config import ImpBlueprintConfig +from ._imp_config import ImpConfig __all__ = [ "FlaskConfig", diff --git a/src/flask_imp/config/database_config.py b/src/flask_imp/config/_database_config.py similarity index 100% rename from src/flask_imp/config/database_config.py rename to src/flask_imp/config/_database_config.py diff --git a/src/flask_imp/config/flask_config.py b/src/flask_imp/config/_flask_config.py similarity index 100% rename from src/flask_imp/config/flask_config.py rename to src/flask_imp/config/_flask_config.py diff --git a/src/flask_imp/config/imp_blueprint_config.py b/src/flask_imp/config/_imp_blueprint_config.py similarity index 97% rename from src/flask_imp/config/imp_blueprint_config.py rename to src/flask_imp/config/_imp_blueprint_config.py index 61592b60..e0c0b50e 100644 --- a/src/flask_imp/config/imp_blueprint_config.py +++ b/src/flask_imp/config/_imp_blueprint_config.py @@ -4,7 +4,7 @@ @dataclass class ImpBlueprintConfig: - from .database_config import DatabaseConfig + from ._database_config import DatabaseConfig enabled: t.Optional[bool] = None url_prefix: t.Optional[str] = None diff --git a/src/flask_imp/config/imp_config.py b/src/flask_imp/config/_imp_config.py similarity index 100% rename from src/flask_imp/config/imp_config.py rename to src/flask_imp/config/_imp_config.py diff --git a/src/flask_imp/config/sql_database_config.py b/src/flask_imp/config/_sql_database_config.py similarity index 100% rename from src/flask_imp/config/sql_database_config.py rename to src/flask_imp/config/_sql_database_config.py diff --git a/src/flask_imp/config/sqlite_database_config.py b/src/flask_imp/config/_sqlite_database_config.py similarity index 100% rename from src/flask_imp/config/sqlite_database_config.py rename to src/flask_imp/config/_sqlite_database_config.py diff --git a/src/flask_imp/security/__init__.py b/src/flask_imp/security/__init__.py index 1aa28ef0..1217dad4 100644 --- a/src/flask_imp/security/__init__.py +++ b/src/flask_imp/security/__init__.py @@ -1,8 +1,8 @@ -from .api_login_check import api_login_check -from .include_csrf import include_csrf -from .login_check import login_check -from .pass_function_check import pass_function_check -from .permission_check import permission_check +from ._api_login_check import api_login_check +from ._include_csrf import include_csrf +from ._login_check import login_check +from ._pass_function_check import pass_function_check +from ._permission_check import permission_check __all__ = [ "api_login_check", diff --git a/src/flask_imp/security/api_login_check.py b/src/flask_imp/security/_api_login_check.py similarity index 96% rename from src/flask_imp/security/api_login_check.py rename to src/flask_imp/security/_api_login_check.py index b5bcc39f..8b8bd382 100644 --- a/src/flask_imp/security/api_login_check.py +++ b/src/flask_imp/security/_api_login_check.py @@ -3,7 +3,7 @@ from flask import session -from .__private_funcs__ import _check_against_values_allowed +from ._private_funcs import _check_against_values_allowed def api_login_check( diff --git a/src/flask_imp/security/include_csrf.py b/src/flask_imp/security/_include_csrf.py similarity index 100% rename from src/flask_imp/security/include_csrf.py rename to src/flask_imp/security/_include_csrf.py diff --git a/src/flask_imp/security/login_check.py b/src/flask_imp/security/_login_check.py similarity index 98% rename from src/flask_imp/security/login_check.py rename to src/flask_imp/security/_login_check.py index 78ba5f34..acc87c13 100644 --- a/src/flask_imp/security/login_check.py +++ b/src/flask_imp/security/_login_check.py @@ -8,7 +8,7 @@ from flask import session from flask import url_for -from .__private_funcs__ import _check_against_values_allowed +from ._private_funcs import _check_against_values_allowed def login_check( diff --git a/src/flask_imp/security/pass_function_check.py b/src/flask_imp/security/_pass_function_check.py similarity index 100% rename from src/flask_imp/security/pass_function_check.py rename to src/flask_imp/security/_pass_function_check.py diff --git a/src/flask_imp/security/permission_check.py b/src/flask_imp/security/_permission_check.py similarity index 98% rename from src/flask_imp/security/permission_check.py rename to src/flask_imp/security/_permission_check.py index 41b8af41..958c2b95 100644 --- a/src/flask_imp/security/permission_check.py +++ b/src/flask_imp/security/_permission_check.py @@ -8,7 +8,7 @@ from flask import session from flask import url_for -from .__private_funcs__ import _check_against_values_allowed +from ._private_funcs import _check_against_values_allowed def permission_check( diff --git a/src/flask_imp/security/__private_funcs__.py b/src/flask_imp/security/_private_funcs.py similarity index 100% rename from src/flask_imp/security/__private_funcs__.py rename to src/flask_imp/security/_private_funcs.py