This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __init__(self, fields, *, require_all_fields=True, **kwargs): | |
self.require_all_fields = require_all_fields | |
super().__init__(**kwargs) | |
# We have two sets of widgets. Each field in fields has a widget whilst self.widget is probably our `MultiWidget` | |
# We're interested in the MultiWidget as this is what is rendered. | |
# Let's loop over fields and the MultiWidget and set required on the subwidgets. | |
for field, widget in zip(fields, self.widget.widgets): | |
field.error_messages.setdefault('incomplete', | |
self.error_messages['incomplete']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================= test session starts ============================= | |
platform win32 -- Python 3.9.0a6, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 | |
django: settings: crispy_forms.tests.test_settings (from option) | |
rootdir: C:\Users\smith\PycharmProjects\django-crispy-forms, inifile: setup.cfg | |
plugins: cov-2.8.1, django-3.9.0 | |
collected 556 items | |
crispy_forms\tests\test_dynamic_api.py ................................. [ 5%] | |
............................................................sss [ 17%] | |
crispy_forms\tests\test_form_helper.py ................................. [ 23%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.translation import ngettext_lazy | |
from django.core.validators import validate_email | |
from django.forms import Form, CharField, IntegerField, PasswordInput | |
from django.conf import settings | |
from django.forms.utils import ErrorList, ErrorDict, ValidationError | |
import django | |
settings.configure() | |
django.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repos: | |
- repo: https://github.com/timothycrosley/isort | |
rev: 5.6.4 | |
hooks: | |
- id: isort | |
- repo: https://gitlab.com/pycqa/flake8 | |
rev: 3.8.4 | |
hooks: | |
- id: flake8 | |
- repo: https://github.com/pre-commit/pre-commit-hooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyperf | |
small_data = {"a": 1, "b": 2, "c": 3} | |
large_data = {} | |
for k, v in enumerate(range(100_000)): | |
large_data[k] = v | |
def list_comprehension(loops, data): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyperf | |
from django.utils.functional import cached_property as dj_cached_property | |
from functools import cached_property as py_cached_property | |
class TestClass: | |
@dj_cached_property | |
def dj_cached(self): | |
return "Test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyperf | |
import django | |
from django.conf import settings | |
from django.urls import re_path, resolve | |
settings.configure(ROOT_URLCONF=__name__) | |
django.setup() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import django | |
from django import forms | |
from django.conf import settings | |
from django.forms import Media | |
settings.configure() | |
django.setup() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf.global_settings import INSTALLED_APPS | |
import django | |
from django.db import models | |
from django.conf import settings | |
import pyperf | |
settings.configure(INSTALLED_APPS= ('__main__',)) | |
django.setup() | |
# models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf.global_settings import INSTALLED_APPS | |
import django | |
from django.conf import settings | |
from django.forms import DecimalField | |
import pyperf | |
settings.configure(INSTALLED_APPS= ('__main__',)) | |
django.setup() | |
OlderNewer