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
diff --git a/docs/ref/forms/models.txt b/docs/ref/forms/models.txt | |
index 46f7df1..dd0a422 100644 | |
--- a/docs/ref/forms/models.txt | |
+++ b/docs/ref/forms/models.txt | |
@@ -33,8 +33,8 @@ Model Form Functions | |
``formfield_callback`` and ``widgets`` are all passed through to | |
:func:`~django.forms.models.modelform_factory`. | |
- Arguments ``formset``, ``extra``, ``max_num``, ``can_order``, and | |
- ``can_delete`` are passed through to |
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
class TransactionMiddleware: | |
def __init__(self, get_response): | |
self.get_response = get_response | |
def __call__(self, request): | |
with transaction.atomic(): | |
response = self.get_response(request) | |
if response.status_code == 500: | |
transaction.set_rollback() | |
return response |
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 paginate(ctx_name): | |
""" | |
View decorator that handles pagination of a ListObject. Expects to find it | |
in the TemplateResponse context under the name ``ctx_name``. | |
This needs to not force delivery of the ListObject. | |
""" | |
def decorator(view_func): | |
@wraps(view_func) |
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
diff --git a/mypy/semanal.py b/mypy/semanal.py | |
index 7bac809..33d798f 100644 | |
--- a/mypy/semanal.py | |
+++ b/mypy/semanal.py | |
@@ -2943,21 +2943,9 @@ class SemanticAnalyzer(NodeVisitor): | |
if isinstance(base.node, TypeInfo): | |
# C.bar where C is a class | |
type_info = base.node | |
- elif isinstance(base.node, Var) and self.function_stack: | |
- # check for self.bar or cls.bar in method/classmethod |
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
class Jinja2Backend(jinja2backend.Jinja2): | |
def __init__(self, params): | |
self.context_processors = [ | |
import_string(p) | |
for p in params['OPTIONS'].pop('context_processors', []) | |
] | |
super(Jinja2Backend, self).__init__(params) |
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
"""Utility for pulling settings from the environment.""" | |
import os | |
from urllib.parse import urlparse | |
class EnvParser: | |
"""Utility for getting settings from the OS environ. | |
Instantiate with the name of an env var to get the current mode from (that | |
env var should be set to one of VALID_MODES, or not set), then call the |
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
""" | |
An alternative Django ``TEST_RUNNER`` which uses unittest2 test discovery from | |
a base path specified in settings, rather than requiring all tests to be in | |
``tests`` module of an app. | |
If you just run ``./manage.py test``, it'll discover and run all tests | |
underneath the ``TEST_DISCOVERY_ROOT`` setting (a path). If you run | |
``./manage.py test full.dotted.path.to.test_module``, it'll run the tests in | |
that module (you can also pass multiple modules). |
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
class StaticMethod(object): | |
def __init__(self, func): | |
self.func = func | |
def __get__(self, obj, cls): | |
return self.func | |
def staticmethod(func): |
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
~$ bench-jobs compare req-compile-bench-1664914413-esnow req-compile-bench-1664903905-esnow | |
All benchmarks: | |
=============== | |
+-------------------------+------------------------------------------------------------------+------------------------------------------------------------------+ | |
| Benchmark | req-compile-bench-1664914413-esnow/pyperformance-results.json.gz | req-compile-bench-1664903905-esnow/pyperformance-results.json.gz | | |
+=========================+==================================================================+==================================================================+ | |
| unpickle | 13.7 us | 13.2 us: 1.04x faster | | |
+-------------------------+------------------------------------------------------------------+------------------------------------------------------------------+ |
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 json | |
import requests | |
from websocket import create_connection | |
BASE = 'localhost:3000/socket.io/?EIO=3' | |
# First establish a polling-transport HTTP connection to get a session ID | |
url = 'http://%s&transport=polling' % BASE |