id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
172,578
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,579
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,580
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,581
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,582
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,583
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,584
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,585
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,586
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,587
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,588
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,589
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,590
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,591
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,592
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,593
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,594
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,595
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,596
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,597
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,598
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,599
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,600
from fractions import Fraction from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( ensure_list, equal, extras_msg, find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, unbool, uniq, ) from jsonschema....
null
172,601
from __future__ import annotations from collections import defaultdict, deque from pprint import pformat from textwrap import dedent, indent import heapq import itertools import attr from jsonschema import _utils WEAK_MATCHES: frozenset[str] = frozenset(["anyOf", "oneOf"]) STRONG_MATCHES: frozenset[str] = frozenset() r...
Create a key function that can be used to sort errors by relevance. Arguments: weak (set): a collection of validation keywords to consider to be "weak". If there are two errors at the same level of the instance and one is in the set of weak validation keywords, the other error will take priority. By default, :kw:`anyOf...
172,602
from __future__ import annotations from collections import deque from collections.abc import Mapping, Sequence from functools import lru_cache from operator import methodcaller from urllib.parse import unquote, urldefrag, urljoin, urlsplit from urllib.request import urlopen from warnings import warn import contextlib i...
null
172,603
from __future__ import annotations from collections import deque from collections.abc import Mapping, Sequence from functools import lru_cache from operator import methodcaller from urllib.parse import unquote, urldefrag, urljoin, urlsplit from urllib.request import urlopen from warnings import warn import contextlib i...
null
172,604
from __future__ import annotations from collections import deque from collections.abc import Mapping, Sequence from functools import lru_cache from operator import methodcaller from urllib.parse import unquote, urldefrag, urljoin, urlsplit from urllib.request import urlopen from warnings import warn import contextlib i...
Create a new validator class by extending an existing one. Arguments: validator (jsonschema.protocols.Validator): an existing validator class validators (collections.abc.Mapping): a mapping of new validator callables to extend with, whose structure is as in `create`. .. note:: Any validator callables with the same name...
172,605
from __future__ import annotations from collections import deque from collections.abc import Mapping, Sequence from functools import lru_cache from operator import methodcaller from urllib.parse import unquote, urldefrag, urljoin, urlsplit from urllib.request import urlopen from warnings import warn import contextlib i...
null
172,606
from __future__ import annotations from collections import deque from collections.abc import Mapping, Sequence from functools import lru_cache from operator import methodcaller from urllib.parse import unquote, urldefrag, urljoin, urlsplit from urllib.request import urlopen from warnings import warn import contextlib i...
null
172,607
from __future__ import annotations from collections import deque from collections.abc import Mapping, Sequence from functools import lru_cache from operator import methodcaller from urllib.parse import unquote, urldefrag, urljoin, urlsplit from urllib.request import urlopen from warnings import warn import contextlib i...
Breadth-first search routine.
172,608
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def _typed_pmap_converter( init_val: typing.Mapping[ str, typing.Callable[["TypeChecker", typing.Any], bool...
null
172,609
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_array(checker, instance): return isinstance(instance, list)
null
172,610
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_bool(checker, instance): return isinstance(instance, bool)
null
172,611
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_integer(checker, instance): # bool inherits from int, so ensure bools aren't reported as ints if isinstance(inst...
null
172,612
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_null(checker, instance): return instance is None
null
172,613
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_number(checker, instance): # bool inherits from int, so ensure bools aren't reported as ints if isinstance(insta...
null
172,614
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_object(checker, instance): return isinstance(instance, dict)
null
172,615
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_string(checker, instance): return isinstance(instance, str)
null
172,616
from __future__ import annotations import numbers import typing from pyrsistent import pmap from pyrsistent.typing import PMap import attr from jsonschema.exceptions import UndefinedTypeCheck def is_any(checker, instance): return True
null
172,617
import re import typing as t from ast import literal_eval from collections import deque from sys import intern from ._identifier import pattern as name_re from .exceptions import TemplateSyntaxError from .utils import LRUCache TOKEN_NAME = intern("name") def _describe_token_type(token_type: str) -> str: if token_ty...
Returns a description of the token.
172,618
import re import typing as t from ast import literal_eval from collections import deque from sys import intern from ._identifier import pattern as name_re from .exceptions import TemplateSyntaxError from .utils import LRUCache TOKEN_NAME = intern("name") def _describe_token_type(token_type: str) -> str: if token_ty...
Like `describe_token` but for token expressions.
172,619
import re import typing as t from ast import literal_eval from collections import deque from sys import intern from ._identifier import pattern as name_re from .exceptions import TemplateSyntaxError from .utils import LRUCache newline_re = re.compile(r"(\r\n|\r|\n)") assert len(operators) == len(reverse_operators), "op...
Count the number of newline characters in the string. This is useful for extensions that filter a stream.
172,620
import re import typing as t from ast import literal_eval from collections import deque from sys import intern from ._identifier import pattern as name_re from .exceptions import TemplateSyntaxError from .utils import LRUCache if t.TYPE_CHECKING: import typing_extensions as te from .environment import Environme...
Compiles all the rules from the environment into a list of rules.
172,621
import re import typing as t from ast import literal_eval from collections import deque from sys import intern from ._identifier import pattern as name_re from .exceptions import TemplateSyntaxError from .utils import LRUCache _lexer_cache: t.MutableMapping[t.Tuple, "Lexer"] = LRUCache(50) class Lexer: """Class th...
Return a lexer which is probably cached.
172,622
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe F = t.TypeVar("F", bound=t.Cal...
Pass the :class:`~jinja2.Environment` as the first argument to the decorated function when called while rendering a template. Can be used on functions, filters, and tests. .. versionadded:: 3.0.0 Replaces ``environmentfunction`` and ``environmentfilter``.
172,623
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe F = t.TypeVar("F", bound=t.Cal...
Marks the function as internally used
172,624
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe if t.TYPE_CHECKING: import...
Check if the object passed is undefined. This does nothing more than performing an instance check against :class:`Undefined` but looks nicer. This can be used for custom filters or tests that want to react to undefined variables. For example a custom default filter can look like this:: def default(var, default=''): if ...
172,625
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe if t.TYPE_CHECKING: import...
Consumes an iterable without doing anything with it.
172,626
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe def get_spontaneous_environme...
Jinja keeps internal caches for environments and lexers. These are used so that Jinja doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches.
172,627
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe if t.TYPE_CHECKING: import...
Returns a file descriptor for the filename if that file exists, otherwise ``None``.
172,628
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe if t.TYPE_CHECKING: import...
Returns the name of the object's type. For some recognized singletons the name of the object is returned instead. (For example for `None` and `Ellipsis`).
172,629
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe def randrange(start: int, sto...
Generate some lorem ipsum for the template.
172,630
import enum import json import os import re import typing as t from collections import abc from collections import deque from random import choice from random import randrange from threading import Lock from types import CodeType from urllib.parse import quote_from_bytes import markupsafe if t.TYPE_CHECKING: import...
Intelligently sets the initial value of autoescaping based on the filename of the template. This is the recommended way to configure autoescaping if you do not want to write a custom function yourself. If you want to enable it for all templates created from strings or for all templates with `.html` and `.xml` extension...
172,631
import typing as t from . import nodes from .visitor import NodeVisitor class Symbols: def __init__( self, parent: t.Optional["Symbols"] = None, level: t.Optional[int] = None ) -> None: if level is None: if parent is None: level = 0 else: l...
null
172,632
import typing as t from . import nodes from .visitor import NodeVisitor class Symbols: def __init__( self, parent: t.Optional["Symbols"] = None, level: t.Optional[int] = None ) -> None: if level is None: if parent is None: level = 0 else: l...
null
172,633
import typing as t from contextlib import contextmanager from functools import update_wrapper from io import StringIO from itertools import chain from keyword import iskeyword as is_python_keyword from markupsafe import escape from markupsafe import Markup from . import nodes from .exceptions import TemplateAssertionEr...
null
172,634
import typing as t from contextlib import contextmanager from functools import update_wrapper from io import StringIO from itertools import chain from keyword import iskeyword as is_python_keyword from markupsafe import escape from markupsafe import Markup from . import nodes from .exceptions import TemplateAssertionEr...
null
172,635
import typing as t from contextlib import contextmanager from functools import update_wrapper from io import StringIO from itertools import chain from keyword import iskeyword as is_python_keyword from markupsafe import escape from markupsafe import Markup from . import nodes from .exceptions import TemplateAssertionEr...
Generate the python source for a node tree.
172,636
import typing as t from contextlib import contextmanager from functools import update_wrapper from io import StringIO from itertools import chain from keyword import iskeyword as is_python_keyword from markupsafe import escape from markupsafe import Markup from . import nodes from .exceptions import TemplateAssertionEr...
Does the node have a safe representation?
172,637
import typing as t from contextlib import contextmanager from functools import update_wrapper from io import StringIO from itertools import chain from keyword import iskeyword as is_python_keyword from markupsafe import escape from markupsafe import Markup from . import nodes from .exceptions import TemplateAssertionEr...
Check if the names passed are accessed undeclared. The return value is a set of all the undeclared names from the sequence of names found.
172,638
import os import typing import typing as t import weakref from collections import ChainMap from functools import lru_cache from functools import partial from functools import reduce from types import CodeType from markupsafe import Markup from . import nodes from .compiler import CodeGenerator from .compiler import gen...
Return the cache class for the given size.
172,639
import os import typing import typing as t import weakref from collections import ChainMap from functools import lru_cache from functools import partial from functools import reduce from types import CodeType from markupsafe import Markup from . import nodes from .compiler import CodeGenerator from .compiler import gen...
Create an empty copy of the given cache.
172,640
import os import typing import typing as t import weakref from collections import ChainMap from functools import lru_cache from functools import partial from functools import reduce from types import CodeType from markupsafe import Markup from . import nodes from .compiler import CodeGenerator from .compiler import gen...
Load the extensions from the list and bind it to the environment. Returns a dict of instantiated extensions.
172,641
import os import typing import typing as t import weakref from collections import ChainMap from functools import lru_cache from functools import partial from functools import reduce from types import CodeType from markupsafe import Markup from . import nodes from .compiler import CodeGenerator from .compiler import gen...
Perform a sanity check on the environment.
172,642
import inspect import typing as t from functools import WRAPPER_ASSIGNMENTS from functools import wraps from .utils import _PassArg from .utils import pass_eval_context WRAPPER_ASSIGNMENTS: Sequence[str] def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_T], _T...
null
172,643
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Enforce HTML escaping. This will probably double escape variables.
172,644
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Quote data for use in a URL path or query using UTF-8. Basic wrapper around :func:`urllib.parse.quote` when given a string, or :func:`urllib.parse.urlencode` for a dict or iterable. :param value: Data to quote. A string will be quoted directly. A dict or iterable of ``(key, value)`` pairs will be joined as a query stri...
172,645
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return a copy of the value with all occurrences of a substring replaced with a new one. The first argument is the substring that should be replaced, the second is the replacement string. If the optional third argument ``count`` is given, only the first ``count`` occurrences are replaced: .. sourcecode:: jinja {{ "Hello...
172,646
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Convert a value to uppercase.
172,647
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Convert a value to lowercase.
172,648
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return an iterator over the ``(key, value)`` items of a mapping. ``x|items`` is the same as ``x.items()``, except if ``x`` is undefined an empty iterator is returned. This filter is useful if you expect the template to be rendered with an implementation of Jinja in another programming language that does not have a ``.i...
172,649
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped: .. sourcecode:: html+jinja <ul{{ {'class': 'my_list', 'missing': none, 'id': 'list-%d'|format(variable)}|xmlattr }}> ... </ul> Results in something like this: .. sourcecode:: h...
172,650
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Capitalize a value. The first character will be uppercase, all others lowercase.
172,651
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return a titlecased version of the value. I.e. words will start with uppercase letters, all remaining characters are lowercase.
172,652
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Sort a dict and yield (key, value) pairs. Python dicts may not be in the order you want to display them in, so sort them first. .. sourcecode:: jinja {% for key, value in mydict|dictsort %} sort the dict by key, case insensitive {% for key, value in mydict|dictsort(reverse=true) %} sort the dict by key, case insensitiv...
172,653
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Sort an iterable using Python's :func:`sorted`. .. sourcecode:: jinja {% for city in cities|sort %} ... {% endfor %} :param reverse: Sort descending instead of ascending. :param case_sensitive: When sorting strings, sort upper and lower case separately. :param attribute: When sorting objects or dicts, an attribute or k...
172,654
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Returns a list of unique items from the given iterable. .. sourcecode:: jinja {{ ['foo', 'bar', 'foobar', 'FooBar']|unique|list }} -> ['foo', 'bar', 'foobar'] The unique items are yielded in the same order as their first occurrence in the iterable passed to the filter. :param case_sensitive: Treat upper and lower case ...
172,655
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return the smallest item from the sequence. .. sourcecode:: jinja {{ [1, 2, 3]|min }} -> 1 :param case_sensitive: Treat upper and lower case strings as distinct. :param attribute: Get the object with the min value of this attribute.
172,656
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return the largest item from the sequence. .. sourcecode:: jinja {{ [1, 2, 3]|max }} -> 3 :param case_sensitive: Treat upper and lower case strings as distinct. :param attribute: Get the object with the max value of this attribute.
172,657
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
If the value is undefined it will return the passed default value, otherwise the value of the variable: .. sourcecode:: jinja {{ my_variable|default('my_variable is not defined') }} This will output the value of ``my_variable`` if the variable was defined, otherwise ``'my_variable is not defined'``. If you want to use ...
172,658
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
null
172,659
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Centers the value in a field of a given width.
172,660
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return the first item of a sequence.
172,661
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
null
172,662
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return the last item of a sequence. Note: Does not work with generators. You may want to explicitly convert it to a list: .. sourcecode:: jinja {{ data | selectattr('name', '==', 'Jinja') | list | last }}
172,663
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return a random item from the sequence.
172,664
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Format the value like a 'human-readable' file size (i.e. 13 kB, 4.1 MB, 102 Bytes, etc). Per default decimal prefixes are used (Mega, Giga, etc.), if the second parameter is set to `True` the binary prefixes are used (Mebi, Gibi).
172,665
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Pretty print a variable. Useful for debugging.
172,666
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Convert URLs in text into clickable links. This may not recognize links in some situations. Usually, a more comprehensive formatter, such as a Markdown library, is a better choice. Works on ``http://``, ``https://``, ``www.``, ``mailto:``, and email addresses. Links with trailing punctuation (periods, commas, closing p...
172,667
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return a copy of the string with each line indented by 4 spaces. The first line and blank lines are not indented by default. :param width: Number of spaces, or a string, to indent by. :param first: Don't skip indenting the first line. :param blank: Don't skip indenting empty lines. .. versionchanged:: 3.0 ``width`` can...
172,668
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Return a truncated copy of the string. The length is specified with the first parameter which defaults to ``255``. If the second parameter is ``true`` the filter will cut the text at length. Otherwise it will discard the last word. If the text was in fact truncated it will append an ellipsis sign (``"..."``). If you wa...
172,669
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Wrap a string to the given width. Existing newlines are treated as paragraphs to be wrapped separately. :param s: Original text to wrap. :param width: Maximum length of wrapped lines. :param break_long_words: If a word is longer than ``width``, break it across lines. :param break_on_hyphens: If a word contains hyphens,...
172,670
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Count the words in that string.
172,671
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter. You can also override the default base (10) in the second parameter, which handles input with prefixes such as 0b, 0o and 0x for bases 2, 8 and 16 respectively. The base is ig...
172,672
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Convert the value into a floating point number. If the conversion doesn't work it will return ``0.0``. You can override this default using the first parameter.
172,673
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Apply the given values to a `printf-style`_ format string, like ``string % values``. .. sourcecode:: jinja {{ "%s, %s!"|format(greeting, name) }} Hello, World! In most cases it should be more convenient and efficient to use the ``%`` operator or :meth:`str.format`. .. code-block:: text {{ "%s, %s!" % (greeting, name) }...
172,674
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Strip leading and trailing characters, by default whitespace.
172,675
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
Strip SGML/XML tags and replace adjacent whitespace by one space.
172,676
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
null
172,677
import math import random import re import typing import typing as t from collections import abc from itertools import chain from itertools import groupby from markupsafe import escape from markupsafe import Markup from markupsafe import soft_str from .async_utils import async_variant from .async_utils import auto_aite...
A filter that batches items. It works pretty much like `slice` just the other way round. It returns a list of lists with the given number of items. If you provide a second parameter this is used to fill up missing items. See this example: .. sourcecode:: html+jinja <table> {%- for row in items|batch(3, '&nbsp;') %} <tr...