python-plugins 0.1.9__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
@@ -1 +1 @@
1
- __version__ = "0.1.9"
1
+ __version__ = "0.2.0"
@@ -1 +1 @@
1
- from .utils.remove_pycache import remove_pycache
1
+
@@ -1,2 +1,3 @@
1
1
  from .datetime_str import datetime2str, str2datetime
2
2
  from .xml import xml2dict
3
+ from .pretty import prettify_class_name
@@ -1,10 +1,13 @@
1
1
  import base64
2
2
  import os
3
3
  import random
4
+ import string
4
5
  from cryptography.fernet import Fernet
5
6
  from cryptography.hazmat.primitives import hashes
6
7
  from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
7
- from ..random import rand_letter
8
+
9
+ def rand_letter(n: int):
10
+ return "".join(random.choices(string.ascii_letters + string.digits, k=n))
8
11
 
9
12
 
10
13
  def bytes_to_url64str(bstr: bytes):
@@ -1,2 +0,0 @@
1
- from .fields import *
2
- from .widgets import *
@@ -1,10 +1,10 @@
1
1
  import time
2
2
  import datetime
3
- from wtforms import fields as wtforms_fields
3
+ import wtforms.fields
4
4
  from ..widgets.datetime import DateTimePickerWidget
5
5
  from ..widgets.datetime import TimePickerWidget
6
6
 
7
- class DateTimeField(wtforms_fields.DateTimeField):
7
+ class DateTimeField(wtforms.fields.DateTimeField):
8
8
  """
9
9
  Allows modifying the datetime format of a DateTimeField using form_args.
10
10
  """
@@ -28,7 +28,7 @@ class DateTimeField(wtforms_fields.DateTimeField):
28
28
  )
29
29
 
30
30
 
31
- class TimeField(wtforms_fields.Field):
31
+ class TimeField(wtforms.fields.Field):
32
32
  """
33
33
  A text field which stores a `datetime.time` object.
34
34
  Accepts time string in multiple formats: 20:10, 20:10:00, 10:00 am, 9:30pm, etc.
@@ -59,7 +59,7 @@ class TimeField(wtforms_fields.Field):
59
59
  :param kwargs:
60
60
  Any additional parameters
61
61
  """
62
- super(TimeField, self).__init__(label, validators, **kwargs)
62
+ super().__init__(label, validators, **kwargs)
63
63
 
64
64
  self.formats = formats or (
65
65
  "%H:%M:%S",
@@ -1,10 +1,10 @@
1
1
  import re
2
- from wtforms import fields as wtforms_fields
2
+ import wtforms.fields
3
3
  from ..widgets.select import Select2Widget
4
4
  from ..widgets.select import Select2TagsWidget
5
5
 
6
6
 
7
- class Select2Field(wtforms_fields.SelectField):
7
+ class Select2Field(wtforms.fields.SelectField):
8
8
  """
9
9
  `Select2 <https://github.com/ivaynberg/select2>`_ styled select widget.
10
10
 
@@ -68,7 +68,7 @@ class Select2Field(wtforms_fields.SelectField):
68
68
  super(Select2Field, self).pre_validate(form)
69
69
 
70
70
 
71
- class Select2TagsField(wtforms_fields.StringField):
71
+ class Select2TagsField(wtforms.fields.StringField):
72
72
  """`Select2 <http://ivaynberg.github.com/select2/#tags>`_ styled text field.
73
73
  You must include select2.js, form-x.x.x.js and select2 stylesheet for it to work.
74
74
  """
File without changes
@@ -0,0 +1,29 @@
1
+ from wtforms import StringField
2
+ from wtforms import PasswordField
3
+ from wtforms import BooleanField
4
+ from wtforms import SubmitField
5
+ from wtforms.validators import ValidationError
6
+ from wtforms.validators import DataRequired
7
+ from wtforms.validators import EqualTo
8
+ from wtforms.validators import Length
9
+
10
+
11
+ class LoginForm:
12
+ username = StringField("Username", validators=[DataRequired()])
13
+ password = PasswordField("Password", validators=[DataRequired()])
14
+ remember_me = BooleanField("Remember Me")
15
+ submit = SubmitField("login")
16
+
17
+
18
+ class RegisterForm:
19
+ username = StringField(
20
+ "Username", validators=[DataRequired(), Length(min=6, max=50)]
21
+ )
22
+ email = StringField("Email", validators=[DataRequired()])
23
+ password = PasswordField(
24
+ "Password", validators=[DataRequired(), Length(min=8, max=50)]
25
+ )
26
+ password_repeat = PasswordField(
27
+ "Repeat Password", validators=[DataRequired(), EqualTo("password")]
28
+ )
29
+ submit = SubmitField("Register")
python_plugins/jwt/jwt.py CHANGED
@@ -26,12 +26,3 @@ def jwt_decode(encoded, key: str, algorithm="HS256"):
26
26
 
27
27
  payload = jwt.decode(encoded, key, algorithm)
28
28
  return payload
29
-
30
-
31
- # try:
32
- # ...
33
- # except Exception as e:
34
- # # import sys
35
- # # print(sys.exc_info())
36
- # # return None,str(e)
37
- # return None
@@ -1,7 +1,10 @@
1
1
  from typing import Optional
2
2
  from sqlalchemy.orm import Mapped
3
3
  from sqlalchemy.orm import mapped_column
4
- from ...random.random_str import secret_token
4
+ import secrets
5
+
6
+ def secret_token():
7
+ return secrets.token_hex(32)
5
8
 
6
9
 
7
10
  class TokenMixin:
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-plugins
3
- Version: 0.1.9
3
+ Version: 0.2.0
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
7
7
  Project-URL: Homepage, https://github.com/ojso/python-plugins
8
- Author-email: huadong <david.dong.hua@gmail.com>
8
+ Author-email: David Hua <david.dong.hua@gmail.com>
9
9
  License: MIT License
10
10
 
11
- Copyright (c) 2024-present huadong <david.dong.hua@gmail.com>
11
+ Copyright (c) 2024-present DavidDongHua <david.dong.hua@gmail.com>
12
12
 
13
13
  Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  of this software and associated documentation files (the "Software"), to deal
@@ -1,25 +1,27 @@
1
- python_plugins/__about__.py,sha256=XIaxbMbyiP-L3kguR1GhxirFblTXiHR1lMfDVITvHUI,22
2
- python_plugins/__init__.py,sha256=K3pMvS_BsKnB8yLH5siB1hmFkC2tq3e8rzZXO4CFPmk,49
3
- python_plugins/convert/__init__.py,sha256=UwzPhcQLaHEvcssbrcCymWujBV_BOmfYCIJxGPyJdbY,79
1
+ python_plugins/__about__.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,22
2
+ python_plugins/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ python_plugins/convert/__init__.py,sha256=mQeBTbhjuTJkyG4DhXkoX9CNP1TDEgPBFIJ2TQNl2NM,119
4
4
  python_plugins/convert/datetime_str.py,sha256=bmC9d1W7XKA1ED9XO9reUiUyfQcM_BqGoGyOF21RW9A,282
5
5
  python_plugins/convert/pretty.py,sha256=igN4uq67AADcPOiy_h3_M-oEwgc1i3gJScbKtkf6d-k,211
6
6
  python_plugins/convert/xml.py,sha256=RUxqDt6NKzwbuodTxKVoiR4dP-vNbmL77dztLx_9UzY,164
7
7
  python_plugins/crypto/__init__.py,sha256=2Snt9AIwVsQ-qLNno8qGWs8IyL-AvTImvqkRFO8nowQ,131
8
8
  python_plugins/crypto/fernet.py,sha256=UgEAHJGBtmH9AacD-IOyr9dR8T5PKTWL8kH5yj2wKqI,1191
9
9
  python_plugins/crypto/file_to_file.py,sha256=mS9llG3j0emhCB4NY6IlKew6wpoLyVW-008ZXN1v3iw,1764
10
- python_plugins/crypto/str_to_list.py,sha256=NRujzl_ZD7AIBPqjC0_BVFWR5qHZJe66WSTVcF2grX0,2429
10
+ python_plugins/crypto/str_to_list.py,sha256=T2I4p6bcZuiCsEve4XsOb1q9hFxeVPITstjPyTVoATE,2514
11
11
  python_plugins/dumps/__init__.py,sha256=TLPuPLIAuULFkiIbFfTCsuhH0CQhPRMUjBmcsr0mtqA,83
12
12
  python_plugins/dumps/postgresql_dump.py,sha256=zN5aLYLxpon2y9_5gKizRjlrRUlkAO-dG-BuKpJ4F3U,1030
13
13
  python_plugins/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  python_plugins/email/smtp.py,sha256=weSfLVPzROFqwlxDaVhjem522NVEp31lc6PFkbZE1ok,854
15
15
  python_plugins/examples/higher_order_functions.py,sha256=cBewE3cDkzaNHR6CQzdfWny0r_V4PgcUeZpHEdCp-E0,633
16
- python_plugins/forms/__init__.py,sha256=5e0-iDMXwimgEQTUNRLyUNOOLhjDopoL4FQnB18uHSE,45
16
+ python_plugins/forms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  python_plugins/forms/fields/__init__.py,sha256=2g00xLZZhjORFECO8oG9tZeTL2HiGozA-d42Udv0LuU,64
18
- python_plugins/forms/fields/datetime.py,sha256=x8GbFg4Va79kWRpl6Rh9VUeGqtA7JromWqcths0xV-k,2817
18
+ python_plugins/forms/fields/datetime.py,sha256=WXiX4STSN97R3hIPxJUftCRFvrUYCN66qi0GIWs6qRI,2779
19
19
  python_plugins/forms/fields/json.py,sha256=UzkZxzEZFqd2ONPfj0ZphbQoEAjY2ZS1cMioGuHpivQ,546
20
- python_plugins/forms/fields/select.py,sha256=jKOgvAuZF8EhOX56vSBQffcGwGutuF-hS_9K9auNnfs,3878
20
+ python_plugins/forms/fields/select.py,sha256=I0_b-Z31LF0_CTXIcPSopMLdM-0fH_QTP83DzBMXREw,3855
21
21
  python_plugins/forms/fields/switch.py,sha256=3JmbKm9-nEoBcCPqvgjsWZ14xUTznoFbIDh2RomPh1A,257
22
22
  python_plugins/forms/fields/taglist.py,sha256=z_miMSyrzjYOD6y1Xs22qPVXZpF5yGOTXpBLLzycdZs,298
23
+ python_plugins/forms/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ python_plugins/forms/mixins/user.py,sha256=KSTABFHcWyFgqfUENDXHJuU72nu6gEoKzzif_qFbFCM,988
23
25
  python_plugins/forms/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
26
  python_plugins/forms/widgets/datetime.py,sha256=5nE-1OhtNdqwIaHts_0yNkA5HbsfEiH_zGRSwL6YlaI,925
25
27
  python_plugins/forms/widgets/file.py,sha256=P2wcN7W8ju12x4UMax5sCc58f23hSIfB-9pmzNQS4Iw,108
@@ -27,14 +29,14 @@ python_plugins/forms/widgets/select.py,sha256=ITmmXWe72YokxN7MyxpcURV2PnoEkTI8-f
27
29
  python_plugins/hashes/__init__.py,sha256=PQbx8f4klFMg5Q8kehSHz1itj_djWV5hkBT4AMNNUn0,39
28
30
  python_plugins/hashes/hash.py,sha256=uSF3ohZRD7b2VAIvjjpTWC0SlY7QsFhsFZUejINrRGU,640
29
31
  python_plugins/jwt/__init__.py,sha256=GS27VK4uk1FXsmju5xpHu0p4FNSwW-tkeJ3hCSaW1rY,40
30
- python_plugins/jwt/jwt.py,sha256=g1wfg6euVUbaF5CvAWvu29U_KQKd1u2RvfAdkcOJbNA,908
32
+ python_plugins/jwt/jwt.py,sha256=yIpz-jwnRjYZwWtzqGLey9DyVnCL2Sx2RS9vgQJXTTk,742
31
33
  python_plugins/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
34
  python_plugins/models/update.py,sha256=cIwhR0iKkB7cVx7km_oA9ya97MSkJlLPb8pZWaEePmE,991
33
35
  python_plugins/models/mixins/__init__.py,sha256=l4dJVgUFI7aISA7X-CcVBOp19rXBgqyyhHwtuQnSgR0,241
34
36
  python_plugins/models/mixins/data_mixin.py,sha256=HCc1uvF6_O4yjK38uWAsqysEedLWgc7wtds3NjQTMZ8,366
35
37
  python_plugins/models/mixins/primary_key_mixin.py,sha256=QUO-7ZmYtAMMi7ReRQDYV0uwQCnU9dvl6g6GHitYtlA,154
36
38
  python_plugins/models/mixins/timestamp_mixin.py,sha256=u9rIu0IrzdCRRbnMk4IN4nTlNNiVPB8yPnTcHjQC1KU,547
37
- python_plugins/models/mixins/token_minxin.py,sha256=CpPeegw_ER7Msz442pZe7_5BQ5zyyiHdgkTWmqcCn9U,253
39
+ python_plugins/models/mixins/token_minxin.py,sha256=SxNftZXS-hCwqxov7whF_tBtlayuoi3LUPtu-ofMmdg,276
38
40
  python_plugins/models/mixins/user_minxin.py,sha256=D-N45bunicBuuwKs--s_tyDxxLC3mkxV9Tva8JAhsko,579
39
41
  python_plugins/process/__init__.py,sha256=1rNYaujG3SI6Pgt2er-txyXd5XdQEZRXkRxrTdodD0I,90
40
42
  python_plugins/process/python_venv_process.py,sha256=yRgaKfPQ-TC_Kn2tuDqoTJZ__216BC-8LijymolUMaI,490
@@ -49,7 +51,7 @@ python_plugins/weixin/format_response.py,sha256=Eml9R1jYYOCtfXORyEWfHbCL8gauWeg2
49
51
  python_plugins/weixin/wechat.py,sha256=D6KHZSNj_19vCs5rxLSrHt5XkjkM4ZoD2z6VWD0a_b4,4296
50
52
  python_plugins/weixin/wechat_crypt.py,sha256=YOCy4F5ycfZFOJYtKSzhiFSfNb_MsQnN2Qy9u_FfZSU,4717
51
53
  python_plugins/weixin/weixin_api.py,sha256=xtnWBovJKNMdm-jXmIM7QHnMye-fZN4a4U_efejRarE,3286
52
- python_plugins-0.1.9.dist-info/METADATA,sha256=3fwE_Cw8ysg3wWmUQW5dDTkKOiR97j1s9Q_e_oIuDWA,2922
53
- python_plugins-0.1.9.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
54
- python_plugins-0.1.9.dist-info/licenses/LICENSE.rst,sha256=d9ee1DxacJqITSYaORZy85rWGNZyZbDNv_r-lY2RQ9s,1099
55
- python_plugins-0.1.9.dist-info/RECORD,,
54
+ python_plugins-0.2.0.dist-info/METADATA,sha256=DoRticFoAGWJtjExNEXLriv9xHT09T-g1uopY_ajyvc,2929
55
+ python_plugins-0.2.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
56
+ python_plugins-0.2.0.dist-info/licenses/LICENSE.rst,sha256=X5eLIsAn1yAKd88LWTYkXUe0PmVK_Z5SD7_5NheGR-s,1104
57
+ python_plugins-0.2.0.dist-info/RECORD,,
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024-present huadong <david.dong.hua@gmail.com>
3
+ Copyright (c) 2024-present DavidDongHua <david.dong.hua@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal