python-plugins 0.1.9__tar.gz → 0.2.1__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.
Files changed (91) hide show
  1. {python_plugins-0.1.9 → python_plugins-0.2.1}/CHANGES.rst +15 -0
  2. {python_plugins-0.1.9 → python_plugins-0.2.1}/LICENSE.rst +1 -1
  3. {python_plugins-0.1.9 → python_plugins-0.2.1}/PKG-INFO +3 -3
  4. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/index.rst +0 -2
  5. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/usage.rst +30 -5
  6. {python_plugins-0.1.9 → python_plugins-0.2.1}/pyproject.toml +1 -1
  7. {python_plugins-0.1.9 → python_plugins-0.2.1}/requirements/test.in +2 -1
  8. python_plugins-0.2.1/src/python_plugins/__about__.py +1 -0
  9. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/convert/__init__.py +1 -0
  10. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/crypto/str_to_list.py +4 -1
  11. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/fields/datetime.py +4 -4
  12. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/fields/select.py +3 -3
  13. python_plugins-0.2.1/src/python_plugins/forms/mixins/user.py +29 -0
  14. python_plugins-0.2.1/src/python_plugins/forms/widgets/__init__.py +0 -0
  15. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/jwt/jwt.py +0 -9
  16. python_plugins-0.2.1/src/python_plugins/models/__init__.py +0 -0
  17. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/mixins/token_minxin.py +4 -1
  18. python_plugins-0.2.1/src/python_plugins/utils/__init__.py +4 -0
  19. python_plugins-0.2.1/src/python_plugins/utils/walk_remove_dir.py +19 -0
  20. python_plugins-0.2.1/tests/__init__.py +1 -0
  21. python_plugins-0.2.1/tests/test_forms.py +65 -0
  22. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_utils.py +1 -0
  23. python_plugins-0.1.9/docs/api.rst +0 -4
  24. python_plugins-0.1.9/docs/examples.rst +0 -1
  25. python_plugins-0.1.9/examples/README.rst +0 -17
  26. python_plugins-0.1.9/src/python_plugins/__about__.py +0 -1
  27. python_plugins-0.1.9/src/python_plugins/__init__.py +0 -1
  28. python_plugins-0.1.9/src/python_plugins/forms/__init__.py +0 -2
  29. python_plugins-0.1.9/src/python_plugins/utils/__init__.py +0 -1
  30. python_plugins-0.1.9/src/python_plugins/utils/remove_pycache.py +0 -13
  31. python_plugins-0.1.9/tests/test_forms.py +0 -19
  32. {python_plugins-0.1.9 → python_plugins-0.2.1}/.github/workflows/release.yml +0 -0
  33. {python_plugins-0.1.9 → python_plugins-0.2.1}/.gitignore +0 -0
  34. {python_plugins-0.1.9 → python_plugins-0.2.1}/.readthedocs.yaml +0 -0
  35. {python_plugins-0.1.9 → python_plugins-0.2.1}/README.rst +0 -0
  36. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/Makefile +0 -0
  37. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/changes.rst +0 -0
  38. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/conf.py +0 -0
  39. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/make.bat +0 -0
  40. {python_plugins-0.1.9 → python_plugins-0.2.1}/docs/requirements.txt +0 -0
  41. {python_plugins-0.1.9 → python_plugins-0.2.1}/requirements/build.in +0 -0
  42. {python_plugins-0.1.9/tests → python_plugins-0.2.1/src/python_plugins}/__init__.py +0 -0
  43. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/convert/datetime_str.py +0 -0
  44. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/convert/pretty.py +0 -0
  45. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/convert/xml.py +0 -0
  46. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/crypto/__init__.py +0 -0
  47. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/crypto/fernet.py +0 -0
  48. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/crypto/file_to_file.py +0 -0
  49. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/dumps/__init__.py +0 -0
  50. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/dumps/postgresql_dump.py +0 -0
  51. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/email/__init__.py +0 -0
  52. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/email/smtp.py +0 -0
  53. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/examples/higher_order_functions.py +0 -0
  54. {python_plugins-0.1.9/src/python_plugins/forms/widgets → python_plugins-0.2.1/src/python_plugins/forms}/__init__.py +0 -0
  55. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/fields/__init__.py +0 -0
  56. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/fields/json.py +0 -0
  57. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/fields/switch.py +0 -0
  58. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/fields/taglist.py +0 -0
  59. {python_plugins-0.1.9/src/python_plugins/models → python_plugins-0.2.1/src/python_plugins/forms/mixins}/__init__.py +0 -0
  60. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/widgets/datetime.py +0 -0
  61. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/widgets/file.py +0 -0
  62. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/forms/widgets/select.py +0 -0
  63. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/hashes/__init__.py +0 -0
  64. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/hashes/hash.py +0 -0
  65. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/jwt/__init__.py +0 -0
  66. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/mixins/__init__.py +0 -0
  67. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/mixins/data_mixin.py +0 -0
  68. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/mixins/primary_key_mixin.py +0 -0
  69. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/mixins/timestamp_mixin.py +0 -0
  70. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/mixins/user_minxin.py +0 -0
  71. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/models/update.py +0 -0
  72. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/process/__init__.py +0 -0
  73. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/process/python_venv_process.py +0 -0
  74. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/process/sub_process.py +0 -0
  75. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/random/__init__.py +0 -0
  76. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/random/random_str.py +0 -0
  77. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/weixin/biz_data_crypt.py +0 -0
  78. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/weixin/error_code.py +0 -0
  79. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/weixin/format_response.py +0 -0
  80. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/weixin/wechat.py +0 -0
  81. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/weixin/wechat_crypt.py +0 -0
  82. {python_plugins-0.1.9 → python_plugins-0.2.1}/src/python_plugins/weixin/weixin_api.py +0 -0
  83. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/conftest.py +0 -0
  84. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_crypt_file.py +0 -0
  85. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_crypto.py +0 -0
  86. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_email.py +0 -0
  87. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_jwt.py +0 -0
  88. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_process.py +0 -0
  89. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_random.py +0 -0
  90. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_sqlalchemy.py +0 -0
  91. {python_plugins-0.1.9 → python_plugins-0.2.1}/tests/test_weixin.py +0 -0
@@ -1,3 +1,18 @@
1
+ v0.2.1
2
+ ------
3
+
4
+ Released 2024-11-23
5
+
6
+ - utils.walk_remove_dir
7
+
8
+ v0.2.0
9
+ ------
10
+
11
+ Released 2024-11-20
12
+
13
+ - add forms
14
+
15
+
1
16
  v0.1.9
2
17
  ------
3
18
 
@@ -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
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-plugins
3
- Version: 0.1.9
3
+ Version: 0.2.1
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
@@ -8,8 +8,6 @@ Welcome to python-plugins's documentation!
8
8
  :caption: Contents:
9
9
 
10
10
  usage
11
- api
12
- examples
13
11
  changes
14
12
 
15
13
  Indices and tables
@@ -42,26 +42,51 @@ mixins
42
42
  .. code-block:: python
43
43
 
44
44
  from flask_sqlalchemy import SQLAlchemy
45
+ from sqlalchemy.orm import DeclarativeBase
46
+
45
47
  from python_plugins.models.mixins import PrimaryKeyMixin
46
48
  from python_plugins.models.mixins import UserMixin
47
49
  from python_plugins.models.mixins import DataMixin
48
50
  from python_plugins.models.mixins import TimestampMixin
49
51
 
50
- db = SQLAlchemy()
52
+ class Base(DeclarativeBase):
53
+ pass
54
+
55
+ db = SQLAlchemy(model_class=Base)
51
56
 
52
- class User(PrimaryKeyMixin, DataMixin, TimestampMixin, UserMixin, db.models):
57
+ class User(db.models,PrimaryKeyMixin, DataMixin, TimestampMixin, UserMixin):
53
58
  __tablename__ = "users"
54
59
 
55
- remove_pycache
60
+ walk_remove_dir
56
61
  =======================
57
62
 
58
63
  .. code-block:: python
59
64
 
60
- from python_plugins.utils import remove_pycache
65
+ from python_plugins.utils import remove,remove_pycache,remove_ipynb_checkpoints
61
66
 
62
67
  remove_pycache() # default is "."
63
68
  remove_pycache("./tests")
64
69
 
70
+ remove(dir,rm_dir_name)
71
+
72
+
73
+ encrypt,decrypt
74
+ ================
75
+
76
+ .. code-block:: python
77
+
78
+ from python_plugins.crypto import encrypt_txtfile,decrypt_txtfile
79
+
80
+ # encrypt
81
+ encrypt_txtfile(txtfile)
82
+ encrypt_txtfile(txtfile,".")
83
+ encrypt_txtfile(txtfile, newfile, password=password)
84
+
85
+ # decrypt
86
+ decrypt_txtfile(encryptedfile)
87
+ decrypt_txtfile(encryptedfile,".")
88
+ decrypt_txtfile(encryptedfile, srcfile, password=password)
89
+
65
90
 
66
91
  weixin.wechat
67
92
  ==================
@@ -78,4 +103,4 @@ weixin.wechat
78
103
  mywechat = MyWechat("name")
79
104
  mywechat.verify(query)
80
105
  mywechat.chat(query,content)
81
-
106
+
@@ -10,7 +10,7 @@ readme = "README.rst"
10
10
  license = { file = "LICENSE.rst" }
11
11
  keywords = ["plugin", "utils"]
12
12
  authors = [
13
- { name = "huadong", email = "david.dong.hua@gmail.com" },
13
+ { name = "David Hua", email = "david.dong.hua@gmail.com" },
14
14
  ]
15
15
  classifiers = [
16
16
  "Development Status :: 3 - Alpha",
@@ -3,4 +3,5 @@ Faker
3
3
  cryptography
4
4
  SQLAlchemy
5
5
  PyJWT
6
- requests
6
+ requests
7
+ WTForms
@@ -0,0 +1 @@
1
+ __version__ = "0.2.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,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
  """
@@ -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")
@@ -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:
@@ -0,0 +1,4 @@
1
+ from .walk_remove_dir import remove
2
+ from .walk_remove_dir import remove_pycache
3
+ from .walk_remove_dir import remove_ipynb_checkpoints
4
+
@@ -0,0 +1,19 @@
1
+ import os
2
+ import shutil
3
+
4
+ def remove(dir_path,rm_dir_name):
5
+ for root, dirs, files in os.walk(dir_path):
6
+ if "venv" in root or "git" in root:
7
+ continue
8
+ for dir in dirs:
9
+ if dir == rm_dir_name:
10
+ rm_path = os.path.join(root, dir)
11
+ print(f"Removing {rm_path}")
12
+ shutil.rmtree(rm_path)
13
+
14
+ def remove_pycache(dir_path="."):
15
+ remove(dir_path,"__pycache__")
16
+
17
+ def remove_ipynb_checkpoints(dir_path="."):
18
+ remove(dir_path,".ipynb_checkpoints")
19
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,65 @@
1
+ from wtforms.form import Form
2
+ from python_plugins.forms.fields import JSONField
3
+ from python_plugins.forms.fields import DateTimeField
4
+ from python_plugins.forms.mixins.user import LoginForm
5
+ from python_plugins.forms.mixins.user import RegisterForm
6
+
7
+
8
+ class DummyPostData(dict):
9
+ def getlist(self, key):
10
+ v = self[key]
11
+ if not isinstance(v, (list, tuple)):
12
+ v = [v]
13
+ return v
14
+
15
+
16
+ class UserLoginForm(Form, LoginForm):
17
+ pass
18
+
19
+
20
+ class UserRegisterForm(Form, RegisterForm):
21
+ pass
22
+
23
+
24
+ def test_fields():
25
+ class F(Form):
26
+ json_field = JSONField()
27
+ datetime_field = DateTimeField()
28
+
29
+ formdata = DummyPostData(
30
+ json_field="[1,2,3]",
31
+ datetime_field="2000-01-01 12:12:12",
32
+ )
33
+
34
+ f = F(formdata)
35
+ assert f.validate()
36
+
37
+ json_field_text = f.json_field()
38
+ assert '<textarea id="json_field" name="json_field">' in json_field_text
39
+ assert "[1, 2, 3]</textarea>" in json_field_text
40
+
41
+ datetime_field_text = f.datetime_field()
42
+ assert "<input" in datetime_field_text
43
+ assert (
44
+ 'data-date-format="YYYY-MM-DD HH:mm:ss" data-role="datetimepicker"'
45
+ in datetime_field_text
46
+ )
47
+ assert 'value="2000-01-01 12:12:12"' in datetime_field_text
48
+
49
+
50
+ def test_user_form():
51
+ login_form = UserLoginForm()
52
+
53
+ for k in login_form:
54
+ # print(k.label())
55
+ # print(k())
56
+ assert k() is not None
57
+
58
+ assert "username" in login_form.username()
59
+
60
+ register_form = UserRegisterForm()
61
+
62
+ for k in register_form:
63
+ # print(k.label())
64
+ # print(k())
65
+ assert k() is not None
@@ -1,6 +1,7 @@
1
1
  import pytest
2
2
 
3
3
  from python_plugins.utils import remove_pycache
4
+ from python_plugins.utils import remove_ipynb_checkpoints
4
5
 
5
6
  @pytest.mark.skip
6
7
  def test_remove_pycache():
@@ -1,4 +0,0 @@
1
- API
2
- ===
3
-
4
-
@@ -1 +0,0 @@
1
- .. include:: ../examples/README.rst
@@ -1,17 +0,0 @@
1
- =============
2
- Examples
3
- =============
4
-
5
- Install
6
- =========
7
-
8
- Type these commands in the terminal:
9
-
10
- .. code-block:: bash
11
-
12
- $ git clone https://github.com/ojso/python-plugins.git
13
- $ cd python-plugins/examples
14
- $ python3 -m venv venv
15
- $ source venv/bin/activate
16
- $ pip install python-plugins
17
-
@@ -1 +0,0 @@
1
- __version__ = "0.1.9"
@@ -1 +0,0 @@
1
- from .utils.remove_pycache import remove_pycache
@@ -1,2 +0,0 @@
1
- from .fields import *
2
- from .widgets import *
@@ -1 +0,0 @@
1
- from .remove_pycache import remove_pycache
@@ -1,13 +0,0 @@
1
- import os
2
- import shutil
3
-
4
- def remove_pycache(dir_path="."):
5
- for root, dirs, files in os.walk(dir_path):
6
- if "venv" in root or "git" in root:
7
- continue
8
- for dir in dirs:
9
- if dir == "__pycache__":
10
- pycache_path = os.path.join(root, dir)
11
- print(f"Removing {pycache_path}")
12
- shutil.rmtree(pycache_path)
13
-
@@ -1,19 +0,0 @@
1
- from wtforms.form import Form
2
- from python_plugins.forms.fields import JSONField
3
- from python_plugins.forms.fields import DateTimeField
4
-
5
- class F(Form):
6
- a = JSONField()
7
- b = DateTimeField()
8
-
9
-
10
- def test_fields():
11
- f=F()
12
-
13
- # print(f.a())
14
- assert "textarea" in f.a()
15
-
16
- # print(f.b())
17
- assert "input" in f.b()
18
-
19
-