python-plugins 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_plugins-0.1.1 → python_plugins-0.1.2}/CHANGES.rst +7 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/PKG-INFO +3 -1
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/conf.py +2 -3
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/usage.rst +16 -1
- {python_plugins-0.1.1 → python_plugins-0.1.2}/pyproject.toml +1 -0
- python_plugins-0.1.2/src/python_plugins/__about__.py +1 -0
- python_plugins-0.1.2/src/python_plugins/models/__init__.py +0 -0
- python_plugins-0.1.2/src/python_plugins/models/mixins/__init__.py +4 -0
- python_plugins-0.1.2/src/python_plugins/models/mixins/data_mixin.py +15 -0
- python_plugins-0.1.2/src/python_plugins/models/mixins/primary_key_mixin.py +6 -0
- python_plugins-0.1.2/src/python_plugins/models/mixins/timestamp_mixin.py +20 -0
- python_plugins-0.1.2/src/python_plugins/models/mixins/user_minxin.py +26 -0
- python_plugins-0.1.1/src/python_plugins/__about__.py +0 -1
- {python_plugins-0.1.1 → python_plugins-0.1.2}/.github/workflows/release.yml +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/.gitignore +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/.readthedocs.yaml +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/LICENSE.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/README.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/Makefile +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/api.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/changes.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/examples.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/index.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/make.bat +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/docs/requirements.txt +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/examples/README.rst +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/requirements/build.in +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/requirements/test.in +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/src/python_plugins/__init__.py +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/src/python_plugins/email/__init__.py +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/src/python_plugins/email/smtp.py +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/tests/__init__.py +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/tests/conftest.py +0 -0
- {python_plugins-0.1.1 → python_plugins-0.1.2}/tests/test_email.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: python-plugins
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A collection of Python functions and classes.
|
|
5
5
|
Project-URL: Documentation, https://python-plugins.readthedocs.io
|
|
6
6
|
Project-URL: Source, https://github.com/ojso/python-plugins
|
|
@@ -44,6 +44,8 @@ Provides-Extra: pillow
|
|
|
44
44
|
Requires-Dist: pillow; extra == 'pillow'
|
|
45
45
|
Provides-Extra: qrcode
|
|
46
46
|
Requires-Dist: qrcode; extra == 'qrcode'
|
|
47
|
+
Provides-Extra: sqlalchemy
|
|
48
|
+
Requires-Dist: sqlalchemy; extra == 'sqlalchemy'
|
|
47
49
|
Description-Content-Type: text/x-rst
|
|
48
50
|
|
|
49
51
|
python-plugins
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
8
|
|
|
9
9
|
project = 'python-plugins'
|
|
10
|
-
copyright = '2024,
|
|
11
|
-
author = '
|
|
10
|
+
copyright = '2024, David Hua'
|
|
11
|
+
author = 'David Hua'
|
|
12
12
|
|
|
13
13
|
# -- General configuration ---------------------------------------------------
|
|
14
14
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
@@ -27,5 +27,4 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
|
27
27
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
28
28
|
|
|
29
29
|
html_theme = 'classic'
|
|
30
|
-
html_static_path = ['_static']
|
|
31
30
|
html_title = "python-plugins Documentation"
|
|
@@ -34,4 +34,19 @@ email
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
s = SmtpSSL(host, port, user, password)
|
|
37
|
-
r = s.send_emsg(data)
|
|
37
|
+
r = s.send_emsg(data)
|
|
38
|
+
|
|
39
|
+
mixins
|
|
40
|
+
======
|
|
41
|
+
|
|
42
|
+
.. code-block:: python
|
|
43
|
+
|
|
44
|
+
from flask_sqlalchemy import SQLAlchemy
|
|
45
|
+
from python_plugins.models.mixins import PrimaryKeyMixin
|
|
46
|
+
from python_plugins.models.mixins import UserMixin
|
|
47
|
+
from python_plugins.models.mixins import TimestampMixin
|
|
48
|
+
|
|
49
|
+
db = SQLAlchemy()
|
|
50
|
+
|
|
51
|
+
class User(PrimaryKeyMixin,UserMixin, TimestampMixin,db.models):
|
|
52
|
+
pass
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.2"
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from sqlalchemy.orm import mapped_column
|
|
2
|
+
from sqlalchemy.types import JSON
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DataMixin:
|
|
6
|
+
data = mapped_column(type_=JSON)
|
|
7
|
+
|
|
8
|
+
def update_data(self, data: dict):
|
|
9
|
+
if self.data is None:
|
|
10
|
+
new_data = {}
|
|
11
|
+
else:
|
|
12
|
+
new_data = dict(self.data)
|
|
13
|
+
for k in data:
|
|
14
|
+
new_data[k] = data[k]
|
|
15
|
+
self.data = new_data
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from sqlalchemy.orm import Mapped
|
|
3
|
+
from sqlalchemy.orm import mapped_column
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TimestampMixin:
|
|
7
|
+
created_at: Mapped[datetime] = mapped_column(default=datetime.now)
|
|
8
|
+
updated_at: Mapped[datetime] = mapped_column(
|
|
9
|
+
default=datetime.now, onupdate=datetime.now
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CreateTimestampMixin:
|
|
14
|
+
created_at: Mapped[datetime] = mapped_column(default=datetime.now)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class UpdateTimestampMixin:
|
|
18
|
+
updated_at: Mapped[datetime] = mapped_column(
|
|
19
|
+
default=datetime.now, onupdate=datetime.now
|
|
20
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class UserMixin:
|
|
2
|
+
@property
|
|
3
|
+
def is_active(self):
|
|
4
|
+
return self.isactive
|
|
5
|
+
|
|
6
|
+
@property
|
|
7
|
+
def is_authenticated(self):
|
|
8
|
+
return True
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def is_anonymous(self):
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
def get_id(self):
|
|
15
|
+
return self.id
|
|
16
|
+
|
|
17
|
+
def __eq__(self, other):
|
|
18
|
+
if isinstance(other, self.__class__):
|
|
19
|
+
return self.get_id() == other.get_id()
|
|
20
|
+
return NotImplemented
|
|
21
|
+
|
|
22
|
+
def __ne__(self, other):
|
|
23
|
+
equal = self.__eq__(other)
|
|
24
|
+
if equal is NotImplemented:
|
|
25
|
+
return NotImplemented
|
|
26
|
+
return not equal
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|