TokenType
is a class within the django.template.base
module of the Django project.
Context,
FilterExpression,
Node,
NodeList,
Parser,
Template,
TemplateSyntaxError,
TextNode,
Token,
VariableDoesNotExist,
VariableNode,
and token_kwargs
are several other callables with code examples from the same django.template.base
package.
django-sitetree (project documentation and PyPI package information) is a Django extension that makes it easier for developers to add site trees, menus and breadcrumb navigation elements to their web applications.
The django-sitetree project is provided as open source under the BSD 3-Clause "New" or "Revised" License.
django-sitetree / sitetree / compat.py
# compat.py
from typing import Callable
try:
from django.template.base import TokenType
TOKEN_BLOCK = TokenType.BLOCK
TOKEN_TEXT = TokenType.TEXT
TOKEN_VAR = TokenType.VAR
except ImportError:
from django.template.base import TOKEN_BLOCK, TOKEN_TEXT, TOKEN_VAR
class CommandOption:
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def options_getter(command_options):
def get_options(option_func: Callable = None):
from optparse import make_option
func = option_func or make_option
options = tuple([func(*option.args, **option.kwargs) for option in command_options])
return [] if option_func is None else options
return get_options
## ... source file continues with no further TokenType examples...