Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
reject_location_related_install_options
( requirements: List[InstallRequirement], options: Optional[List[str]] )
If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning.
If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning.
def reject_location_related_install_options( requirements: List[InstallRequirement], options: Optional[List[str]] ) -> None: """If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. """ def format_options(option_name...
[ "def", "reject_location_related_install_options", "(", "requirements", ":", "List", "[", "InstallRequirement", "]", ",", "options", ":", "Optional", "[", "List", "[", "str", "]", "]", ")", "->", "None", ":", "def", "format_options", "(", "option_names", ":", "...
[ 660, 0 ]
[ 699, 5 ]
python
en
['en', 'en', 'en']
True
create_os_error_message
( error: OSError, show_traceback: bool, using_user_site: bool )
Format an error message for an OSError It may occur anytime during the execution of the install command.
Format an error message for an OSError
def create_os_error_message( error: OSError, show_traceback: bool, using_user_site: bool ) -> str: """Format an error message for an OSError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to show a traceback parts.ap...
[ "def", "create_os_error_message", "(", "error", ":", "OSError", ",", "show_traceback", ":", "bool", ",", "using_user_site", ":", "bool", ")", "->", "str", ":", "parts", "=", "[", "]", "# Mention the error if we are not going to show a traceback", "parts", ".", "appe...
[ 702, 0 ]
[ 749, 40 ]
python
br
['br', 'lb', 'en']
False
AccessMixin.get_login_url
(self)
Override this method to override the login_url attribute.
Override this method to override the login_url attribute.
def get_login_url(self): """ Override this method to override the login_url attribute. """ login_url = self.login_url or settings.LOGIN_URL if not login_url: raise ImproperlyConfigured( '{0} is missing the login_url attribute. Define {0}.login_url, set...
[ "def", "get_login_url", "(", "self", ")", ":", "login_url", "=", "self", ".", "login_url", "or", "settings", ".", "LOGIN_URL", "if", "not", "login_url", ":", "raise", "ImproperlyConfigured", "(", "'{0} is missing the login_url attribute. Define {0}.login_url, settings.LOG...
[ 19, 4 ]
[ 29, 29 ]
python
en
['en', 'error', 'th']
False
AccessMixin.get_permission_denied_message
(self)
Override this method to override the permission_denied_message attribute.
Override this method to override the permission_denied_message attribute.
def get_permission_denied_message(self): """ Override this method to override the permission_denied_message attribute. """ return self.permission_denied_message
[ "def", "get_permission_denied_message", "(", "self", ")", ":", "return", "self", ".", "permission_denied_message" ]
[ 31, 4 ]
[ 35, 45 ]
python
en
['en', 'error', 'th']
False
AccessMixin.get_redirect_field_name
(self)
Override this method to override the redirect_field_name attribute.
Override this method to override the redirect_field_name attribute.
def get_redirect_field_name(self): """ Override this method to override the redirect_field_name attribute. """ return self.redirect_field_name
[ "def", "get_redirect_field_name", "(", "self", ")", ":", "return", "self", ".", "redirect_field_name" ]
[ 37, 4 ]
[ 41, 39 ]
python
en
['en', 'error', 'th']
False
PermissionRequiredMixin.get_permission_required
(self)
Override this method to override the permission_required attribute. Must return an iterable.
Override this method to override the permission_required attribute. Must return an iterable.
def get_permission_required(self): """ Override this method to override the permission_required attribute. Must return an iterable. """ if self.permission_required is None: raise ImproperlyConfigured( '{0} is missing the permission_required attribute. ...
[ "def", "get_permission_required", "(", "self", ")", ":", "if", "self", ".", "permission_required", "is", "None", ":", "raise", "ImproperlyConfigured", "(", "'{0} is missing the permission_required attribute. Define {0}.permission_required, or override '", "'{0}.get_permission_requi...
[ 77, 4 ]
[ 91, 20 ]
python
en
['en', 'error', 'th']
False
PermissionRequiredMixin.has_permission
(self)
Override this method to customize the way permissions are checked.
Override this method to customize the way permissions are checked.
def has_permission(self): """ Override this method to customize the way permissions are checked. """ perms = self.get_permission_required() return self.request.user.has_perms(perms)
[ "def", "has_permission", "(", "self", ")", ":", "perms", "=", "self", ".", "get_permission_required", "(", ")", "return", "self", ".", "request", ".", "user", ".", "has_perms", "(", "perms", ")" ]
[ 93, 4 ]
[ 98, 49 ]
python
en
['en', 'error', 'th']
False
UserPassesTestMixin.get_test_func
(self)
Override this method to use a different test_func method.
Override this method to use a different test_func method.
def get_test_func(self): """ Override this method to use a different test_func method. """ return self.test_func
[ "def", "get_test_func", "(", "self", ")", ":", "return", "self", ".", "test_func" ]
[ 117, 4 ]
[ 121, 29 ]
python
en
['en', 'error', 'th']
False
move_to_completion_bucket
(target_bucket, target_infix, **kwargs)
A utility method to move an object to a target location in GCS.
A utility method to move an object to a target location in GCS.
def move_to_completion_bucket(target_bucket, target_infix, **kwargs): """A utility method to move an object to a target location in GCS.""" # Here we establish a connection hook to GoogleCloudStorage. # Google Cloud Composer automatically provides a google_cloud_storage_default # connection id that is u...
[ "def", "move_to_completion_bucket", "(", "target_bucket", ",", "target_infix", ",", "*", "*", "kwargs", ")", ":", "# Here we establish a connection hook to GoogleCloudStorage.", "# Google Cloud Composer automatically provides a google_cloud_storage_default", "# connection id that is used...
[ 79, 0 ]
[ 103, 45 ]
python
en
['en', 'en', 'en']
True
Marker.evaluate
(self, environment=None)
Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process.
Evaluate a marker.
def evaluate(self, environment=None): """Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Pyt...
[ "def", "evaluate", "(", "self", ",", "environment", "=", "None", ")", ":", "current_environment", "=", "default_environment", "(", ")", "if", "environment", "is", "not", "None", ":", "current_environment", ".", "update", "(", "environment", ")", "return", "_ev...
[ 287, 4 ]
[ 300, 68 ]
python
en
['en', 'en', 'en']
True
validate_twilio_request
(f)
Validates that incoming requests genuinely originated from Twilio
Validates that incoming requests genuinely originated from Twilio
def validate_twilio_request(f): """Validates that incoming requests genuinely originated from Twilio""" @wraps(f) def decorated_function(*args, **kwargs): # Create an instance of the RequestValidator class validator = RequestValidator(os.environ.get('TWILIO_AUTH_TOKEN')) # Validate ...
[ "def", "validate_twilio_request", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated_function", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Create an instance of the RequestValidator class", "validator", "=", "RequestValidator", "(", ...
[ 7, 0 ]
[ 27, 29 ]
python
en
['en', 'en', 'en']
True
BoxDef.rawdata_input_fn
(self, ref, ltg, griddef, ltgfcst = None)
Input function that yields example dicts for each box in grid.
Input function that yields example dicts for each box in grid.
def rawdata_input_fn(self, ref, ltg, griddef, ltgfcst = None): """Input function that yields example dicts for each box in grid.""" for cy, cx in self.get_prediction_grid_centers(ref): # restrict to grids where there is currently lightning in the area interesting = np.sum( ltg[cy - self.trai...
[ "def", "rawdata_input_fn", "(", "self", ",", "ref", ",", "ltg", ",", "griddef", ",", "ltgfcst", "=", "None", ")", ":", "for", "cy", ",", "cx", "in", "self", ".", "get_prediction_grid_centers", "(", "ref", ")", ":", "# restrict to grids where there is currently...
[ 36, 2 ]
[ 76, 21 ]
python
en
['en', 'en', 'en']
True
SequenceLikelihood.get_num_categories
(cls)
:returns: The number of likelihood categories in the enum.
:returns: The number of likelihood categories in the enum.
def get_num_categories(cls): """:returns: The number of likelihood categories in the enum.""" return 4
[ "def", "get_num_categories", "(", "cls", ")", ":", "return", "4" ]
[ 59, 4 ]
[ 61, 16 ]
python
en
['en', 'af', 'en']
True
Collector.add
(self, objs, source=None, nullable=False, reverse_dependency=False)
Add 'objs' to the collection of objects to be deleted. If the call is the result of a cascade, 'source' should be the model that caused it, and 'nullable' should be set to True if the relation can be null. Return a list of all objects that were not already collected.
Add 'objs' to the collection of objects to be deleted. If the call is the result of a cascade, 'source' should be the model that caused it, and 'nullable' should be set to True if the relation can be null.
def add(self, objs, source=None, nullable=False, reverse_dependency=False): """ Add 'objs' to the collection of objects to be deleted. If the call is the result of a cascade, 'source' should be the model that caused it, and 'nullable' should be set to True if the relation can be null. ...
[ "def", "add", "(", "self", ",", "objs", ",", "source", "=", "None", ",", "nullable", "=", "False", ",", "reverse_dependency", "=", "False", ")", ":", "if", "not", "objs", ":", "return", "[", "]", "new_objs", "=", "[", "]", "model", "=", "objs", "["...
[ 98, 4 ]
[ 120, 23 ]
python
en
['en', 'error', 'th']
False
Collector.add_field_update
(self, field, value, objs)
Schedule a field update. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet).
Schedule a field update. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet).
def add_field_update(self, field, value, objs): """ Schedule a field update. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet). """ if not objs: return model = objs[0].__class__ self.field_updates[model][field, value...
[ "def", "add_field_update", "(", "self", ",", "field", ",", "value", ",", "objs", ")", ":", "if", "not", "objs", ":", "return", "model", "=", "objs", "[", "0", "]", ".", "__class__", "self", ".", "field_updates", "[", "model", "]", "[", "field", ",", ...
[ 128, 4 ]
[ 136, 60 ]
python
en
['en', 'error', 'th']
False
Collector.can_fast_delete
(self, objs, from_field=None)
Determine if the objects in the given queryset-like or single object can be fast-deleted. This can be done if there are no cascades, no parents and no signal listeners for the object class. The 'from_field' tells where we are coming from - we need this to determine if the objec...
Determine if the objects in the given queryset-like or single object can be fast-deleted. This can be done if there are no cascades, no parents and no signal listeners for the object class.
def can_fast_delete(self, objs, from_field=None): """ Determine if the objects in the given queryset-like or single object can be fast-deleted. This can be done if there are no cascades, no parents and no signal listeners for the object class. The 'from_field' tells where we are...
[ "def", "can_fast_delete", "(", "self", ",", "objs", ",", "from_field", "=", "None", ")", ":", "if", "from_field", "and", "from_field", ".", "remote_field", ".", "on_delete", "is", "not", "CASCADE", ":", "return", "False", "if", "hasattr", "(", "objs", ",",...
[ 164, 4 ]
[ 198, 9 ]
python
en
['en', 'error', 'th']
False
Collector.get_del_batches
(self, objs, fields)
Return the objs in suitably sized batches for the used connection.
Return the objs in suitably sized batches for the used connection.
def get_del_batches(self, objs, fields): """ Return the objs in suitably sized batches for the used connection. """ field_names = [field.name for field in fields] conn_batch_size = max( connections[self.using].ops.bulk_batch_size(field_names, objs), 1) if len(...
[ "def", "get_del_batches", "(", "self", ",", "objs", ",", "fields", ")", ":", "field_names", "=", "[", "field", ".", "name", "for", "field", "in", "fields", "]", "conn_batch_size", "=", "max", "(", "connections", "[", "self", ".", "using", "]", ".", "op...
[ 200, 4 ]
[ 211, 25 ]
python
en
['en', 'error', 'th']
False
Collector.collect
(self, objs, source=None, nullable=False, collect_related=True, source_attr=None, reverse_dependency=False, keep_parents=False, fail_on_restricted=True)
Add 'objs' to the collection of objects to be deleted as well as all parent instances. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet). If 'collect_related' is True, related objects will be handled by their respective on_delete handler. I...
Add 'objs' to the collection of objects to be deleted as well as all parent instances. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet). If 'collect_related' is True, related objects will be handled by their respective on_delete handler.
def collect(self, objs, source=None, nullable=False, collect_related=True, source_attr=None, reverse_dependency=False, keep_parents=False, fail_on_restricted=True): """ Add 'objs' to the collection of objects to be deleted as well as all parent instances. 'objs' ...
[ "def", "collect", "(", "self", ",", "objs", ",", "source", "=", "None", ",", "nullable", "=", "False", ",", "collect_related", "=", "True", ",", "source_attr", "=", "None", ",", "reverse_dependency", "=", "False", ",", "keep_parents", "=", "False", ",", ...
[ 213, 4 ]
[ 343, 21 ]
python
en
['en', 'error', 'th']
False
Collector.related_objects
(self, related_model, related_fields, objs)
Get a QuerySet of the related model to objs via related fields.
Get a QuerySet of the related model to objs via related fields.
def related_objects(self, related_model, related_fields, objs): """ Get a QuerySet of the related model to objs via related fields. """ predicate = reduce(operator.or_, ( query_utils.Q(**{'%s__in' % related_field.name: objs}) for related_field in related_fields ...
[ "def", "related_objects", "(", "self", ",", "related_model", ",", "related_fields", ",", "objs", ")", ":", "predicate", "=", "reduce", "(", "operator", ".", "or_", ",", "(", "query_utils", ".", "Q", "(", "*", "*", "{", "'%s__in'", "%", "related_field", "...
[ 345, 4 ]
[ 353, 78 ]
python
en
['en', 'error', 'th']
False
Request.max_content_length
(self)
Read-only view of the ``MAX_CONTENT_LENGTH`` config key.
Read-only view of the ``MAX_CONTENT_LENGTH`` config key.
def max_content_length(self): """Read-only view of the ``MAX_CONTENT_LENGTH`` config key.""" ctx = _request_ctx_stack.top if ctx is not None: return ctx.app.config['MAX_CONTENT_LENGTH']
[ "def", "max_content_length", "(", "self", ")", ":", "ctx", "=", "_request_ctx_stack", ".", "top", "if", "ctx", "is", "not", "None", ":", "return", "ctx", ".", "app", ".", "config", "[", "'MAX_CONTENT_LENGTH'", "]" ]
[ 62, 4 ]
[ 66, 55 ]
python
en
['en', 'en', 'en']
True
Request.endpoint
(self)
The endpoint that matched the request. This in combination with :attr:`view_args` can be used to reconstruct the same or a modified URL. If an exception happened when matching, this will be ``None``.
The endpoint that matched the request. This in combination with :attr:`view_args` can be used to reconstruct the same or a modified URL. If an exception happened when matching, this will be ``None``.
def endpoint(self): """The endpoint that matched the request. This in combination with :attr:`view_args` can be used to reconstruct the same or a modified URL. If an exception happened when matching, this will be ``None``. """ if self.url_rule is not None: r...
[ "def", "endpoint", "(", "self", ")", ":", "if", "self", ".", "url_rule", "is", "not", "None", ":", "return", "self", ".", "url_rule", ".", "endpoint" ]
[ 69, 4 ]
[ 76, 41 ]
python
en
['en', 'en', 'en']
True
Request.module
(self)
The name of the current module if the request was dispatched to an actual module. This is deprecated functionality, use blueprints instead.
The name of the current module if the request was dispatched to an actual module. This is deprecated functionality, use blueprints instead.
def module(self): """The name of the current module if the request was dispatched to an actual module. This is deprecated functionality, use blueprints instead. """ from warnings import warn warn(DeprecationWarning('modules were deprecated in favor of ' ...
[ "def", "module", "(", "self", ")", ":", "from", "warnings", "import", "warn", "warn", "(", "DeprecationWarning", "(", "'modules were deprecated in favor of '", "'blueprints. Use request.blueprint '", "'instead.'", ")", ",", "stacklevel", "=", "2", ")", "if", "self", ...
[ 79, 4 ]
[ 89, 33 ]
python
en
['en', 'en', 'en']
True
Request.blueprint
(self)
The name of the current blueprint
The name of the current blueprint
def blueprint(self): """The name of the current blueprint""" if self.url_rule and '.' in self.url_rule.endpoint: return self.url_rule.endpoint.rsplit('.', 1)[0]
[ "def", "blueprint", "(", "self", ")", ":", "if", "self", ".", "url_rule", "and", "'.'", "in", "self", ".", "url_rule", ".", "endpoint", ":", "return", "self", ".", "url_rule", ".", "endpoint", ".", "rsplit", "(", "'.'", ",", "1", ")", "[", "0", "]"...
[ 92, 4 ]
[ 95, 59 ]
python
en
['en', 'en', 'en']
True
Request.json
(self)
If the mimetype is :mimetype:`application/json` this will contain the parsed JSON data. Otherwise this will be ``None``. The :meth:`get_json` method should be used instead.
If the mimetype is :mimetype:`application/json` this will contain the parsed JSON data. Otherwise this will be ``None``.
def json(self): """If the mimetype is :mimetype:`application/json` this will contain the parsed JSON data. Otherwise this will be ``None``. The :meth:`get_json` method should be used instead. """ from warnings import warn warn(DeprecationWarning('json is deprecated. ' ...
[ "def", "json", "(", "self", ")", ":", "from", "warnings", "import", "warn", "warn", "(", "DeprecationWarning", "(", "'json is deprecated. '", "'Use get_json() instead.'", ")", ",", "stacklevel", "=", "2", ")", "return", "self", ".", "get_json", "(", ")" ]
[ 98, 4 ]
[ 107, 30 ]
python
en
['en', 'en', 'en']
True
Request.is_json
(self)
Indicates if this request is JSON or not. By default a request is considered to include JSON data if the mimetype is :mimetype:`application/json` or :mimetype:`application/*+json`. .. versionadded:: 0.11
Indicates if this request is JSON or not. By default a request is considered to include JSON data if the mimetype is :mimetype:`application/json` or :mimetype:`application/*+json`.
def is_json(self): """Indicates if this request is JSON or not. By default a request is considered to include JSON data if the mimetype is :mimetype:`application/json` or :mimetype:`application/*+json`. .. versionadded:: 0.11 """ mt = self.mimetype if mt == 'app...
[ "def", "is_json", "(", "self", ")", ":", "mt", "=", "self", ".", "mimetype", "if", "mt", "==", "'application/json'", ":", "return", "True", "if", "mt", ".", "startswith", "(", "'application/'", ")", "and", "mt", ".", "endswith", "(", "'+json'", ")", ":...
[ 110, 4 ]
[ 122, 20 ]
python
en
['en', 'en', 'en']
True
Request.get_json
(self, force=False, silent=False, cache=True)
Parses the incoming JSON request data and returns it. By default this function will return ``None`` if the mimetype is not :mimetype:`application/json` but this can be overridden by the ``force`` parameter. If parsing fails the :meth:`on_json_loading_failed` method on the request object...
Parses the incoming JSON request data and returns it. By default this function will return ``None`` if the mimetype is not :mimetype:`application/json` but this can be overridden by the ``force`` parameter. If parsing fails the :meth:`on_json_loading_failed` method on the request object...
def get_json(self, force=False, silent=False, cache=True): """Parses the incoming JSON request data and returns it. By default this function will return ``None`` if the mimetype is not :mimetype:`application/json` but this can be overridden by the ``force`` parameter. If parsing fails t...
[ "def", "get_json", "(", "self", ",", "force", "=", "False", ",", "silent", "=", "False", ",", "cache", "=", "True", ")", ":", "rv", "=", "getattr", "(", "self", ",", "'_cached_json'", ",", "_missing", ")", "# We return cached JSON only when the cache is enable...
[ 124, 4 ]
[ 164, 17 ]
python
en
['en', 'en', 'en']
True
Request.on_json_loading_failed
(self, e)
Called if decoding of the JSON data failed. The return value of this method is used by :meth:`get_json` when an error occurred. The default implementation just raises a :class:`BadRequest` exception. .. versionchanged:: 0.10 Removed buggy previous behavior of generating a random JS...
Called if decoding of the JSON data failed. The return value of this method is used by :meth:`get_json` when an error occurred. The default implementation just raises a :class:`BadRequest` exception.
def on_json_loading_failed(self, e): """Called if decoding of the JSON data failed. The return value of this method is used by :meth:`get_json` when an error occurred. The default implementation just raises a :class:`BadRequest` exception. .. versionchanged:: 0.10 Removed b...
[ "def", "on_json_loading_failed", "(", "self", ",", "e", ")", ":", "ctx", "=", "_request_ctx_stack", ".", "top", "if", "ctx", "is", "not", "None", "and", "ctx", ".", "app", ".", "config", ".", "get", "(", "'DEBUG'", ",", "False", ")", ":", "raise", "B...
[ 166, 4 ]
[ 181, 26 ]
python
en
['en', 'en', 'en']
True
UniversalDetector.reset
(self)
Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents.
Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents.
def reset(self): """ Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. """ self.result = {'encoding': None, 'confidence': 0.0...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "result", "=", "{", "'encoding'", ":", "None", ",", "'confidence'", ":", "0.0", ",", "'language'", ":", "None", "}", "self", ".", "done", "=", "False", "self", ".", "_got_data", "=", "False", "self"...
[ 93, 4 ]
[ 108, 26 ]
python
en
['en', 'error', 'th']
False
UniversalDetector.feed
(self, byte_str)
Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in...
Takes a chunk of a document and feeds it through all of the relevant charset probers.
def feed(self, byte_str): """ Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if...
[ "def", "feed", "(", "self", ",", "byte_str", ")", ":", "if", "self", ".", "done", ":", "return", "if", "not", "len", "(", "byte_str", ")", ":", "return", "if", "not", "isinstance", "(", "byte_str", ",", "bytearray", ")", ":", "byte_str", "=", "bytear...
[ 110, 4 ]
[ 217, 42 ]
python
en
['en', 'error', 'th']
False
UniversalDetector.close
(self)
Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`.
Stop analyzing the current document and come up with a final prediction.
def close(self): """ Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. """ # Don't bother with checks if we're already done ...
[ "def", "close", "(", "self", ")", ":", "# Don't bother with checks if we're already done", "if", "self", ".", "done", ":", "return", "self", ".", "result", "self", ".", "done", "=", "True", "if", "not", "self", ".", "_got_data", ":", "self", ".", "logger", ...
[ 219, 4 ]
[ 285, 26 ]
python
en
['en', 'error', 'th']
False
construct_instance
(form, instance, fields=None, exclude=None)
Construct and return a model instance from the bound ``form``'s ``cleaned_data``, but do not save the returned instance to the database.
Construct and return a model instance from the bound ``form``'s ``cleaned_data``, but do not save the returned instance to the database.
def construct_instance(form, instance, fields=None, exclude=None): """ Construct and return a model instance from the bound ``form``'s ``cleaned_data``, but do not save the returned instance to the database. """ from django.db import models opts = instance._meta cleaned_data = form.cleaned_...
[ "def", "construct_instance", "(", "form", ",", "instance", ",", "fields", "=", "None", ",", "exclude", "=", "None", ")", ":", "from", "django", ".", "db", "import", "models", "opts", "=", "instance", ".", "_meta", "cleaned_data", "=", "form", ".", "clean...
[ 31, 0 ]
[ 67, 19 ]
python
en
['en', 'error', 'th']
False
model_to_dict
(instance, fields=None, exclude=None)
Return a dict containing the data in ``instance`` suitable for passing as a Form's ``initial`` keyword argument. ``fields`` is an optional list of field names. If provided, return only the named. ``exclude`` is an optional list of field names. If provided, exclude the named from the returned ...
Return a dict containing the data in ``instance`` suitable for passing as a Form's ``initial`` keyword argument.
def model_to_dict(instance, fields=None, exclude=None): """ Return a dict containing the data in ``instance`` suitable for passing as a Form's ``initial`` keyword argument. ``fields`` is an optional list of field names. If provided, return only the named. ``exclude`` is an optional list of fie...
[ "def", "model_to_dict", "(", "instance", ",", "fields", "=", "None", ",", "exclude", "=", "None", ")", ":", "opts", "=", "instance", ".", "_meta", "data", "=", "{", "}", "for", "f", "in", "chain", "(", "opts", ".", "concrete_fields", ",", "opts", "."...
[ 72, 0 ]
[ 94, 15 ]
python
en
['en', 'error', 'th']
False
apply_limit_choices_to_to_formfield
(formfield)
Apply limit_choices_to to the formfield's queryset if needed.
Apply limit_choices_to to the formfield's queryset if needed.
def apply_limit_choices_to_to_formfield(formfield): """Apply limit_choices_to to the formfield's queryset if needed.""" from django.db.models import Exists, OuterRef, Q if hasattr(formfield, 'queryset') and hasattr(formfield, 'get_limit_choices_to'): limit_choices_to = formfield.get_limit_choices_to...
[ "def", "apply_limit_choices_to_to_formfield", "(", "formfield", ")", ":", "from", "django", ".", "db", ".", "models", "import", "Exists", ",", "OuterRef", ",", "Q", "if", "hasattr", "(", "formfield", ",", "'queryset'", ")", "and", "hasattr", "(", "formfield", ...
[ 97, 0 ]
[ 110, 13 ]
python
en
['en', 'en', 'en']
True
fields_for_model
(model, fields=None, exclude=None, widgets=None, formfield_callback=None, localized_fields=None, labels=None, help_texts=None, error_messages=None, field_classes=None, *, apply_limit_choices_to=True)
Return a dictionary containing form fields for the given model. ``fields`` is an optional list of field names. If provided, return only the named fields. ``exclude`` is an optional list of field names. If provided, exclude the named fields from the returned fields, even if they are listed in the ...
Return a dictionary containing form fields for the given model.
def fields_for_model(model, fields=None, exclude=None, widgets=None, formfield_callback=None, localized_fields=None, labels=None, help_texts=None, error_messages=None, field_classes=None, *, apply_limit_choices_to=True): """ Return a dictionary cont...
[ "def", "fields_for_model", "(", "model", ",", "fields", "=", "None", ",", "exclude", "=", "None", ",", "widgets", "=", "None", ",", "formfield_callback", "=", "None", ",", "localized_fields", "=", "None", ",", "labels", "=", "None", ",", "help_texts", "=",...
[ 113, 0 ]
[ 199, 21 ]
python
en
['en', 'error', 'th']
False
modelform_factory
(model, form=ModelForm, fields=None, exclude=None, formfield_callback=None, widgets=None, localized_fields=None, labels=None, help_texts=None, error_messages=None, field_classes=None)
Return a ModelForm containing form fields for the given model. You can optionally pass a `form` argument to use as a starting point for constructing the ModelForm. ``fields`` is an optional list of field names. If provided, include only the named fields in the returned fields. If omitted or '__all...
Return a ModelForm containing form fields for the given model. You can optionally pass a `form` argument to use as a starting point for constructing the ModelForm.
def modelform_factory(model, form=ModelForm, fields=None, exclude=None, formfield_callback=None, widgets=None, localized_fields=None, labels=None, help_texts=None, error_messages=None, field_classes=None): """ Return a ModelForm containing form f...
[ "def", "modelform_factory", "(", "model", ",", "form", "=", "ModelForm", ",", "fields", "=", "None", ",", "exclude", "=", "None", ",", "formfield_callback", "=", "None", ",", "widgets", "=", "None", ",", "localized_fields", "=", "None", ",", "labels", "=",...
[ 482, 0 ]
[ 562, 60 ]
python
en
['en', 'error', 'th']
False
modelformset_factory
(model, form=ModelForm, formfield_callback=None, formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False, localized_fields=None, lab...
Return a FormSet class for the given Django model class.
Return a FormSet class for the given Django model class.
def modelformset_factory(model, form=ModelForm, formfield_callback=None, formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False, localized_fields=None, ...
[ "def", "modelformset_factory", "(", "model", ",", "form", "=", "ModelForm", ",", "formfield_callback", "=", "None", ",", "formset", "=", "BaseModelFormSet", ",", "extra", "=", "1", ",", "can_delete", "=", "False", ",", "can_order", "=", "False", ",", "max_nu...
[ 867, 0 ]
[ 893, 18 ]
python
en
['en', 'en', 'en']
True
_get_foreign_key
(parent_model, model, fk_name=None, can_fail=False)
Find and return the ForeignKey from model to parent if there is one (return None if can_fail is True and no such field exists). If fk_name is provided, assume it is the name of the ForeignKey field. Unless can_fail is True, raise an exception if there isn't a ForeignKey from model to parent_model. ...
Find and return the ForeignKey from model to parent if there is one (return None if can_fail is True and no such field exists). If fk_name is provided, assume it is the name of the ForeignKey field. Unless can_fail is True, raise an exception if there isn't a ForeignKey from model to parent_model. ...
def _get_foreign_key(parent_model, model, fk_name=None, can_fail=False): """ Find and return the ForeignKey from model to parent if there is one (return None if can_fail is True and no such field exists). If fk_name is provided, assume it is the name of the ForeignKey field. Unless can_fail is True,...
[ "def", "_get_foreign_key", "(", "parent_model", ",", "model", ",", "fk_name", "=", "None", ",", "can_fail", "=", "False", ")", ":", "# avoid circular import", "from", "django", ".", "db", ".", "models", "import", "ForeignKey", "opts", "=", "model", ".", "_me...
[ 998, 0 ]
[ 1051, 13 ]
python
en
['en', 'error', 'th']
False
inlineformset_factory
(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None, widgets=None, validate_max=F...
Return an ``InlineFormSet`` for the given kwargs. ``fk_name`` must be provided if ``model`` has more than one ``ForeignKey`` to ``parent_model``.
Return an ``InlineFormSet`` for the given kwargs.
def inlineformset_factory(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None, wid...
[ "def", "inlineformset_factory", "(", "parent_model", ",", "model", ",", "form", "=", "ModelForm", ",", "formset", "=", "BaseInlineFormSet", ",", "fk_name", "=", "None", ",", "fields", "=", "None", ",", "exclude", "=", "None", ",", "extra", "=", "3", ",", ...
[ 1054, 0 ]
[ 1096, 18 ]
python
en
['en', 'error', 'th']
False
BaseModelForm._get_validation_exclusions
(self)
For backwards-compatibility, exclude several types of fields from model validation. See tickets #12507, #12521, #12553.
For backwards-compatibility, exclude several types of fields from model validation. See tickets #12507, #12521, #12553.
def _get_validation_exclusions(self): """ For backwards-compatibility, exclude several types of fields from model validation. See tickets #12507, #12521, #12553. """ exclude = [] # Build up a list of fields that should be excluded from model field # validation and...
[ "def", "_get_validation_exclusions", "(", "self", ")", ":", "exclude", "=", "[", "]", "# Build up a list of fields that should be excluded from model field", "# validation and unique checks.", "for", "f", "in", "self", ".", "instance", ".", "_meta", ".", "fields", ":", ...
[ 317, 4 ]
[ 356, 22 ]
python
en
['en', 'error', 'th']
False
BaseModelForm.validate_unique
(self)
Call the instance's validate_unique() method and update the form's validation errors if any were raised.
Call the instance's validate_unique() method and update the form's validation errors if any were raised.
def validate_unique(self): """ Call the instance's validate_unique() method and update the form's validation errors if any were raised. """ exclude = self._get_validation_exclusions() try: self.instance.validate_unique(exclude=exclude) except Validatio...
[ "def", "validate_unique", "(", "self", ")", ":", "exclude", "=", "self", ".", "_get_validation_exclusions", "(", ")", "try", ":", "self", ".", "instance", ".", "validate_unique", "(", "exclude", "=", "exclude", ")", "except", "ValidationError", "as", "e", ":...
[ 420, 4 ]
[ 429, 34 ]
python
en
['en', 'error', 'th']
False
BaseModelForm._save_m2m
(self)
Save the many-to-many fields and generic relations for this form.
Save the many-to-many fields and generic relations for this form.
def _save_m2m(self): """ Save the many-to-many fields and generic relations for this form. """ cleaned_data = self.cleaned_data exclude = self._meta.exclude fields = self._meta.fields opts = self.instance._meta # Note that for historical reasons we want to...
[ "def", "_save_m2m", "(", "self", ")", ":", "cleaned_data", "=", "self", ".", "cleaned_data", "exclude", "=", "self", ".", "_meta", ".", "exclude", "fields", "=", "self", ".", "_meta", ".", "fields", "opts", "=", "self", ".", "instance", ".", "_meta", "...
[ 431, 4 ]
[ 450, 69 ]
python
en
['en', 'error', 'th']
False
BaseModelForm.save
(self, commit=True)
Save this form's self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
Save this form's self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
def save(self, commit=True): """ Save this form's self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance. """ if self.errors: raise...
[ "def", "save", "(", "self", ",", "commit", "=", "True", ")", ":", "if", "self", ".", "errors", ":", "raise", "ValueError", "(", "\"The %s could not be %s because the data didn't validate.\"", "%", "(", "self", ".", "instance", ".", "_meta", ".", "object_name", ...
[ 452, 4 ]
[ 473, 28 ]
python
en
['en', 'error', 'th']
False
BaseModelFormSet.initial_form_count
(self)
Return the number of forms that are required in this FormSet.
Return the number of forms that are required in this FormSet.
def initial_form_count(self): """Return the number of forms that are required in this FormSet.""" if not self.is_bound: return len(self.get_queryset()) return super().initial_form_count()
[ "def", "initial_form_count", "(", "self", ")", ":", "if", "not", "self", ".", "is_bound", ":", "return", "len", "(", "self", ".", "get_queryset", "(", ")", ")", "return", "super", "(", ")", ".", "initial_form_count", "(", ")" ]
[ 582, 4 ]
[ 586, 43 ]
python
en
['en', 'en', 'en']
True
BaseModelFormSet._get_to_python
(self, field)
If the field is a related field, fetch the concrete field's (that is, the ultimate pointed-to field's) to_python.
If the field is a related field, fetch the concrete field's (that is, the ultimate pointed-to field's) to_python.
def _get_to_python(self, field): """ If the field is a related field, fetch the concrete field's (that is, the ultimate pointed-to field's) to_python. """ while field.remote_field is not None: field = field.remote_field.get_related_field() return field.to_pyth...
[ "def", "_get_to_python", "(", "self", ",", "field", ")", ":", "while", "field", ".", "remote_field", "is", "not", "None", ":", "field", "=", "field", ".", "remote_field", ".", "get_related_field", "(", ")", "return", "field", ".", "to_python" ]
[ 593, 4 ]
[ 600, 30 ]
python
en
['en', 'error', 'th']
False
BaseModelFormSet.save_new
(self, form, commit=True)
Save and return a new model instance for the given form.
Save and return a new model instance for the given form.
def save_new(self, form, commit=True): """Save and return a new model instance for the given form.""" return form.save(commit=commit)
[ "def", "save_new", "(", "self", ",", "form", ",", "commit", "=", "True", ")", ":", "return", "form", ".", "save", "(", "commit", "=", "commit", ")" ]
[ 655, 4 ]
[ 657, 39 ]
python
en
['en', 'en', 'en']
True
BaseModelFormSet.save_existing
(self, form, instance, commit=True)
Save and return an existing model instance for the given form.
Save and return an existing model instance for the given form.
def save_existing(self, form, instance, commit=True): """Save and return an existing model instance for the given form.""" return form.save(commit=commit)
[ "def", "save_existing", "(", "self", ",", "form", ",", "instance", ",", "commit", "=", "True", ")", ":", "return", "form", ".", "save", "(", "commit", "=", "commit", ")" ]
[ 659, 4 ]
[ 661, 39 ]
python
en
['en', 'en', 'en']
True
BaseModelFormSet.delete_existing
(self, obj, commit=True)
Deletes an existing model instance.
Deletes an existing model instance.
def delete_existing(self, obj, commit=True): """Deletes an existing model instance.""" if commit: obj.delete()
[ "def", "delete_existing", "(", "self", ",", "obj", ",", "commit", "=", "True", ")", ":", "if", "commit", ":", "obj", ".", "delete", "(", ")" ]
[ 663, 4 ]
[ 666, 24 ]
python
en
['en', 'en', 'en']
True
BaseModelFormSet.save
(self, commit=True)
Save model instances for every form, adding and changing instances as necessary, and return the list of instances.
Save model instances for every form, adding and changing instances as necessary, and return the list of instances.
def save(self, commit=True): """ Save model instances for every form, adding and changing instances as necessary, and return the list of instances. """ if not commit: self.saved_forms = [] def save_m2m(): for form in self.saved_forms: ...
[ "def", "save", "(", "self", ",", "commit", "=", "True", ")", ":", "if", "not", "commit", ":", "self", ".", "saved_forms", "=", "[", "]", "def", "save_m2m", "(", ")", ":", "for", "form", "in", "self", ".", "saved_forms", ":", "form", ".", "save_m2m"...
[ 668, 4 ]
[ 680, 81 ]
python
en
['en', 'error', 'th']
False
BaseModelFormSet.add_fields
(self, form, index)
Add a hidden field for the object's primary key.
Add a hidden field for the object's primary key.
def add_fields(self, form, index): """Add a hidden field for the object's primary key.""" from django.db.models import AutoField, ForeignKey, OneToOneField self._pk_field = pk = self.model._meta.pk # If a pk isn't editable, then it won't be on the form, so we need to # add it her...
[ "def", "add_fields", "(", "self", ",", "form", ",", "index", ")", ":", "from", "django", ".", "db", ".", "models", "import", "AutoField", ",", "ForeignKey", ",", "OneToOneField", "self", ".", "_pk_field", "=", "pk", "=", "self", ".", "model", ".", "_me...
[ 823, 4 ]
[ 864, 39 ]
python
en
['en', 'en', 'en']
True
ModelChoiceField.get_limit_choices_to
(self)
Return ``limit_choices_to`` for this form field. If it is a callable, invoke it and return the result.
Return ``limit_choices_to`` for this form field.
def get_limit_choices_to(self): """ Return ``limit_choices_to`` for this form field. If it is a callable, invoke it and return the result. """ if callable(self.limit_choices_to): return self.limit_choices_to() return self.limit_choices_to
[ "def", "get_limit_choices_to", "(", "self", ")", ":", "if", "callable", "(", "self", ".", "limit_choices_to", ")", ":", "return", "self", ".", "limit_choices_to", "(", ")", "return", "self", ".", "limit_choices_to" ]
[ 1218, 4 ]
[ 1226, 36 ]
python
en
['en', 'error', 'th']
False
ModelChoiceField.label_from_instance
(self, obj)
Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.
Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.
def label_from_instance(self, obj): """ Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices. """ return str(obj)
[ "def", "label_from_instance", "(", "self", ",", "obj", ")", ":", "return", "str", "(", "obj", ")" ]
[ 1246, 4 ]
[ 1252, 23 ]
python
en
['en', 'error', 'th']
False
ModelMultipleChoiceField._check_values
(self, value)
Given a list of possible PK values, return a QuerySet of the corresponding objects. Raise a ValidationError if a given value is invalid (not a valid PK, not in the queryset, etc.)
Given a list of possible PK values, return a QuerySet of the corresponding objects. Raise a ValidationError if a given value is invalid (not a valid PK, not in the queryset, etc.)
def _check_values(self, value): """ Given a list of possible PK values, return a QuerySet of the corresponding objects. Raise a ValidationError if a given value is invalid (not a valid PK, not in the queryset, etc.) """ key = self.to_field_name or 'pk' # deduplica...
[ "def", "_check_values", "(", "self", ",", "value", ")", ":", "key", "=", "self", ".", "to_field_name", "or", "'pk'", "# deduplicate given values to avoid creating many querysets or", "# requiring the database backend deduplicate efficiently.", "try", ":", "value", "=", "fro...
[ 1345, 4 ]
[ 1380, 17 ]
python
en
['en', 'error', 'th']
False
BaseRequest.url_charset
(self)
The charset that is assumed for URLs. Defaults to the value of :attr:`charset`. .. versionadded:: 0.6
The charset that is assumed for URLs. Defaults to the value of :attr:`charset`.
def url_charset(self): """The charset that is assumed for URLs. Defaults to the value of :attr:`charset`. .. versionadded:: 0.6 """ return self.charset
[ "def", "url_charset", "(", "self", ")", ":", "return", "self", ".", "charset" ]
[ 169, 4 ]
[ 175, 27 ]
python
en
['en', 'en', 'en']
True
BaseRequest.from_values
(cls, *args, **kwargs)
Create a new request object based on the values provided. If environ is given missing values are filled from there. This method is useful for small scripts when you need to simulate a request from an URL. Do not use this method for unittesting, there is a full featured client object (:...
Create a new request object based on the values provided. If environ is given missing values are filled from there. This method is useful for small scripts when you need to simulate a request from an URL. Do not use this method for unittesting, there is a full featured client object (:...
def from_values(cls, *args, **kwargs): """Create a new request object based on the values provided. If environ is given missing values are filled from there. This method is useful for small scripts when you need to simulate a request from an URL. Do not use this method for unittesting,...
[ "def", "from_values", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "test", "import", "EnvironBuilder", "charset", "=", "kwargs", ".", "pop", "(", "\"charset\"", ",", "cls", ".", "charset", ")", "kwargs", "[", "\"...
[ 178, 4 ]
[ 204, 27 ]
python
en
['en', 'en', 'en']
True
BaseRequest.application
(cls, f)
Decorate a function as responder that accepts the request as the last argument. This works like the :func:`responder` decorator but the function is passed the request object as the last argument and the request object will be closed automatically:: @Request.application ...
Decorate a function as responder that accepts the request as the last argument. This works like the :func:`responder` decorator but the function is passed the request object as the last argument and the request object will be closed automatically::
def application(cls, f): """Decorate a function as responder that accepts the request as the last argument. This works like the :func:`responder` decorator but the function is passed the request object as the last argument and the request object will be closed automatically:: ...
[ "def", "application", "(", "cls", ",", "f", ")", ":", "#: return a callable that wraps the -2nd argument with the request", "#: and calls the function with all the arguments up to that one and", "#: the request. The return value is then called with the latest", "#: two arguments. This makes ...
[ 207, 4 ]
[ 241, 45 ]
python
en
['en', 'en', 'en']
True
BaseRequest._get_file_stream
( self, total_content_length, content_type, filename=None, content_length=None )
Called to get a stream for the file upload. This must provide a file-like class with `read()`, `readline()` and `seek()` methods that is both writeable and readable. The default implementation returns a temporary file if the total content length is higher than 500KB. Because many brow...
Called to get a stream for the file upload.
def _get_file_stream( self, total_content_length, content_type, filename=None, content_length=None ): """Called to get a stream for the file upload. This must provide a file-like class with `read()`, `readline()` and `seek()` methods that is both writeable and readable. The...
[ "def", "_get_file_stream", "(", "self", ",", "total_content_length", ",", "content_type", ",", "filename", "=", "None", ",", "content_length", "=", "None", ")", ":", "return", "default_stream_factory", "(", "total_content_length", "=", "total_content_length", ",", "...
[ 243, 4 ]
[ 270, 9 ]
python
en
['en', 'en', 'en']
True
BaseRequest.want_form_data_parsed
(self)
Returns True if the request method carries content. As of Werkzeug 0.9 this will be the case if a content type is transmitted. .. versionadded:: 0.8
Returns True if the request method carries content. As of Werkzeug 0.9 this will be the case if a content type is transmitted.
def want_form_data_parsed(self): """Returns True if the request method carries content. As of Werkzeug 0.9 this will be the case if a content type is transmitted. .. versionadded:: 0.8 """ return bool(self.environ.get("CONTENT_TYPE"))
[ "def", "want_form_data_parsed", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "environ", ".", "get", "(", "\"CONTENT_TYPE\"", ")", ")" ]
[ 273, 4 ]
[ 279, 53 ]
python
en
['en', 'en', 'en']
True
BaseRequest.make_form_data_parser
(self)
Creates the form data parser. Instantiates the :attr:`form_data_parser_class` with some parameters. .. versionadded:: 0.8
Creates the form data parser. Instantiates the :attr:`form_data_parser_class` with some parameters.
def make_form_data_parser(self): """Creates the form data parser. Instantiates the :attr:`form_data_parser_class` with some parameters. .. versionadded:: 0.8 """ return self.form_data_parser_class( self._get_file_stream, self.charset, self.enc...
[ "def", "make_form_data_parser", "(", "self", ")", ":", "return", "self", ".", "form_data_parser_class", "(", "self", ".", "_get_file_stream", ",", "self", ".", "charset", ",", "self", ".", "encoding_errors", ",", "self", ".", "max_form_memory_size", ",", "self",...
[ 281, 4 ]
[ 294, 9 ]
python
en
['en', 'en', 'en']
True
BaseRequest._load_form_data
(self)
Method used internally to retrieve submitted data. After calling this sets `form` and `files` on the request object to multi dicts filled with the incoming form data. As a matter of fact the input stream will be empty afterwards. You can also call this method to force the parsing of t...
Method used internally to retrieve submitted data. After calling this sets `form` and `files` on the request object to multi dicts filled with the incoming form data. As a matter of fact the input stream will be empty afterwards. You can also call this method to force the parsing of t...
def _load_form_data(self): """Method used internally to retrieve submitted data. After calling this sets `form` and `files` on the request object to multi dicts filled with the incoming form data. As a matter of fact the input stream will be empty afterwards. You can also call this me...
[ "def", "_load_form_data", "(", "self", ")", ":", "# abort early if we have already consumed the stream", "if", "\"form\"", "in", "self", ".", "__dict__", ":", "return", "_assert_not_shallow", "(", "self", ")", "if", "self", ".", "want_form_data_parsed", ":", "content_...
[ 296, 4 ]
[ 329, 49 ]
python
en
['en', 'en', 'en']
True
BaseRequest._get_stream_for_parsing
(self)
This is the same as accessing :attr:`stream` with the difference that if it finds cached data from calling :meth:`get_data` first it will create a new stream out of the cached data. .. versionadded:: 0.9.3
This is the same as accessing :attr:`stream` with the difference that if it finds cached data from calling :meth:`get_data` first it will create a new stream out of the cached data.
def _get_stream_for_parsing(self): """This is the same as accessing :attr:`stream` with the difference that if it finds cached data from calling :meth:`get_data` first it will create a new stream out of the cached data. .. versionadded:: 0.9.3 """ cached_data = getattr(s...
[ "def", "_get_stream_for_parsing", "(", "self", ")", ":", "cached_data", "=", "getattr", "(", "self", ",", "\"_cached_data\"", ",", "None", ")", "if", "cached_data", "is", "not", "None", ":", "return", "BytesIO", "(", "cached_data", ")", "return", "self", "."...
[ 331, 4 ]
[ 341, 26 ]
python
en
['en', 'en', 'en']
True
BaseRequest.close
(self)
Closes associated resources of this request object. This closes all file handles explicitly. You can also use the request object in a with statement which will automatically close it. .. versionadded:: 0.9
Closes associated resources of this request object. This closes all file handles explicitly. You can also use the request object in a with statement which will automatically close it.
def close(self): """Closes associated resources of this request object. This closes all file handles explicitly. You can also use the request object in a with statement which will automatically close it. .. versionadded:: 0.9 """ files = self.__dict__.get("files") ...
[ "def", "close", "(", "self", ")", ":", "files", "=", "self", ".", "__dict__", ".", "get", "(", "\"files\"", ")", "for", "_key", ",", "value", "in", "iter_multi_items", "(", "files", "or", "(", ")", ")", ":", "value", ".", "close", "(", ")" ]
[ 343, 4 ]
[ 352, 25 ]
python
en
['en', 'en', 'en']
True
BaseRequest.stream
(self)
If the incoming form data was not encoded with a known mimetype the data is stored unmodified in this stream for consumption. Most of the time it is a better idea to use :attr:`data` which will give you that data as a string. The stream only returns the data once. Unlike :att...
If the incoming form data was not encoded with a known mimetype the data is stored unmodified in this stream for consumption. Most of the time it is a better idea to use :attr:`data` which will give you that data as a string. The stream only returns the data once.
def stream(self): """ If the incoming form data was not encoded with a known mimetype the data is stored unmodified in this stream for consumption. Most of the time it is a better idea to use :attr:`data` which will give you that data as a string. The stream only returns the da...
[ "def", "stream", "(", "self", ")", ":", "_assert_not_shallow", "(", "self", ")", "return", "get_input_stream", "(", "self", ".", "environ", ")" ]
[ 361, 4 ]
[ 379, 45 ]
python
en
['en', 'error', 'th']
False
BaseRequest.args
(self)
The parsed URL parameters (the part in the URL after the question mark). By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different type. This might be...
The parsed URL parameters (the part in the URL after the question mark).
def args(self): """The parsed URL parameters (the part in the URL after the question mark). By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different t...
[ "def", "args", "(", "self", ")", ":", "return", "url_decode", "(", "wsgi_get_bytes", "(", "self", ".", "environ", ".", "get", "(", "\"QUERY_STRING\"", ",", "\"\"", ")", ")", ",", "self", ".", "url_charset", ",", "errors", "=", "self", ".", "encoding_erro...
[ 391, 4 ]
[ 406, 9 ]
python
en
['en', 'en', 'en']
True
BaseRequest.data
(self)
Contains the incoming request data as string in case it came with a mimetype Werkzeug does not handle.
Contains the incoming request data as string in case it came with a mimetype Werkzeug does not handle.
def data(self): """ Contains the incoming request data as string in case it came with a mimetype Werkzeug does not handle. """ if self.disable_data_descriptor: raise AttributeError("data descriptor is disabled") # XXX: this should eventually be deprecated. ...
[ "def", "data", "(", "self", ")", ":", "if", "self", ".", "disable_data_descriptor", ":", "raise", "AttributeError", "(", "\"data descriptor is disabled\"", ")", "# XXX: this should eventually be deprecated.", "# We trigger form data parsing first which means that the descriptor", ...
[ 409, 4 ]
[ 424, 50 ]
python
en
['en', 'error', 'th']
False
BaseRequest.get_data
(self, cache=True, as_text=False, parse_form_data=False)
This reads the buffered incoming data from the client into one bytestring. By default this is cached but that behavior can be changed by setting `cache` to `False`. Usually it's a bad idea to call this method without checking the content length first as a client could send dozens of me...
This reads the buffered incoming data from the client into one bytestring. By default this is cached but that behavior can be changed by setting `cache` to `False`.
def get_data(self, cache=True, as_text=False, parse_form_data=False): """This reads the buffered incoming data from the client into one bytestring. By default this is cached but that behavior can be changed by setting `cache` to `False`. Usually it's a bad idea to call this method with...
[ "def", "get_data", "(", "self", ",", "cache", "=", "True", ",", "as_text", "=", "False", ",", "parse_form_data", "=", "False", ")", ":", "rv", "=", "getattr", "(", "self", ",", "\"_cached_data\"", ",", "None", ")", "if", "rv", "is", "None", ":", "if"...
[ 426, 4 ]
[ 460, 17 ]
python
en
['en', 'en', 'en']
True
BaseRequest.form
(self)
The form parameters. By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different type. This might be necessary if the order of the form data is important. Plea...
The form parameters. By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different type. This might be necessary if the order of the form data is important.
def form(self): """The form parameters. By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different type. This might be necessary if the order of the form data ...
[ "def", "form", "(", "self", ")", ":", "self", ".", "_load_form_data", "(", ")", "return", "self", ".", "form" ]
[ 463, 4 ]
[ 479, 24 ]
python
en
['en', 'en', 'en']
True
BaseRequest.values
(self)
A :class:`werkzeug.datastructures.CombinedMultiDict` that combines :attr:`args` and :attr:`form`.
A :class:`werkzeug.datastructures.CombinedMultiDict` that combines :attr:`args` and :attr:`form`.
def values(self): """A :class:`werkzeug.datastructures.CombinedMultiDict` that combines :attr:`args` and :attr:`form`.""" args = [] for d in self.args, self.form: if not isinstance(d, MultiDict): d = MultiDict(d) args.append(d) return Combi...
[ "def", "values", "(", "self", ")", ":", "args", "=", "[", "]", "for", "d", "in", "self", ".", "args", ",", "self", ".", "form", ":", "if", "not", "isinstance", "(", "d", ",", "MultiDict", ")", ":", "d", "=", "MultiDict", "(", "d", ")", "args", ...
[ 482, 4 ]
[ 490, 38 ]
python
en
['en', 'fr', 'en']
True
BaseRequest.files
(self)
:class:`~werkzeug.datastructures.MultiDict` object containing all uploaded files. Each key in :attr:`files` is the name from the ``<input type="file" name="">``. Each value in :attr:`files` is a Werkzeug :class:`~werkzeug.datastructures.FileStorage` object. It basically behaves like a...
:class:`~werkzeug.datastructures.MultiDict` object containing all uploaded files. Each key in :attr:`files` is the name from the ``<input type="file" name="">``. Each value in :attr:`files` is a Werkzeug :class:`~werkzeug.datastructures.FileStorage` object.
def files(self): """:class:`~werkzeug.datastructures.MultiDict` object containing all uploaded files. Each key in :attr:`files` is the name from the ``<input type="file" name="">``. Each value in :attr:`files` is a Werkzeug :class:`~werkzeug.datastructures.FileStorage` object. ...
[ "def", "files", "(", "self", ")", ":", "self", ".", "_load_form_data", "(", ")", "return", "self", ".", "files" ]
[ 493, 4 ]
[ 513, 25 ]
python
de
['de', 'en', 'de']
True
BaseRequest.cookies
(self)
A :class:`dict` with the contents of all cookies transmitted with the request.
A :class:`dict` with the contents of all cookies transmitted with the request.
def cookies(self): """A :class:`dict` with the contents of all cookies transmitted with the request.""" return parse_cookie( self.environ, self.charset, self.encoding_errors, cls=self.dict_storage_class, )
[ "def", "cookies", "(", "self", ")", ":", "return", "parse_cookie", "(", "self", ".", "environ", ",", "self", ".", "charset", ",", "self", ".", "encoding_errors", ",", "cls", "=", "self", ".", "dict_storage_class", ",", ")" ]
[ 516, 4 ]
[ 524, 9 ]
python
en
['en', 'en', 'en']
True
BaseRequest.headers
(self)
The headers from the WSGI environ as immutable :class:`~werkzeug.datastructures.EnvironHeaders`.
The headers from the WSGI environ as immutable :class:`~werkzeug.datastructures.EnvironHeaders`.
def headers(self): """The headers from the WSGI environ as immutable :class:`~werkzeug.datastructures.EnvironHeaders`. """ return EnvironHeaders(self.environ)
[ "def", "headers", "(", "self", ")", ":", "return", "EnvironHeaders", "(", "self", ".", "environ", ")" ]
[ 527, 4 ]
[ 531, 43 ]
python
en
['en', 'en', 'en']
True
BaseRequest.path
(self)
Requested path as unicode. This works a bit like the regular path info in the WSGI environment but will always include a leading slash, even if the URL root is accessed.
Requested path as unicode. This works a bit like the regular path info in the WSGI environment but will always include a leading slash, even if the URL root is accessed.
def path(self): """Requested path as unicode. This works a bit like the regular path info in the WSGI environment but will always include a leading slash, even if the URL root is accessed. """ raw_path = wsgi_decoding_dance( self.environ.get("PATH_INFO") or "", self....
[ "def", "path", "(", "self", ")", ":", "raw_path", "=", "wsgi_decoding_dance", "(", "self", ".", "environ", ".", "get", "(", "\"PATH_INFO\"", ")", "or", "\"\"", ",", "self", ".", "charset", ",", "self", ".", "encoding_errors", ")", "return", "\"/\"", "+",...
[ 534, 4 ]
[ 542, 41 ]
python
en
['en', 'en', 'en']
True
BaseRequest.full_path
(self)
Requested path as unicode, including the query string.
Requested path as unicode, including the query string.
def full_path(self): """Requested path as unicode, including the query string.""" return self.path + u"?" + to_unicode(self.query_string, self.url_charset)
[ "def", "full_path", "(", "self", ")", ":", "return", "self", ".", "path", "+", "u\"?\"", "+", "to_unicode", "(", "self", ".", "query_string", ",", "self", ".", "url_charset", ")" ]
[ 545, 4 ]
[ 547, 81 ]
python
en
['en', 'en', 'en']
True
BaseRequest.script_root
(self)
The root path of the script without the trailing slash.
The root path of the script without the trailing slash.
def script_root(self): """The root path of the script without the trailing slash.""" raw_path = wsgi_decoding_dance( self.environ.get("SCRIPT_NAME") or "", self.charset, self.encoding_errors ) return raw_path.rstrip("/")
[ "def", "script_root", "(", "self", ")", ":", "raw_path", "=", "wsgi_decoding_dance", "(", "self", ".", "environ", ".", "get", "(", "\"SCRIPT_NAME\"", ")", "or", "\"\"", ",", "self", ".", "charset", ",", "self", ".", "encoding_errors", ")", "return", "raw_p...
[ 550, 4 ]
[ 555, 35 ]
python
en
['en', 'en', 'en']
True
BaseRequest.url
(self)
The reconstructed current URL as IRI. See also: :attr:`trusted_hosts`.
The reconstructed current URL as IRI. See also: :attr:`trusted_hosts`.
def url(self): """The reconstructed current URL as IRI. See also: :attr:`trusted_hosts`. """ return get_current_url(self.environ, trusted_hosts=self.trusted_hosts)
[ "def", "url", "(", "self", ")", ":", "return", "get_current_url", "(", "self", ".", "environ", ",", "trusted_hosts", "=", "self", ".", "trusted_hosts", ")" ]
[ 558, 4 ]
[ 562, 78 ]
python
en
['en', 'en', 'en']
True
BaseRequest.base_url
(self)
Like :attr:`url` but without the querystring See also: :attr:`trusted_hosts`.
Like :attr:`url` but without the querystring See also: :attr:`trusted_hosts`.
def base_url(self): """Like :attr:`url` but without the querystring See also: :attr:`trusted_hosts`. """ return get_current_url( self.environ, strip_querystring=True, trusted_hosts=self.trusted_hosts )
[ "def", "base_url", "(", "self", ")", ":", "return", "get_current_url", "(", "self", ".", "environ", ",", "strip_querystring", "=", "True", ",", "trusted_hosts", "=", "self", ".", "trusted_hosts", ")" ]
[ 565, 4 ]
[ 571, 9 ]
python
en
['en', 'en', 'en']
True
BaseRequest.url_root
(self)
The full URL root (with hostname), this is the application root as IRI. See also: :attr:`trusted_hosts`.
The full URL root (with hostname), this is the application root as IRI. See also: :attr:`trusted_hosts`.
def url_root(self): """The full URL root (with hostname), this is the application root as IRI. See also: :attr:`trusted_hosts`. """ return get_current_url(self.environ, True, trusted_hosts=self.trusted_hosts)
[ "def", "url_root", "(", "self", ")", ":", "return", "get_current_url", "(", "self", ".", "environ", ",", "True", ",", "trusted_hosts", "=", "self", ".", "trusted_hosts", ")" ]
[ 574, 4 ]
[ 579, 84 ]
python
en
['en', 'en', 'en']
True
BaseRequest.host_url
(self)
Just the host with scheme as IRI. See also: :attr:`trusted_hosts`.
Just the host with scheme as IRI. See also: :attr:`trusted_hosts`.
def host_url(self): """Just the host with scheme as IRI. See also: :attr:`trusted_hosts`. """ return get_current_url( self.environ, host_only=True, trusted_hosts=self.trusted_hosts )
[ "def", "host_url", "(", "self", ")", ":", "return", "get_current_url", "(", "self", ".", "environ", ",", "host_only", "=", "True", ",", "trusted_hosts", "=", "self", ".", "trusted_hosts", ")" ]
[ 582, 4 ]
[ 588, 9 ]
python
en
['en', 'en', 'en']
True
BaseRequest.host
(self)
Just the host including the port if available. See also: :attr:`trusted_hosts`.
Just the host including the port if available. See also: :attr:`trusted_hosts`.
def host(self): """Just the host including the port if available. See also: :attr:`trusted_hosts`. """ return get_host(self.environ, trusted_hosts=self.trusted_hosts)
[ "def", "host", "(", "self", ")", ":", "return", "get_host", "(", "self", ".", "environ", ",", "trusted_hosts", "=", "self", ".", "trusted_hosts", ")" ]
[ 591, 4 ]
[ 595, 71 ]
python
en
['en', 'en', 'en']
True
BaseRequest.access_route
(self)
If a forwarded header exists this is a list of all ip addresses from the client ip to the last proxy server.
If a forwarded header exists this is a list of all ip addresses from the client ip to the last proxy server.
def access_route(self): """If a forwarded header exists this is a list of all ip addresses from the client ip to the last proxy server. """ if "HTTP_X_FORWARDED_FOR" in self.environ: addr = self.environ["HTTP_X_FORWARDED_FOR"].split(",") return self.list_storage_c...
[ "def", "access_route", "(", "self", ")", ":", "if", "\"HTTP_X_FORWARDED_FOR\"", "in", "self", ".", "environ", ":", "addr", "=", "self", ".", "environ", "[", "\"HTTP_X_FORWARDED_FOR\"", "]", ".", "split", "(", "\",\"", ")", "return", "self", ".", "list_storag...
[ 613, 4 ]
[ 622, 40 ]
python
en
['en', 'en', 'en']
True
BaseRequest.remote_addr
(self)
The remote address of the client.
The remote address of the client.
def remote_addr(self): """The remote address of the client.""" return self.environ.get("REMOTE_ADDR")
[ "def", "remote_addr", "(", "self", ")", ":", "return", "self", ".", "environ", ".", "get", "(", "\"REMOTE_ADDR\"", ")" ]
[ 625, 4 ]
[ 627, 46 ]
python
en
['en', 'en', 'en']
True
BaseRequest.is_xhr
(self)
True if the request was triggered via a JavaScript XMLHttpRequest. This only works with libraries that support the ``X-Requested-With`` header and set it to "XMLHttpRequest". Libraries that do that are prototype, jQuery and Mochikit and probably some more. .. deprecated:: 0.13 ...
True if the request was triggered via a JavaScript XMLHttpRequest. This only works with libraries that support the ``X-Requested-With`` header and set it to "XMLHttpRequest". Libraries that do that are prototype, jQuery and Mochikit and probably some more.
def is_xhr(self): """True if the request was triggered via a JavaScript XMLHttpRequest. This only works with libraries that support the ``X-Requested-With`` header and set it to "XMLHttpRequest". Libraries that do that are prototype, jQuery and Mochikit and probably some more. ...
[ "def", "is_xhr", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"'Request.is_xhr' is deprecated as of version 0.13 and will\"", "\" be removed in version 1.0. The 'X-Requested-With' header\"", "\" is not standard and is unreliable. You may be able to use\"", "\" 'accept_mimetypes' ...
[ 645, 4 ]
[ 664, 88 ]
python
en
['en', 'en', 'en']
True
linux_distribution
(full_distribution_name=True)
Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`distro.name`. * ``version``: The result of :func:`distr...
Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows:
def linux_distribution(full_distribution_name=True): """ Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`d...
[ "def", "linux_distribution", "(", "full_distribution_name", "=", "True", ")", ":", "return", "_distro", ".", "linux_distribution", "(", "full_distribution_name", ")" ]
[ 99, 0 ]
[ 124, 61 ]
python
en
['en', 'error', 'th']
False
id
()
Return the distro ID of the current distribution, as a machine-readable string. For a number of OS distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maintains the followin...
Return the distro ID of the current distribution, as a machine-readable string.
def id(): """ Return the distro ID of the current distribution, as a machine-readable string. For a number of OS distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maint...
[ "def", "id", "(", ")", ":", "return", "_distro", ".", "id", "(", ")" ]
[ 127, 0 ]
[ 203, 23 ]
python
en
['en', 'error', 'th']
False
name
(pretty=False)
Return the name of the current OS distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Core)") **Lookup hierarchy:*...
Return the name of the current OS distribution, as a human-readable string.
def name(pretty=False): """ Return the name of the current OS distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Co...
[ "def", "name", "(", "pretty", "=", "False", ")", ":", "return", "_distro", ".", "name", "(", "pretty", ")" ]
[ 206, 0 ]
[ 242, 31 ]
python
en
['en', 'error', 'th']
False
version
(pretty=False, best=False)
Return the version of the current OS distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty (e.g. "7.0 (Maipo)"). Some distributions ...
Return the version of the current OS distribution, as a human-readable string.
def version(pretty=False, best=False): """ Return the version of the current OS distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty ...
[ "def", "version", "(", "pretty", "=", "False", ",", "best", "=", "False", ")", ":", "return", "_distro", ".", "version", "(", "pretty", ",", "best", ")" ]
[ 245, 0 ]
[ 286, 40 ]
python
en
['en', 'error', 'th']
False
version_parts
(best=False)
Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The result of :func:`distro.build_number`....
Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows:
def version_parts(best=False): """ Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The ...
[ "def", "version_parts", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "version_parts", "(", "best", ")" ]
[ 289, 0 ]
[ 303, 38 ]
python
en
['en', 'error', 'th']
False
major_version
(best=False)
Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method.
Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string.
def major_version(best=False): """ Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distr...
[ "def", "major_version", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "major_version", "(", "best", ")" ]
[ 306, 0 ]
[ 316, 38 ]
python
en
['en', 'error', 'th']
False
minor_version
(best=False)
Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method.
Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string.
def minor_version(best=False): """ Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`dist...
[ "def", "minor_version", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "minor_version", "(", "best", ")" ]
[ 319, 0 ]
[ 329, 38 ]
python
en
['en', 'error', 'th']
False
build_number
(best=False)
Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method.
Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string.
def build_number(best=False): """ Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.v...
[ "def", "build_number", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "build_number", "(", "best", ")" ]
[ 332, 0 ]
[ 342, 37 ]
python
en
['en', 'error', 'th']
False
like
()
Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This information item is only...
Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from.
def like(): """ Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This infor...
[ "def", "like", "(", ")", ":", "return", "_distro", ".", "like", "(", ")" ]
[ 345, 0 ]
[ 359, 25 ]
python
en
['en', 'error', 'th']
False
codename
()
Return the codename for the release of the current OS distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function does not handle such ...
Return the codename for the release of the current OS distribution, as a string.
def codename(): """ Return the codename for the release of the current OS distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function...
[ "def", "codename", "(", ")", ":", "return", "_distro", ".", "codename", "(", ")" ]
[ 362, 0 ]
[ 383, 29 ]
python
en
['en', 'error', 'th']
False
info
(pretty=False, best=False)
Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { 'major': '7', 'mi...
Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example:
def info(pretty=False, best=False): """ Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { ...
[ "def", "info", "(", "pretty", "=", "False", ",", "best", "=", "False", ")", ":", "return", "_distro", ".", "info", "(", "pretty", ",", "best", ")" ]
[ 386, 0 ]
[ 427, 37 ]
python
en
['en', 'error', 'th']
False
os_release_info
()
Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution. See `os-release file`_ for details about these information items.
Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution.
def os_release_info(): """ Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution. See `os-release file`_ for details about these information items. """ return _distro.os_release_info()
[ "def", "os_release_info", "(", ")", ":", "return", "_distro", ".", "os_release_info", "(", ")" ]
[ 430, 0 ]
[ 437, 36 ]
python
en
['en', 'error', 'th']
False
lsb_release_info
()
Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution. See `lsb_release command output`_ for details about these information items.
Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution.
def lsb_release_info(): """ Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution. See `lsb_release command output`_ for details about these information items. """ return _distro.lsb_release_info()
[ "def", "lsb_release_info", "(", ")", ":", "return", "_distro", ".", "lsb_release_info", "(", ")" ]
[ 440, 0 ]
[ 448, 37 ]
python
en
['en', 'error', 'th']
False
distro_release_info
()
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. See `distro release file`_ for details about these information items.
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution.
def distro_release_info(): """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. See `distro release file`_ for details about these information items. """ return _distro.distro_release_info()
[ "def", "distro_release_info", "(", ")", ":", "return", "_distro", ".", "distro_release_info", "(", ")" ]
[ 451, 0 ]
[ 458, 40 ]
python
en
['en', 'error', 'th']
False
uname_info
()
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution.
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution.
def uname_info(): """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. """ return _distro.uname_info()
[ "def", "uname_info", "(", ")", ":", "return", "_distro", ".", "uname_info", "(", ")" ]
[ 461, 0 ]
[ 466, 31 ]
python
en
['en', 'error', 'th']
False
os_release_attr
(attribute)
Return a single named information item from the os-release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not...
Return a single named information item from the os-release file data source of the current OS distribution.
def os_release_attr(attribute): """ Return a single named information item from the os-release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. ...
[ "def", "os_release_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "os_release_attr", "(", "attribute", ")" ]
[ 469, 0 ]
[ 485, 45 ]
python
en
['en', 'error', 'th']
False
lsb_release_attr
(attribute)
Return a single named information item from the lsb_release command output data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the it...
Return a single named information item from the lsb_release command output data source of the current OS distribution.
def lsb_release_attr(attribute): """ Return a single named information item from the lsb_release command output data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item e...
[ "def", "lsb_release_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "lsb_release_attr", "(", "attribute", ")" ]
[ 488, 0 ]
[ 505, 46 ]
python
en
['en', 'error', 'th']
False
distro_release_attr
(attribute)
Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does...
Return a single named information item from the distro release file data source of the current OS distribution.
def distro_release_attr(attribute): """ Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exist...
[ "def", "distro_release_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "distro_release_attr", "(", "attribute", ")" ]
[ 508, 0 ]
[ 524, 49 ]
python
en
['en', 'error', 'th']
False
uname_attr
(attribute)
Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the...
Return a single named information item from the distro release file data source of the current OS distribution.
def uname_attr(attribute): """ Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. ...
[ "def", "uname_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "uname_attr", "(", "attribute", ")" ]
[ 527, 0 ]
[ 541, 40 ]
python
en
['en', 'error', 'th']
False