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
WizardView.get_form_list
(self)
This method returns a form_list based on the initial form list but checks if there is a condition method/value in the condition_list. If an entry exists in the condition list, it will call/read the value and respect the result. (True means add the form, False means ignore the fo...
This method returns a form_list based on the initial form list but checks if there is a condition method/value in the condition_list. If an entry exists in the condition list, it will call/read the value and respect the result. (True means add the form, False means ignore the fo...
def get_form_list(self): """ This method returns a form_list based on the initial form list but checks if there is a condition method/value in the condition_list. If an entry exists in the condition list, it will call/read the value and respect the result. (True means add the for...
[ "def", "get_form_list", "(", "self", ")", ":", "form_list", "=", "OrderedDict", "(", ")", "for", "form_key", ",", "form_class", "in", "six", ".", "iteritems", "(", "self", ".", "form_list", ")", ":", "# try to fetch the value from condition list, by default, the for...
[ 198, 4 ]
[ 219, 24 ]
python
en
['en', 'error', 'th']
False
WizardView.dispatch
(self, request, *args, **kwargs)
This method gets called by the routing engine. The first argument is `request` which contains a `HttpRequest` instance. The request is stored in `self.request` for later use. The storage instance is stored in `self.storage`. After processing the request using the `dispatch` met...
This method gets called by the routing engine. The first argument is `request` which contains a `HttpRequest` instance. The request is stored in `self.request` for later use. The storage instance is stored in `self.storage`.
def dispatch(self, request, *args, **kwargs): """ This method gets called by the routing engine. The first argument is `request` which contains a `HttpRequest` instance. The request is stored in `self.request` for later use. The storage instance is stored in `self.storage`. ...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# add the storage engine to the current wizardview instance", "self", ".", "prefix", "=", "self", ".", "get_prefix", "(", "*", "args", ",", "*", "*", "kwarg...
[ 221, 4 ]
[ 240, 23 ]
python
en
['en', 'error', 'th']
False
WizardView.get
(self, request, *args, **kwargs)
This method handles GET requests. If a GET request reaches this point, the wizard assumes that the user just starts at the first step or wants to restart the process. The data of the wizard will be resetted before rendering the first step.
This method handles GET requests.
def get(self, request, *args, **kwargs): """ This method handles GET requests. If a GET request reaches this point, the wizard assumes that the user just starts at the first step or wants to restart the process. The data of the wizard will be resetted before rendering the first ...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "storage", ".", "reset", "(", ")", "# reset the current step to the first step.", "self", ".", "storage", ".", "current_step", "=", "self", ".", ...
[ 242, 4 ]
[ 254, 43 ]
python
en
['en', 'error', 'th']
False
WizardView.post
(self, *args, **kwargs)
This method handles POST requests. The wizard will render either the current step (if form validation wasn't successful), the next step (if the current step was stored successful) or the done view (if no more steps are available)
This method handles POST requests.
def post(self, *args, **kwargs): """ This method handles POST requests. The wizard will render either the current step (if form validation wasn't successful), the next step (if the current step was stored successful) or the done view (if no more steps are available) """ ...
[ "def", "post", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Look for a wizard_goto_step element in the posted data which", "# contains a valid step name. If one was found, render the requested", "# form. (This makes stepping back a lot easier).", "wizard_goto_...
[ 256, 4 ]
[ 301, 32 ]
python
en
['en', 'error', 'th']
False
WizardView.render_next_step
(self, form, **kwargs)
This method gets called when the next step/form should be rendered. `form` contains the last/current form.
This method gets called when the next step/form should be rendered. `form` contains the last/current form.
def render_next_step(self, form, **kwargs): """ This method gets called when the next step/form should be rendered. `form` contains the last/current form. """ # get the form instance based on the data from the storage backend # (if available). next_step = self.ste...
[ "def", "render_next_step", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "# get the form instance based on the data from the storage backend", "# (if available).", "next_step", "=", "self", ".", "steps", ".", "next", "new_form", "=", "self", ".", "get...
[ 303, 4 ]
[ 317, 46 ]
python
en
['en', 'error', 'th']
False
WizardView.render_goto_step
(self, goto_step, **kwargs)
This method gets called when the current step has to be changed. `goto_step` contains the requested step to go to.
This method gets called when the current step has to be changed. `goto_step` contains the requested step to go to.
def render_goto_step(self, goto_step, **kwargs): """ This method gets called when the current step has to be changed. `goto_step` contains the requested step to go to. """ self.storage.current_step = goto_step form = self.get_form( data=self.storage.get_step_d...
[ "def", "render_goto_step", "(", "self", ",", "goto_step", ",", "*", "*", "kwargs", ")", ":", "self", ".", "storage", ".", "current_step", "=", "goto_step", "form", "=", "self", ".", "get_form", "(", "data", "=", "self", ".", "storage", ".", "get_step_dat...
[ 319, 4 ]
[ 328, 32 ]
python
en
['en', 'error', 'th']
False
WizardView.render_done
(self, form, **kwargs)
This method gets called when all forms passed. The method should also re-validate all steps to prevent manipulation. If any form fails to validate, `render_revalidation_failure` should get called. If everything is fine call `done`.
This method gets called when all forms passed. The method should also re-validate all steps to prevent manipulation. If any form fails to validate, `render_revalidation_failure` should get called. If everything is fine call `done`.
def render_done(self, form, **kwargs): """ This method gets called when all forms passed. The method should also re-validate all steps to prevent manipulation. If any form fails to validate, `render_revalidation_failure` should get called. If everything is fine call `done`. ...
[ "def", "render_done", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "final_forms", "=", "OrderedDict", "(", ")", "# walk through the form list and try to validate the data again.", "for", "form_key", "in", "self", ".", "get_form_list", "(", ")", ":"...
[ 330, 4 ]
[ 352, 28 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form_prefix
(self, step=None, form=None)
Returns the prefix which will be used when calling the actual form for the given step. `step` contains the step-name, `form` the form which will be called with the returned prefix. If no step is given, the form_prefix will determine the current step automatically.
Returns the prefix which will be used when calling the actual form for the given step. `step` contains the step-name, `form` the form which will be called with the returned prefix.
def get_form_prefix(self, step=None, form=None): """ Returns the prefix which will be used when calling the actual form for the given step. `step` contains the step-name, `form` the form which will be called with the returned prefix. If no step is given, the form_prefix will det...
[ "def", "get_form_prefix", "(", "self", ",", "step", "=", "None", ",", "form", "=", "None", ")", ":", "if", "step", "is", "None", ":", "step", "=", "self", ".", "steps", ".", "current", "return", "str", "(", "step", ")" ]
[ 354, 4 ]
[ 365, 24 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form_initial
(self, step)
Returns a dictionary which will be passed to the form for `step` as `initial`. If no initial data was provided while initializing the form wizard, an empty dictionary will be returned.
Returns a dictionary which will be passed to the form for `step` as `initial`. If no initial data was provided while initializing the form wizard, an empty dictionary will be returned.
def get_form_initial(self, step): """ Returns a dictionary which will be passed to the form for `step` as `initial`. If no initial data was provided while initializing the form wizard, an empty dictionary will be returned. """ return self.initial_dict.get(step, {})
[ "def", "get_form_initial", "(", "self", ",", "step", ")", ":", "return", "self", ".", "initial_dict", ".", "get", "(", "step", ",", "{", "}", ")" ]
[ 367, 4 ]
[ 373, 46 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form_instance
(self, step)
Returns an object which will be passed to the form for `step` as `instance`. If no instance object was provided while initializing the form wizard, None will be returned.
Returns an object which will be passed to the form for `step` as `instance`. If no instance object was provided while initializing the form wizard, None will be returned.
def get_form_instance(self, step): """ Returns an object which will be passed to the form for `step` as `instance`. If no instance object was provided while initializing the form wizard, None will be returned. """ return self.instance_dict.get(step, None)
[ "def", "get_form_instance", "(", "self", ",", "step", ")", ":", "return", "self", ".", "instance_dict", ".", "get", "(", "step", ",", "None", ")" ]
[ 375, 4 ]
[ 381, 49 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form_kwargs
(self, step=None)
Returns the keyword arguments for instantiating the form (or formset) on the given step.
Returns the keyword arguments for instantiating the form (or formset) on the given step.
def get_form_kwargs(self, step=None): """ Returns the keyword arguments for instantiating the form (or formset) on the given step. """ return {}
[ "def", "get_form_kwargs", "(", "self", ",", "step", "=", "None", ")", ":", "return", "{", "}" ]
[ 383, 4 ]
[ 388, 17 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form
(self, step=None, data=None, files=None)
Constructs the form for a given `step`. If no `step` is defined, the current step will be determined automatically. The form will be initialized using the `data` argument to prefill the new form. If needed, instance or queryset (for `ModelForm` or `ModelFormSet`) will be added ...
Constructs the form for a given `step`. If no `step` is defined, the current step will be determined automatically.
def get_form(self, step=None, data=None, files=None): """ Constructs the form for a given `step`. If no `step` is defined, the current step will be determined automatically. The form will be initialized using the `data` argument to prefill the new form. If needed, instance or qu...
[ "def", "get_form", "(", "self", ",", "step", "=", "None", ",", "data", "=", "None", ",", "files", "=", "None", ")", ":", "if", "step", "is", "None", ":", "step", "=", "self", ".", "steps", ".", "current", "form_class", "=", "self", ".", "form_list"...
[ 390, 4 ]
[ 418, 35 ]
python
en
['en', 'error', 'th']
False
WizardView.process_step
(self, form)
This method is used to postprocess the form data. By default, it returns the raw `form.data` dictionary.
This method is used to postprocess the form data. By default, it returns the raw `form.data` dictionary.
def process_step(self, form): """ This method is used to postprocess the form data. By default, it returns the raw `form.data` dictionary. """ return self.get_form_step_data(form)
[ "def", "process_step", "(", "self", ",", "form", ")", ":", "return", "self", ".", "get_form_step_data", "(", "form", ")" ]
[ 420, 4 ]
[ 425, 44 ]
python
en
['en', 'error', 'th']
False
WizardView.process_step_files
(self, form)
This method is used to postprocess the form files. By default, it returns the raw `form.files` dictionary.
This method is used to postprocess the form files. By default, it returns the raw `form.files` dictionary.
def process_step_files(self, form): """ This method is used to postprocess the form files. By default, it returns the raw `form.files` dictionary. """ return self.get_form_step_files(form)
[ "def", "process_step_files", "(", "self", ",", "form", ")", ":", "return", "self", ".", "get_form_step_files", "(", "form", ")" ]
[ 427, 4 ]
[ 432, 45 ]
python
en
['en', 'error', 'th']
False
WizardView.render_revalidation_failure
(self, step, form, **kwargs)
Gets called when a form doesn't validate when rendering the done view. By default, it changes the current step to failing forms step and renders the form.
Gets called when a form doesn't validate when rendering the done view. By default, it changes the current step to failing forms step and renders the form.
def render_revalidation_failure(self, step, form, **kwargs): """ Gets called when a form doesn't validate when rendering the done view. By default, it changes the current step to failing forms step and renders the form. """ self.storage.current_step = step return ...
[ "def", "render_revalidation_failure", "(", "self", ",", "step", ",", "form", ",", "*", "*", "kwargs", ")", ":", "self", ".", "storage", ".", "current_step", "=", "step", "return", "self", ".", "render", "(", "form", ",", "*", "*", "kwargs", ")" ]
[ 434, 4 ]
[ 441, 42 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form_step_data
(self, form)
Is used to return the raw form data. You may use this method to manipulate the data.
Is used to return the raw form data. You may use this method to manipulate the data.
def get_form_step_data(self, form): """ Is used to return the raw form data. You may use this method to manipulate the data. """ return form.data
[ "def", "get_form_step_data", "(", "self", ",", "form", ")", ":", "return", "form", ".", "data" ]
[ 443, 4 ]
[ 448, 24 ]
python
en
['en', 'error', 'th']
False
WizardView.get_form_step_files
(self, form)
Is used to return the raw form files. You may use this method to manipulate the data.
Is used to return the raw form files. You may use this method to manipulate the data.
def get_form_step_files(self, form): """ Is used to return the raw form files. You may use this method to manipulate the data. """ return form.files
[ "def", "get_form_step_files", "(", "self", ",", "form", ")", ":", "return", "form", ".", "files" ]
[ 450, 4 ]
[ 455, 25 ]
python
en
['en', 'error', 'th']
False
WizardView.get_all_cleaned_data
(self)
Returns a merged dictionary of all step cleaned_data dictionaries. If a step contains a `FormSet`, the key will be prefixed with 'formset-' and contain a list of the formset cleaned_data dictionaries.
Returns a merged dictionary of all step cleaned_data dictionaries. If a step contains a `FormSet`, the key will be prefixed with 'formset-' and contain a list of the formset cleaned_data dictionaries.
def get_all_cleaned_data(self): """ Returns a merged dictionary of all step cleaned_data dictionaries. If a step contains a `FormSet`, the key will be prefixed with 'formset-' and contain a list of the formset cleaned_data dictionaries. """ cleaned_data = {} for f...
[ "def", "get_all_cleaned_data", "(", "self", ")", ":", "cleaned_data", "=", "{", "}", "for", "form_key", "in", "self", ".", "get_form_list", "(", ")", ":", "form_obj", "=", "self", ".", "get_form", "(", "step", "=", "form_key", ",", "data", "=", "self", ...
[ 457, 4 ]
[ 477, 27 ]
python
en
['en', 'error', 'th']
False
WizardView.get_cleaned_data_for_step
(self, step)
Returns the cleaned data for a given `step`. Before returning the cleaned data, the stored values are revalidated through the form. If the data doesn't validate, None will be returned.
Returns the cleaned data for a given `step`. Before returning the cleaned data, the stored values are revalidated through the form. If the data doesn't validate, None will be returned.
def get_cleaned_data_for_step(self, step): """ Returns the cleaned data for a given `step`. Before returning the cleaned data, the stored values are revalidated through the form. If the data doesn't validate, None will be returned. """ if step in self.form_list: ...
[ "def", "get_cleaned_data_for_step", "(", "self", ",", "step", ")", ":", "if", "step", "in", "self", ".", "form_list", ":", "form_obj", "=", "self", ".", "get_form", "(", "step", "=", "step", ",", "data", "=", "self", ".", "storage", ".", "get_step_data",...
[ 479, 4 ]
[ 491, 19 ]
python
en
['en', 'error', 'th']
False
WizardView.get_next_step
(self, step=None)
Returns the next step after the given `step`. If no more steps are available, None will be returned. If the `step` argument is None, the current step will be determined automatically.
Returns the next step after the given `step`. If no more steps are available, None will be returned. If the `step` argument is None, the current step will be determined automatically.
def get_next_step(self, step=None): """ Returns the next step after the given `step`. If no more steps are available, None will be returned. If the `step` argument is None, the current step will be determined automatically. """ if step is None: step = self.ste...
[ "def", "get_next_step", "(", "self", ",", "step", "=", "None", ")", ":", "if", "step", "is", "None", ":", "step", "=", "self", ".", "steps", ".", "current", "form_list", "=", "self", ".", "get_form_list", "(", ")", "keys", "=", "list", "(", "form_lis...
[ 493, 4 ]
[ 506, 19 ]
python
en
['en', 'error', 'th']
False
WizardView.get_prev_step
(self, step=None)
Returns the previous step before the given `step`. If there are no steps available, None will be returned. If the `step` argument is None, the current step will be determined automatically.
Returns the previous step before the given `step`. If there are no steps available, None will be returned. If the `step` argument is None, the current step will be determined automatically.
def get_prev_step(self, step=None): """ Returns the previous step before the given `step`. If there are no steps available, None will be returned. If the `step` argument is None, the current step will be determined automatically. """ if step is None: step = se...
[ "def", "get_prev_step", "(", "self", ",", "step", "=", "None", ")", ":", "if", "step", "is", "None", ":", "step", "=", "self", ".", "steps", ".", "current", "form_list", "=", "self", ".", "get_form_list", "(", ")", "keys", "=", "list", "(", "form_lis...
[ 508, 4 ]
[ 521, 19 ]
python
en
['en', 'error', 'th']
False
WizardView.get_step_index
(self, step=None)
Returns the index for the given `step` name. If no step is given, the current step will be used to get the index.
Returns the index for the given `step` name. If no step is given, the current step will be used to get the index.
def get_step_index(self, step=None): """ Returns the index for the given `step` name. If no step is given, the current step will be used to get the index. """ if step is None: step = self.steps.current return list(self.get_form_list().keys()).index(step)
[ "def", "get_step_index", "(", "self", ",", "step", "=", "None", ")", ":", "if", "step", "is", "None", ":", "step", "=", "self", ".", "steps", ".", "current", "return", "list", "(", "self", ".", "get_form_list", "(", ")", ".", "keys", "(", ")", ")",...
[ 523, 4 ]
[ 530, 60 ]
python
en
['en', 'error', 'th']
False
WizardView.get_context_data
(self, form, **kwargs)
Returns the template context for a step. You can overwrite this method to add more data for all or some steps. This method returns a dictionary containing the rendered form step. Available template context variables are: * all extra data stored in the storage backend ...
Returns the template context for a step. You can overwrite this method to add more data for all or some steps. This method returns a dictionary containing the rendered form step. Available template context variables are:
def get_context_data(self, form, **kwargs): """ Returns the template context for a step. You can overwrite this method to add more data for all or some steps. This method returns a dictionary containing the rendered form step. Available template context variables are: *...
[ "def", "get_context_data", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "WizardView", ",", "self", ")", ".", "get_context_data", "(", "form", "=", "form", ",", "*", "*", "kwargs", ")", "context", ".", "up...
[ 532, 4 ]
[ 560, 22 ]
python
en
['en', 'error', 'th']
False
WizardView.render
(self, form=None, **kwargs)
Returns a ``HttpResponse`` containing all needed context data.
Returns a ``HttpResponse`` containing all needed context data.
def render(self, form=None, **kwargs): """ Returns a ``HttpResponse`` containing all needed context data. """ form = form or self.get_form() context = self.get_context_data(form=form, **kwargs) return self.render_to_response(context)
[ "def", "render", "(", "self", ",", "form", "=", "None", ",", "*", "*", "kwargs", ")", ":", "form", "=", "form", "or", "self", ".", "get_form", "(", ")", "context", "=", "self", ".", "get_context_data", "(", "form", "=", "form", ",", "*", "*", "kw...
[ 562, 4 ]
[ 568, 47 ]
python
en
['en', 'error', 'th']
False
WizardView.done
(self, form_list, **kwargs)
This method must be overridden by a subclass to process to form data after processing all steps.
This method must be overridden by a subclass to process to form data after processing all steps.
def done(self, form_list, **kwargs): """ This method must be overridden by a subclass to process to form data after processing all steps. """ raise NotImplementedError("Your %s class has not defined a done() " "method, which is required." % self.__class__.__name__)
[ "def", "done", "(", "self", ",", "form_list", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Your %s class has not defined a done() \"", "\"method, which is required.\"", "%", "self", ".", "__class__", ".", "__name__", ")" ]
[ 570, 4 ]
[ 576, 67 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.get_initkwargs
(cls, *args, **kwargs)
We require a url_name to reverse URLs later. Additionally users can pass a done_step_name to change the URL name of the "done" view.
We require a url_name to reverse URLs later. Additionally users can pass a done_step_name to change the URL name of the "done" view.
def get_initkwargs(cls, *args, **kwargs): """ We require a url_name to reverse URLs later. Additionally users can pass a done_step_name to change the URL name of the "done" view. """ assert 'url_name' in kwargs, 'URL name is needed to resolve correct wizard URLs' extra_kw...
[ "def", "get_initkwargs", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "'url_name'", "in", "kwargs", ",", "'URL name is needed to resolve correct wizard URLs'", "extra_kwargs", "=", "{", "'done_step_name'", ":", "kwargs", ".", "pop", ...
[ 601, 4 ]
[ 616, 25 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.get
(self, *args, **kwargs)
This renders the form or, if needed, does the http redirects.
This renders the form or, if needed, does the http redirects.
def get(self, *args, **kwargs): """ This renders the form or, if needed, does the http redirects. """ step_url = kwargs.get('step', None) if step_url is None: if 'reset' in self.request.GET: self.storage.reset() self.storage.current_ste...
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "step_url", "=", "kwargs", ".", "get", "(", "'step'", ",", "None", ")", "if", "step_url", "is", "None", ":", "if", "'reset'", "in", "self", ".", "request", ".", "GET"...
[ 621, 4 ]
[ 664, 64 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.post
(self, *args, **kwargs)
Do a redirect if user presses the prev. step button. The rest of this is super'd from WizardView.
Do a redirect if user presses the prev. step button. The rest of this is super'd from WizardView.
def post(self, *args, **kwargs): """ Do a redirect if user presses the prev. step button. The rest of this is super'd from WizardView. """ wizard_goto_step = self.request.POST.get('wizard_goto_step', None) if wizard_goto_step and wizard_goto_step in self.get_form_list(): ...
[ "def", "post", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "wizard_goto_step", "=", "self", ".", "request", ".", "POST", ".", "get", "(", "'wizard_goto_step'", ",", "None", ")", "if", "wizard_goto_step", "and", "wizard_goto_step", "...
[ 666, 4 ]
[ 674, 68 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.get_context_data
(self, form, **kwargs)
NamedUrlWizardView provides the url_name of this wizard in the context dict `wizard`.
NamedUrlWizardView provides the url_name of this wizard in the context dict `wizard`.
def get_context_data(self, form, **kwargs): """ NamedUrlWizardView provides the url_name of this wizard in the context dict `wizard`. """ context = super(NamedUrlWizardView, self).get_context_data(form=form, **kwargs) context['wizard']['url_name'] = self.url_name ...
[ "def", "get_context_data", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "NamedUrlWizardView", ",", "self", ")", ".", "get_context_data", "(", "form", "=", "form", ",", "*", "*", "kwargs", ")", "context", "[...
[ 676, 4 ]
[ 683, 22 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.render_next_step
(self, form, **kwargs)
When using the NamedUrlWizardView, we have to redirect to update the browser's URL to match the shown step.
When using the NamedUrlWizardView, we have to redirect to update the browser's URL to match the shown step.
def render_next_step(self, form, **kwargs): """ When using the NamedUrlWizardView, we have to redirect to update the browser's URL to match the shown step. """ next_step = self.get_next_step() self.storage.current_step = next_step return redirect(self.get_step_url...
[ "def", "render_next_step", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "next_step", "=", "self", ".", "get_next_step", "(", ")", "self", ".", "storage", ".", "current_step", "=", "next_step", "return", "redirect", "(", "self", ".", "get_...
[ 685, 4 ]
[ 692, 53 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.render_goto_step
(self, goto_step, **kwargs)
This method gets called when the current step has to be changed. `goto_step` contains the requested step to go to.
This method gets called when the current step has to be changed. `goto_step` contains the requested step to go to.
def render_goto_step(self, goto_step, **kwargs): """ This method gets called when the current step has to be changed. `goto_step` contains the requested step to go to. """ self.storage.current_step = goto_step return redirect(self.get_step_url(goto_step))
[ "def", "render_goto_step", "(", "self", ",", "goto_step", ",", "*", "*", "kwargs", ")", ":", "self", ".", "storage", ".", "current_step", "=", "goto_step", "return", "redirect", "(", "self", ".", "get_step_url", "(", "goto_step", ")", ")" ]
[ 694, 4 ]
[ 700, 53 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.render_revalidation_failure
(self, failed_step, form, **kwargs)
When a step fails, we have to redirect the user to the first failing step.
When a step fails, we have to redirect the user to the first failing step.
def render_revalidation_failure(self, failed_step, form, **kwargs): """ When a step fails, we have to redirect the user to the first failing step. """ self.storage.current_step = failed_step return redirect(self.get_step_url(failed_step))
[ "def", "render_revalidation_failure", "(", "self", ",", "failed_step", ",", "form", ",", "*", "*", "kwargs", ")", ":", "self", ".", "storage", ".", "current_step", "=", "failed_step", "return", "redirect", "(", "self", ".", "get_step_url", "(", "failed_step", ...
[ 702, 4 ]
[ 708, 55 ]
python
en
['en', 'error', 'th']
False
NamedUrlWizardView.render_done
(self, form, **kwargs)
When rendering the done view, we have to redirect first (if the URL name doesn't fit).
When rendering the done view, we have to redirect first (if the URL name doesn't fit).
def render_done(self, form, **kwargs): """ When rendering the done view, we have to redirect first (if the URL name doesn't fit). """ if kwargs.get('step', None) != self.done_step_name: return redirect(self.get_step_url(self.done_step_name)) return super(Named...
[ "def", "render_done", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "'step'", ",", "None", ")", "!=", "self", ".", "done_step_name", ":", "return", "redirect", "(", "self", ".", "get_step_url", "(", "se...
[ 710, 4 ]
[ 717, 74 ]
python
en
['en', 'error', 'th']
False
cycle
(parser, token)
This is the future version of `cycle` with auto-escaping. The deprecation is now complete and this version is no different from the non-future version so this is deprecated. By default all strings are escaped. If you want to disable auto-escaping of variables you can use:: {% autoescape ...
This is the future version of `cycle` with auto-escaping. The deprecation is now complete and this version is no different from the non-future version so this is deprecated.
def cycle(parser, token): """ This is the future version of `cycle` with auto-escaping. The deprecation is now complete and this version is no different from the non-future version so this is deprecated. By default all strings are escaped. If you want to disable auto-escaping of variables you ...
[ "def", "cycle", "(", "parser", ",", "token", ")", ":", "warnings", ".", "warn", "(", "\"Loading the `cycle` tag from the `future` library is deprecated and \"", "\"will be removed in Django 2.0. Use the default `cycle` tag instead.\"", ",", "RemovedInDjango20Warning", ")", "return"...
[ 28, 0 ]
[ 50, 43 ]
python
en
['en', 'error', 'th']
False
firstof
(parser, token)
This is the future version of `firstof` with auto-escaping. The deprecation is now complete and this version is no different from the non-future version so this is deprecated. This is equivalent to:: {% if var1 %} {{ var1 }} {% elif var2 %} {{ var2 }} {...
This is the future version of `firstof` with auto-escaping. The deprecation is now complete and this version is no different from the non-future version so this is deprecated.
def firstof(parser, token): """ This is the future version of `firstof` with auto-escaping. The deprecation is now complete and this version is no different from the non-future version so this is deprecated. This is equivalent to:: {% if var1 %} {{ var1 }} {% elif var2 ...
[ "def", "firstof", "(", "parser", ",", "token", ")", ":", "warnings", ".", "warn", "(", "\"Loading the `firstof` tag from the `future` library is deprecated and \"", "\"will be removed in Django 2.0. Use the default `firstof` tag instead.\"", ",", "RemovedInDjango20Warning", ")", "r...
[ 54, 0 ]
[ 85, 45 ]
python
en
['en', 'error', 'th']
False
DatabaseFeatures._mysql_storage_engine
(self)
Internal method used in Django tests. Don't rely on this from your code
Internal method used in Django tests. Don't rely on this from your code
def _mysql_storage_engine(self): "Internal method used in Django tests. Don't rely on this from your code" with self.connection.cursor() as cursor: cursor.execute('CREATE TABLE INTROSPECT_TEST (X INT)') # This command is MySQL specific; the second column # will tell y...
[ "def", "_mysql_storage_engine", "(", "self", ")", ":", "with", "self", ".", "connection", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "'CREATE TABLE INTROSPECT_TEST (X INT)'", ")", "# This command is MySQL specific; the second column", ...
[ 193, 4 ]
[ 204, 24 ]
python
en
['en', 'en', 'en']
True
DatabaseFeatures.can_introspect_foreign_keys
(self)
Confirm support for introspected foreign keys
Confirm support for introspected foreign keys
def can_introspect_foreign_keys(self): "Confirm support for introspected foreign keys" return self._mysql_storage_engine != 'MyISAM'
[ "def", "can_introspect_foreign_keys", "(", "self", ")", ":", "return", "self", ".", "_mysql_storage_engine", "!=", "'MyISAM'" ]
[ 207, 4 ]
[ 209, 53 ]
python
en
['en', 'en', 'en']
True
DatabaseOperations.force_no_ordering
(self)
"ORDER BY NULL" prevents MySQL from implicitly ordering by grouped columns. If no ordering would otherwise be applied, we don't want any implicit sorting going on.
"ORDER BY NULL" prevents MySQL from implicitly ordering by grouped columns. If no ordering would otherwise be applied, we don't want any implicit sorting going on.
def force_no_ordering(self): """ "ORDER BY NULL" prevents MySQL from implicitly ordering by grouped columns. If no ordering would otherwise be applied, we don't want any implicit sorting going on. """ return ["NULL"]
[ "def", "force_no_ordering", "(", "self", ")", ":", "return", "[", "\"NULL\"", "]" ]
[ 301, 4 ]
[ 307, 23 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.combine_expression
(self, connector, sub_expressions)
MySQL requires special cases for ^ operators in query expressions
MySQL requires special cases for ^ operators in query expressions
def combine_expression(self, connector, sub_expressions): """ MySQL requires special cases for ^ operators in query expressions """ if connector == '^': return 'POW(%s)' % ','.join(sub_expressions) return super(DatabaseOperations, self).combine_expression(connector, s...
[ "def", "combine_expression", "(", "self", ",", "connector", ",", "sub_expressions", ")", ":", "if", "connector", "==", "'^'", ":", "return", "'POW(%s)'", "%", "','", ".", "join", "(", "sub_expressions", ")", "return", "super", "(", "DatabaseOperations", ",", ...
[ 391, 4 ]
[ 397, 93 ]
python
en
['en', 'error', 'th']
False
DatabaseWrapper.disable_constraint_checking
(self)
Disables foreign key checks, primarily for use in adding rows with forward references. Always returns True, to indicate constraint checks need to be re-enabled.
Disables foreign key checks, primarily for use in adding rows with forward references. Always returns True, to indicate constraint checks need to be re-enabled.
def disable_constraint_checking(self): """ Disables foreign key checks, primarily for use in adding rows with forward references. Always returns True, to indicate constraint checks need to be re-enabled. """ self.cursor().execute('SET foreign_key_checks=0') return True
[ "def", "disable_constraint_checking", "(", "self", ")", ":", "self", ".", "cursor", "(", ")", ".", "execute", "(", "'SET foreign_key_checks=0'", ")", "return", "True" ]
[ 504, 4 ]
[ 510, 19 ]
python
en
['en', 'error', 'th']
False
DatabaseWrapper.enable_constraint_checking
(self)
Re-enable foreign key checks after they have been disabled.
Re-enable foreign key checks after they have been disabled.
def enable_constraint_checking(self): """ Re-enable foreign key checks after they have been disabled. """ # Override needs_rollback in case constraint_checks_disabled is # nested inside transaction.atomic. self.needs_rollback, needs_rollback = False, self.needs_rollback ...
[ "def", "enable_constraint_checking", "(", "self", ")", ":", "# Override needs_rollback in case constraint_checks_disabled is", "# nested inside transaction.atomic.", "self", ".", "needs_rollback", ",", "needs_rollback", "=", "False", ",", "self", ".", "needs_rollback", "try", ...
[ 512, 4 ]
[ 522, 48 ]
python
en
['en', 'error', 'th']
False
DatabaseWrapper.check_constraints
(self, table_names=None)
Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows with invalid references were entered while constraint ...
Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows with invalid references were entered while constraint ...
def check_constraints(self, table_names=None): """ Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows...
[ "def", "check_constraints", "(", "self", ",", "table_names", "=", "None", ")", ":", "cursor", "=", "self", ".", "cursor", "(", ")", "if", "table_names", "is", "None", ":", "table_names", "=", "self", ".", "introspection", ".", "table_names", "(", "cursor",...
[ 524, 4 ]
[ 560, 71 ]
python
en
['en', 'error', 'th']
False
fromfile
(file_h)
Given a string file name, returns a GEOSGeometry. The file may contain WKB, WKT, or HEX.
Given a string file name, returns a GEOSGeometry. The file may contain WKB, WKT, or HEX.
def fromfile(file_h): """ Given a string file name, returns a GEOSGeometry. The file may contain WKB, WKT, or HEX. """ # If given a file name, get a real handle. if isinstance(file_h, str): with open(file_h, 'rb') as file_h: buf = file_h.read() else: buf = file_h....
[ "def", "fromfile", "(", "file_h", ")", ":", "# If given a file name, get a real handle.", "if", "isinstance", "(", "file_h", ",", "str", ")", ":", "with", "open", "(", "file_h", ",", "'rb'", ")", "as", "file_h", ":", "buf", "=", "file_h", ".", "read", "(",...
[ 3, 0 ]
[ 27, 40 ]
python
en
['en', 'error', 'th']
False
fromstr
(string, **kwargs)
Given a string value, return a GEOSGeometry object.
Given a string value, return a GEOSGeometry object.
def fromstr(string, **kwargs): "Given a string value, return a GEOSGeometry object." return GEOSGeometry(string, **kwargs)
[ "def", "fromstr", "(", "string", ",", "*", "*", "kwargs", ")", ":", "return", "GEOSGeometry", "(", "string", ",", "*", "*", "kwargs", ")" ]
[ 30, 0 ]
[ 32, 41 ]
python
en
['en', 'en', 'en']
True
auth
(request)
Returns context variables required by apps that use Django's authentication system. If there is no 'user' attribute in the request, uses AnonymousUser (from django.contrib.auth).
Returns context variables required by apps that use Django's authentication system.
def auth(request): """ Returns context variables required by apps that use Django's authentication system. If there is no 'user' attribute in the request, uses AnonymousUser (from django.contrib.auth). """ if hasattr(request, 'user'): user = request.user else: from djang...
[ "def", "auth", "(", "request", ")", ":", "if", "hasattr", "(", "request", ",", "'user'", ")", ":", "user", "=", "request", ".", "user", "else", ":", "from", "django", ".", "contrib", ".", "auth", ".", "models", "import", "AnonymousUser", "user", "=", ...
[ 48, 0 ]
[ 65, 5 ]
python
en
['en', 'error', 'th']
False
PermWrapper.__contains__
(self, perm_name)
Lookup by "someapp" or "someapp.someperm" in perms.
Lookup by "someapp" or "someapp.someperm" in perms.
def __contains__(self, perm_name): """ Lookup by "someapp" or "someapp.someperm" in perms. """ if '.' not in perm_name: # The name refers to module. return bool(self[perm_name]) app_label, perm_name = perm_name.split('.', 1) return self[app_label][...
[ "def", "__contains__", "(", "self", ",", "perm_name", ")", ":", "if", "'.'", "not", "in", "perm_name", ":", "# The name refers to module.", "return", "bool", "(", "self", "[", "perm_name", "]", ")", "app_label", ",", "perm_name", "=", "perm_name", ".", "spli...
[ 37, 4 ]
[ 45, 41 ]
python
en
['en', 'error', 'th']
False
XFrameOptionsMiddleware.get_xframe_options_value
(self, request, response)
Get the value to set for the X_FRAME_OPTIONS header. Use the value from the X_FRAME_OPTIONS setting, or 'DENY' if not set. This method can be overridden if needed, allowing it to vary based on the request or response.
Get the value to set for the X_FRAME_OPTIONS header. Use the value from the X_FRAME_OPTIONS setting, or 'DENY' if not set.
def get_xframe_options_value(self, request, response): """ Get the value to set for the X_FRAME_OPTIONS header. Use the value from the X_FRAME_OPTIONS setting, or 'DENY' if not set. This method can be overridden if needed, allowing it to vary based on the request or response. ...
[ "def", "get_xframe_options_value", "(", "self", ",", "request", ",", "response", ")", ":", "return", "getattr", "(", "settings", ",", "'X_FRAME_OPTIONS'", ",", "'DENY'", ")", ".", "upper", "(", ")" ]
[ 36, 4 ]
[ 44, 67 ]
python
en
['en', 'error', 'th']
False
MigrationQuestioner.ask_initial
(self, app_label)
Should we create an initial migration for the app?
Should we create an initial migration for the app?
def ask_initial(self, app_label): """Should we create an initial migration for the app?""" # If it was specified on the command line, definitely true if app_label in self.specified_apps: return True # Otherwise, we look to see if it has a migrations module # without a...
[ "def", "ask_initial", "(", "self", ",", "app_label", ")", ":", "# If it was specified on the command line, definitely true", "if", "app_label", "in", "self", ".", "specified_apps", ":", "return", "True", "# Otherwise, we look to see if it has a migrations module", "# without an...
[ 24, 4 ]
[ 53, 86 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_not_null_addition
(self, field_name, model_name)
Adding a NOT NULL field to a model.
Adding a NOT NULL field to a model.
def ask_not_null_addition(self, field_name, model_name): """Adding a NOT NULL field to a model.""" # None means quit return None
[ "def", "ask_not_null_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "# None means quit", "return", "None" ]
[ 55, 4 ]
[ 58, 19 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_not_null_alteration
(self, field_name, model_name)
Changing a NULL field to NOT NULL.
Changing a NULL field to NOT NULL.
def ask_not_null_alteration(self, field_name, model_name): """Changing a NULL field to NOT NULL.""" # None means quit return None
[ "def", "ask_not_null_alteration", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "# None means quit", "return", "None" ]
[ 60, 4 ]
[ 63, 19 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_rename
(self, model_name, old_name, new_name, field_instance)
Was this field really renamed?
Was this field really renamed?
def ask_rename(self, model_name, old_name, new_name, field_instance): """Was this field really renamed?""" return self.defaults.get("ask_rename", False)
[ "def", "ask_rename", "(", "self", ",", "model_name", ",", "old_name", ",", "new_name", ",", "field_instance", ")", ":", "return", "self", ".", "defaults", ".", "get", "(", "\"ask_rename\"", ",", "False", ")" ]
[ 65, 4 ]
[ 67, 53 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_rename_model
(self, old_model_state, new_model_state)
Was this model really renamed?
Was this model really renamed?
def ask_rename_model(self, old_model_state, new_model_state): """Was this model really renamed?""" return self.defaults.get("ask_rename_model", False)
[ "def", "ask_rename_model", "(", "self", ",", "old_model_state", ",", "new_model_state", ")", ":", "return", "self", ".", "defaults", ".", "get", "(", "\"ask_rename_model\"", ",", "False", ")" ]
[ 69, 4 ]
[ 71, 59 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_merge
(self, app_label)
Do you really want to merge these migrations?
Do you really want to merge these migrations?
def ask_merge(self, app_label): """Do you really want to merge these migrations?""" return self.defaults.get("ask_merge", False)
[ "def", "ask_merge", "(", "self", ",", "app_label", ")", ":", "return", "self", ".", "defaults", ".", "get", "(", "\"ask_merge\"", ",", "False", ")" ]
[ 73, 4 ]
[ 75, 52 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_auto_now_add_addition
(self, field_name, model_name)
Adding an auto_now_add field to a model.
Adding an auto_now_add field to a model.
def ask_auto_now_add_addition(self, field_name, model_name): """Adding an auto_now_add field to a model.""" # None means quit return None
[ "def", "ask_auto_now_add_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "# None means quit", "return", "None" ]
[ 77, 4 ]
[ 80, 19 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner._ask_default
(self, default='')
Prompt for a default value. The ``default`` argument allows providing a custom default value (as a string) which will be shown to the user and used as the return value if the user doesn't provide any other input.
Prompt for a default value.
def _ask_default(self, default=''): """ Prompt for a default value. The ``default`` argument allows providing a custom default value (as a string) which will be shown to the user and used as the return value if the user doesn't provide any other input. """ print(...
[ "def", "_ask_default", "(", "self", ",", "default", "=", "''", ")", ":", "print", "(", "\"Please enter the default value now, as valid Python\"", ")", "if", "default", ":", "print", "(", "\"You can accept the default '{}' by pressing 'Enter' or you \"", "\"can provide another...
[ 108, 4 ]
[ 140, 50 ]
python
en
['en', 'error', 'th']
False
InteractiveMigrationQuestioner.ask_not_null_addition
(self, field_name, model_name)
Adding a NOT NULL field to a model.
Adding a NOT NULL field to a model.
def ask_not_null_addition(self, field_name, model_name): """Adding a NOT NULL field to a model.""" if not self.dry_run: choice = self._choice_input( "You are trying to add a non-nullable field '%s' to %s without a default; " "we can't do that (the database nee...
[ "def", "ask_not_null_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "if", "not", "self", ".", "dry_run", ":", "choice", "=", "self", ".", "_choice_input", "(", "\"You are trying to add a non-nullable field '%s' to %s without a default; \"", "\"w...
[ 142, 4 ]
[ 159, 19 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_not_null_alteration
(self, field_name, model_name)
Changing a NULL field to NOT NULL.
Changing a NULL field to NOT NULL.
def ask_not_null_alteration(self, field_name, model_name): """Changing a NULL field to NOT NULL.""" if not self.dry_run: choice = self._choice_input( "You are trying to change the nullable field '%s' on %s to non-nullable " "without a default; we can't do that...
[ "def", "ask_not_null_alteration", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "if", "not", "self", ".", "dry_run", ":", "choice", "=", "self", ".", "_choice_input", "(", "\"You are trying to change the nullable field '%s' on %s to non-nullable \"", "\"w...
[ 161, 4 ]
[ 184, 19 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_rename
(self, model_name, old_name, new_name, field_instance)
Was this field really renamed?
Was this field really renamed?
def ask_rename(self, model_name, old_name, new_name, field_instance): """Was this field really renamed?""" msg = "Did you rename %s.%s to %s.%s (a %s)? [y/N]" return self._boolean_input(msg % (model_name, old_name, model_name, new_name, field_instance.__...
[ "def", "ask_rename", "(", "self", ",", "model_name", ",", "old_name", ",", "new_name", ",", "field_instance", ")", ":", "msg", "=", "\"Did you rename %s.%s to %s.%s (a %s)? [y/N]\"", "return", "self", ".", "_boolean_input", "(", "msg", "%", "(", "model_name", ",",...
[ 186, 4 ]
[ 190, 84 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_rename_model
(self, old_model_state, new_model_state)
Was this model really renamed?
Was this model really renamed?
def ask_rename_model(self, old_model_state, new_model_state): """Was this model really renamed?""" msg = "Did you rename the %s.%s model to %s? [y/N]" return self._boolean_input(msg % (old_model_state.app_label, old_model_state.name, new_model_state.name...
[ "def", "ask_rename_model", "(", "self", ",", "old_model_state", ",", "new_model_state", ")", ":", "msg", "=", "\"Did you rename the %s.%s model to %s? [y/N]\"", "return", "self", ".", "_boolean_input", "(", "msg", "%", "(", "old_model_state", ".", "app_label", ",", ...
[ 192, 4 ]
[ 196, 71 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_auto_now_add_addition
(self, field_name, model_name)
Adding an auto_now_add field to a model.
Adding an auto_now_add field to a model.
def ask_auto_now_add_addition(self, field_name, model_name): """Adding an auto_now_add field to a model.""" if not self.dry_run: choice = self._choice_input( "You are trying to add the field '{}' with 'auto_now_add=True' " "to {} without a default; the databas...
[ "def", "ask_auto_now_add_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "if", "not", "self", ".", "dry_run", ":", "choice", "=", "self", ".", "_choice_input", "(", "\"You are trying to add the field '{}' with 'auto_now_add=True' \"", "\"to {} wi...
[ 206, 4 ]
[ 223, 19 ]
python
en
['en', 'en', 'en']
True
DatabaseIntrospection.get_table_list
(self, cursor)
Returns a list of table and view names in the current database.
Returns a list of table and view names in the current database.
def get_table_list(self, cursor): """ Returns a list of table and view names in the current database. """ cursor.execute("SHOW FULL TABLES") return [TableInfo(row[0], {'BASE TABLE': 't', 'VIEW': 'v'}.get(row[1])) for row in cursor.fetchall()]
[ "def", "get_table_list", "(", "self", ",", "cursor", ")", ":", "cursor", ".", "execute", "(", "\"SHOW FULL TABLES\"", ")", "return", "[", "TableInfo", "(", "row", "[", "0", "]", ",", "{", "'BASE TABLE'", ":", "'t'", ",", "'VIEW'", ":", "'v'", "}", ".",...
[ 34, 4 ]
[ 40, 45 ]
python
en
['en', 'error', 'th']
False
DatabaseIntrospection.get_table_description
(self, cursor, table_name)
Returns a description of the table, with the DB-API cursor.description interface."
Returns a description of the table, with the DB-API cursor.description interface."
def get_table_description(self, cursor, table_name): """ Returns a description of the table, with the DB-API cursor.description interface." """ # varchar length returned by cursor.description is an internal length, # not visible length (#5725), use information_schema database to ...
[ "def", "get_table_description", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "# varchar length returned by cursor.description is an internal length,", "# not visible length (#5725), use information_schema database to fix this", "cursor", ".", "execute", "(", "\"\"\"\n ...
[ 42, 4 ]
[ 67, 43 ]
python
en
['en', 'error', 'th']
False
DatabaseIntrospection._name_to_index
(self, cursor, table_name)
Returns a dictionary of {field_name: field_index} for the given table. Indexes are 0-based.
Returns a dictionary of {field_name: field_index} for the given table. Indexes are 0-based.
def _name_to_index(self, cursor, table_name): """ Returns a dictionary of {field_name: field_index} for the given table. Indexes are 0-based. """ return dict((d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name)))
[ "def", "_name_to_index", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "return", "dict", "(", "(", "d", "[", "0", "]", ",", "i", ")", "for", "i", ",", "d", "in", "enumerate", "(", "self", ".", "get_table_description", "(", "cursor", ",", ...
[ 69, 4 ]
[ 74, 100 ]
python
en
['en', 'error', 'th']
False
DatabaseIntrospection.get_relations
(self, cursor, table_name)
Returns a dictionary of {field_index: (field_index_other_table, other_table)} representing all relationships to the given table. Indexes are 0-based.
Returns a dictionary of {field_index: (field_index_other_table, other_table)} representing all relationships to the given table. Indexes are 0-based.
def get_relations(self, cursor, table_name): """ Returns a dictionary of {field_index: (field_index_other_table, other_table)} representing all relationships to the given table. Indexes are 0-based. """ my_field_dict = self._name_to_index(cursor, table_name) constraints =...
[ "def", "get_relations", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "my_field_dict", "=", "self", ".", "_name_to_index", "(", "cursor", ",", "table_name", ")", "constraints", "=", "self", ".", "get_key_columns", "(", "cursor", ",", "table_name", ...
[ 76, 4 ]
[ 88, 24 ]
python
en
['en', 'error', 'th']
False
DatabaseIntrospection.get_key_columns
(self, cursor, table_name)
Returns a list of (column_name, referenced_table_name, referenced_column_name) for all key columns in given table.
Returns a list of (column_name, referenced_table_name, referenced_column_name) for all key columns in given table.
def get_key_columns(self, cursor, table_name): """ Returns a list of (column_name, referenced_table_name, referenced_column_name) for all key columns in given table. """ key_columns = [] cursor.execute(""" SELECT column_name, referenced_table_name, referenced_...
[ "def", "get_key_columns", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "key_columns", "=", "[", "]", "cursor", ".", "execute", "(", "\"\"\"\n SELECT column_name, referenced_table_name, referenced_column_name\n FROM information_schema.key_column_u...
[ 90, 4 ]
[ 104, 26 ]
python
en
['en', 'error', 'th']
False
DatabaseIntrospection.get_storage_engine
(self, cursor, table_name)
Retrieves the storage engine for a given table.
Retrieves the storage engine for a given table.
def get_storage_engine(self, cursor, table_name): """ Retrieves the storage engine for a given table. """ cursor.execute( "SELECT engine " "FROM information_schema.tables " "WHERE table_name = %s", [table_name]) return cursor.fetchone()[0]
[ "def", "get_storage_engine", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "cursor", ".", "execute", "(", "\"SELECT engine \"", "\"FROM information_schema.tables \"", "\"WHERE table_name = %s\"", ",", "[", "table_name", "]", ")", "return", "cursor", ".", ...
[ 129, 4 ]
[ 137, 35 ]
python
en
['en', 'error', 'th']
False
DatabaseIntrospection.get_constraints
(self, cursor, table_name)
Retrieves any constraints or keys (unique, pk, fk, check, index) across one or more columns.
Retrieves any constraints or keys (unique, pk, fk, check, index) across one or more columns.
def get_constraints(self, cursor, table_name): """ Retrieves any constraints or keys (unique, pk, fk, check, index) across one or more columns. """ constraints = {} # Get the actual constraint names and columns name_query = """ SELECT kc.`constraint_name`, kc....
[ "def", "get_constraints", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "constraints", "=", "{", "}", "# Get the actual constraint names and columns", "name_query", "=", "\"\"\"\n SELECT kc.`constraint_name`, kc.`column_name`,\n kc.`referenced_t...
[ 139, 4 ]
[ 197, 26 ]
python
en
['en', 'error', 'th']
False
get_supported
( version=None, # type: Optional[str] platform=None, # type: Optional[str] impl=None, # type: Optional[str] abi=None # type: Optional[str] )
Return a list of supported tags for each version specified in `versions`. :param version: a string version, of the form "33" or "32", or None. The version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If None, use the local...
Return a list of supported tags for each version specified in `versions`.
def get_supported( version=None, # type: Optional[str] platform=None, # type: Optional[str] impl=None, # type: Optional[str] abi=None # type: Optional[str] ): # type: (...) -> List[Tag] """Return a list of supported tags for each version specified in `versions`. :param version: a st...
[ "def", "get_supported", "(", "version", "=", "None", ",", "# type: Optional[str]", "platform", "=", "None", ",", "# type: Optional[str]", "impl", "=", "None", ",", "# type: Optional[str]", "abi", "=", "None", "# type: Optional[str]", ")", ":", "# type: (...) -> List[T...
[ 108, 0 ]
[ 168, 20 ]
python
en
['en', 'en', 'en']
True
TemporaryUploadedFile.temporary_file_path
(self)
Return the full path of this file.
Return the full path of this file.
def temporary_file_path(self): """Return the full path of this file.""" return self.file.name
[ "def", "temporary_file_path", "(", "self", ")", ":", "return", "self", ".", "file", ".", "name" ]
[ 63, 4 ]
[ 65, 29 ]
python
en
['en', 'en', 'en']
True
SimpleUploadedFile.from_dict
(cls, file_dict)
Create a SimpleUploadedFile object from a dictionary with keys: - filename - content-type - content
Create a SimpleUploadedFile object from a dictionary with keys: - filename - content-type - content
def from_dict(cls, file_dict): """ Create a SimpleUploadedFile object from a dictionary with keys: - filename - content-type - content """ return cls(file_dict['filename'], file_dict['content'], file_dict.get('content...
[ "def", "from_dict", "(", "cls", ",", "file_dict", ")", ":", "return", "cls", "(", "file_dict", "[", "'filename'", "]", ",", "file_dict", "[", "'content'", "]", ",", "file_dict", ".", "get", "(", "'content-type'", ",", "'text/plain'", ")", ")" ]
[ 107, 4 ]
[ 116, 63 ]
python
en
['en', 'error', 'th']
False
prune_internal_data
(events: List[Dict[str, Any]])
Prunes the internal_data data structures, which are not intended to be exposed to API clients.
Prunes the internal_data data structures, which are not intended to be exposed to API clients.
def prune_internal_data(events: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Prunes the internal_data data structures, which are not intended to be exposed to API clients. """ events = copy.deepcopy(events) for event in events: if event["type"] == "message" and "internal_data" in event:...
[ "def", "prune_internal_data", "(", "events", ":", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "events", "=", "copy", ".", "deepcopy", "(", "events", ")", "for", "ev...
[ 373, 0 ]
[ 381, 17 ]
python
en
['en', 'en', 'en']
True
missedmessage_hook
( user_profile_id: int, client: ClientDescriptor, last_for_client: bool )
The receiver_is_off_zulip logic used to determine whether a user has no active client suffers from a somewhat fundamental race condition. If the client is no longer on the Internet, receiver_is_off_zulip will still return False for DEFAULT_EVENT_QUEUE_TIMEOUT_SECS, until the queue is garbage-collec...
The receiver_is_off_zulip logic used to determine whether a user has no active client suffers from a somewhat fundamental race condition. If the client is no longer on the Internet, receiver_is_off_zulip will still return False for DEFAULT_EVENT_QUEUE_TIMEOUT_SECS, until the queue is garbage-collec...
def missedmessage_hook( user_profile_id: int, client: ClientDescriptor, last_for_client: bool ) -> None: """The receiver_is_off_zulip logic used to determine whether a user has no active client suffers from a somewhat fundamental race condition. If the client is no longer on the Internet, receiver_...
[ "def", "missedmessage_hook", "(", "user_profile_id", ":", "int", ",", "client", ":", "ClientDescriptor", ",", "last_for_client", ":", "bool", ")", "->", "None", ":", "# Only process missedmessage hook when the last queue for a", "# client has been garbage collected", "if", ...
[ 689, 0 ]
[ 762, 9 ]
python
en
['en', 'en', 'en']
True
maybe_enqueue_notifications
( user_profile_id: int, message_id: int, private_message: bool, mentioned: bool, wildcard_mention_notify: bool, stream_push_notify: bool, stream_email_notify: bool, stream_name: Optional[str], always_push_notify: bool, idle: bool, already_notified: Dict[str, bool], )
This function has a complete unit test suite in `test_enqueue_notifications` that should be expanded as we add more features here. See https://zulip.readthedocs.io/en/latest/subsystems/notifications.html for high-level design documentation.
This function has a complete unit test suite in `test_enqueue_notifications` that should be expanded as we add more features here.
def maybe_enqueue_notifications( user_profile_id: int, message_id: int, private_message: bool, mentioned: bool, wildcard_mention_notify: bool, stream_push_notify: bool, stream_email_notify: bool, stream_name: Optional[str], always_push_notify: bool, idle: bool, already_notifi...
[ "def", "maybe_enqueue_notifications", "(", "user_profile_id", ":", "int", ",", "message_id", ":", "int", ",", "private_message", ":", "bool", ",", "mentioned", ":", "bool", ",", "wildcard_mention_notify", ":", "bool", ",", "stream_push_notify", ":", "bool", ",", ...
[ 776, 0 ]
[ 838, 19 ]
python
en
['en', 'en', 'en']
True
get_client_info_for_message_event
( event_template: Mapping[str, Any], users: Iterable[Mapping[str, Any]] )
Return client info for all the clients interested in a message. This basically includes clients for users who are recipients of the message, with some nuances for bots that auto-subscribe to all streams, plus users who may be mentioned, etc.
Return client info for all the clients interested in a message. This basically includes clients for users who are recipients of the message, with some nuances for bots that auto-subscribe to all streams, plus users who may be mentioned, etc.
def get_client_info_for_message_event( event_template: Mapping[str, Any], users: Iterable[Mapping[str, Any]] ) -> Dict[str, ClientInfo]: """ Return client info for all the clients interested in a message. This basically includes clients for users who are recipients of the message, with some nuances ...
[ "def", "get_client_info_for_message_event", "(", "event_template", ":", "Mapping", "[", "str", ",", "Any", "]", ",", "users", ":", "Iterable", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ")", "->", "Dict", "[", "str", ",", "ClientInfo", "]", ":", ...
[ 847, 0 ]
[ 886, 26 ]
python
en
['en', 'error', 'th']
False
process_message_event
( event_template: Mapping[str, Any], users: Iterable[Mapping[str, Any]] )
See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html for high-level documentation on this subsystem.
See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html for high-level documentation on this subsystem.
def process_message_event( event_template: Mapping[str, Any], users: Iterable[Mapping[str, Any]] ) -> None: """See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html for high-level documentation on this subsystem. """ send_to_clients = get_client_info_for_message_event(event...
[ "def", "process_message_event", "(", "event_template", ":", "Mapping", "[", "str", ",", "Any", "]", ",", "users", ":", "Iterable", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ")", "->", "None", ":", "send_to_clients", "=", "get_client_info_for_message_...
[ 889, 0 ]
[ 1011, 36 ]
python
en
['en', 'en', 'ur']
False
GeometryCollection.__init__
(self, *args, **kwargs)
Initializes a Geometry Collection from a sequence of Geometry objects.
Initializes a Geometry Collection from a sequence of Geometry objects.
def __init__(self, *args, **kwargs): "Initializes a Geometry Collection from a sequence of Geometry objects." # Checking the arguments if not args: raise TypeError('Must provide at least one Geometry to initialize %s.' % self.__class__.__name__) if len(args) == 1: ...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Checking the arguments", "if", "not", "args", ":", "raise", "TypeError", "(", "'Must provide at least one Geometry to initialize %s.'", "%", "self", ".", "__class__", ".", "_...
[ 17, 4 ]
[ 40, 70 ]
python
en
['en', 'en', 'en']
True
GeometryCollection.__iter__
(self)
Iterates over each Geometry in the Collection.
Iterates over each Geometry in the Collection.
def __iter__(self): "Iterates over each Geometry in the Collection." for i in xrange(len(self)): yield self[i]
[ "def", "__iter__", "(", "self", ")", ":", "for", "i", "in", "xrange", "(", "len", "(", "self", ")", ")", ":", "yield", "self", "[", "i", "]" ]
[ 42, 4 ]
[ 45, 25 ]
python
en
['en', 'en', 'en']
True
GeometryCollection.__len__
(self)
Returns the number of geometries in this Collection.
Returns the number of geometries in this Collection.
def __len__(self): "Returns the number of geometries in this Collection." return self.num_geom
[ "def", "__len__", "(", "self", ")", ":", "return", "self", ".", "num_geom" ]
[ 47, 4 ]
[ 49, 28 ]
python
en
['en', 'en', 'en']
True
GeometryCollection._get_single_external
(self, index)
Returns the Geometry from this Collection at the given index (0-based).
Returns the Geometry from this Collection at the given index (0-based).
def _get_single_external(self, index): "Returns the Geometry from this Collection at the given index (0-based)." # Checking the index and returning the corresponding GEOS geometry. return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)
[ "def", "_get_single_external", "(", "self", ",", "index", ")", ":", "# Checking the index and returning the corresponding GEOS geometry.", "return", "GEOSGeometry", "(", "capi", ".", "geom_clone", "(", "self", ".", "_get_single_internal", "(", "index", ")", ")", ",", ...
[ 65, 4 ]
[ 68, 94 ]
python
en
['en', 'en', 'en']
True
GeometryCollection._set_list
(self, length, items)
Create a new collection, and destroy the contents of the previous pointer.
Create a new collection, and destroy the contents of the previous pointer.
def _set_list(self, length, items): "Create a new collection, and destroy the contents of the previous pointer." prev_ptr = self.ptr srid = self.srid self.ptr = self._create_collection(length, items) if srid: self.srid = srid capi.destroy_geom(prev_ptr)
[ "def", "_set_list", "(", "self", ",", "length", ",", "items", ")", ":", "prev_ptr", "=", "self", ".", "ptr", "srid", "=", "self", ".", "srid", "self", ".", "ptr", "=", "self", ".", "_create_collection", "(", "length", ",", "items", ")", "if", "srid",...
[ 70, 4 ]
[ 77, 35 ]
python
en
['en', 'en', 'en']
True
GeometryCollection.kml
(self)
Returns the KML for this Geometry Collection.
Returns the KML for this Geometry Collection.
def kml(self): "Returns the KML for this Geometry Collection." return '<MultiGeometry>%s</MultiGeometry>' % ''.join(g.kml for g in self)
[ "def", "kml", "(", "self", ")", ":", "return", "'<MultiGeometry>%s</MultiGeometry>'", "%", "''", ".", "join", "(", "g", ".", "kml", "for", "g", "in", "self", ")" ]
[ 83, 4 ]
[ 85, 81 ]
python
en
['en', 'en', 'en']
True
GeometryCollection.tuple
(self)
Returns a tuple of all the coordinates in this Geometry Collection
Returns a tuple of all the coordinates in this Geometry Collection
def tuple(self): "Returns a tuple of all the coordinates in this Geometry Collection" return tuple(g.tuple for g in self)
[ "def", "tuple", "(", "self", ")", ":", "return", "tuple", "(", "g", ".", "tuple", "for", "g", "in", "self", ")" ]
[ 88, 4 ]
[ 90, 43 ]
python
en
['en', 'en', 'en']
True
MultiLineString.merged
(self)
Returns a LineString representing the line merge of this MultiLineString.
Returns a LineString representing the line merge of this MultiLineString.
def merged(self): """ Returns a LineString representing the line merge of this MultiLineString. """ return self._topology(capi.geos_linemerge(self.ptr))
[ "def", "merged", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_linemerge", "(", "self", ".", "ptr", ")", ")" ]
[ 105, 4 ]
[ 110, 60 ]
python
en
['en', 'error', 'th']
False
MultiPolygon.cascaded_union
(self)
Returns a cascaded union of this MultiPolygon.
Returns a cascaded union of this MultiPolygon.
def cascaded_union(self): "Returns a cascaded union of this MultiPolygon." return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)
[ "def", "cascaded_union", "(", "self", ")", ":", "return", "GEOSGeometry", "(", "capi", ".", "geos_cascaded_union", "(", "self", ".", "ptr", ")", ",", "self", ".", "srid", ")" ]
[ 118, 4 ]
[ 120, 74 ]
python
en
['en', 'en', 'en']
True
BaseModelBackendTest.test_has_no_object_perm
(self)
Regressiontest for #12462
Regressiontest for #12462
def test_has_no_object_perm(self): """Regressiontest for #12462""" user = self.UserModel._default_manager.get(pk=self.user.pk) content_type = ContentType.objects.get_for_model(Group) perm = Permission.objects.create(name='test', content_type=content_type, codename='test') user.us...
[ "def", "test_has_no_object_perm", "(", "self", ")", ":", "user", "=", "self", ".", "UserModel", ".", "_default_manager", ".", "get", "(", "pk", "=", "self", ".", "user", ".", "pk", ")", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_mode...
[ 102, 4 ]
[ 112, 67 ]
python
en
['en', 'en', 'en']
True
BaseModelBackendTest.test_anonymous_has_no_permissions
(self)
#17903 -- Anonymous users shouldn't have permissions in ModelBackend.get_(all|user|group)_permissions().
#17903 -- Anonymous users shouldn't have permissions in ModelBackend.get_(all|user|group)_permissions().
def test_anonymous_has_no_permissions(self): """ #17903 -- Anonymous users shouldn't have permissions in ModelBackend.get_(all|user|group)_permissions(). """ backend = ModelBackend() user = self.UserModel._default_manager.get(pk=self.user.pk) content_type = Conte...
[ "def", "test_anonymous_has_no_permissions", "(", "self", ")", ":", "backend", "=", "ModelBackend", "(", ")", "user", "=", "self", ".", "UserModel", ".", "_default_manager", ".", "get", "(", "pk", "=", "self", ".", "user", ".", "pk", ")", "content_type", "=...
[ 114, 4 ]
[ 139, 68 ]
python
en
['en', 'error', 'th']
False
BaseModelBackendTest.test_inactive_has_no_permissions
(self)
#17903 -- Inactive users shouldn't have permissions in ModelBackend.get_(all|user|group)_permissions().
#17903 -- Inactive users shouldn't have permissions in ModelBackend.get_(all|user|group)_permissions().
def test_inactive_has_no_permissions(self): """ #17903 -- Inactive users shouldn't have permissions in ModelBackend.get_(all|user|group)_permissions(). """ backend = ModelBackend() user = self.UserModel._default_manager.get(pk=self.user.pk) content_type = Content...
[ "def", "test_inactive_has_no_permissions", "(", "self", ")", ":", "backend", "=", "ModelBackend", "(", ")", "user", "=", "self", ".", "UserModel", ".", "_default_manager", ".", "get", "(", "pk", "=", "self", ".", "user", ".", "pk", ")", "content_type", "="...
[ 141, 4 ]
[ 167, 68 ]
python
en
['en', 'error', 'th']
False
BaseModelBackendTest.test_get_all_superuser_permissions
(self)
A superuser has all permissions. Refs #14795.
A superuser has all permissions. Refs #14795.
def test_get_all_superuser_permissions(self): """A superuser has all permissions. Refs #14795.""" user = self.UserModel._default_manager.get(pk=self.superuser.pk) self.assertEqual(len(user.get_all_permissions()), len(Permission.objects.all()))
[ "def", "test_get_all_superuser_permissions", "(", "self", ")", ":", "user", "=", "self", ".", "UserModel", ".", "_default_manager", ".", "get", "(", "pk", "=", "self", ".", "superuser", ".", "pk", ")", "self", ".", "assertEqual", "(", "len", "(", "user", ...
[ 169, 4 ]
[ 172, 88 ]
python
en
['en', 'it', 'en']
True
BaseModelBackendTest.test_authentication_timing
(self)
Hasher is run once regardless of whether the user exists. Refs #20760.
Hasher is run once regardless of whether the user exists. Refs #20760.
def test_authentication_timing(self): """Hasher is run once regardless of whether the user exists. Refs #20760.""" # Re-set the password, because this tests overrides PASSWORD_HASHERS self.user.set_password('test') self.user.save() CountingMD5PasswordHasher.calls = 0 use...
[ "def", "test_authentication_timing", "(", "self", ")", ":", "# Re-set the password, because this tests overrides PASSWORD_HASHERS", "self", ".", "user", ".", "set_password", "(", "'test'", ")", "self", ".", "user", ".", "save", "(", ")", "CountingMD5PasswordHasher", "."...
[ 175, 4 ]
[ 188, 60 ]
python
en
['en', 'en', 'en']
True
BaseEmailBackend.open
(self)
Open a network connection. This method can be overwritten by backend implementations to open a network connection. It's up to the backend implementation to track the status of a network connection if it's needed by the backend. This method can be called by applications to forc...
Open a network connection.
def open(self): """Open a network connection. This method can be overwritten by backend implementations to open a network connection. It's up to the backend implementation to track the status of a network connection if it's needed by the backend. This method can be cal...
[ "def", "open", "(", "self", ")", ":", "pass" ]
[ 19, 4 ]
[ 35, 12 ]
python
en
['en', 'en', 'en']
True
BaseEmailBackend.close
(self)
Close a network connection.
Close a network connection.
def close(self): """Close a network connection.""" pass
[ "def", "close", "(", "self", ")", ":", "pass" ]
[ 37, 4 ]
[ 39, 12 ]
python
en
['en', 'en', 'en']
True
BaseEmailBackend.send_messages
(self, email_messages)
Sends one or more EmailMessage objects and returns the number of email messages sent.
Sends one or more EmailMessage objects and returns the number of email messages sent.
def send_messages(self, email_messages): """ Sends one or more EmailMessage objects and returns the number of email messages sent. """ raise NotImplementedError('subclasses of BaseEmailBackend must override send_messages() method')
[ "def", "send_messages", "(", "self", ",", "email_messages", ")", ":", "raise", "NotImplementedError", "(", "'subclasses of BaseEmailBackend must override send_messages() method'", ")" ]
[ 48, 4 ]
[ 53, 104 ]
python
en
['en', 'error', 'th']
False
DatabaseSchemaEditor._alter_field_lob_workaround
(self, model, old_field, new_field)
Oracle refuses to change a column type from/to LOB to/from a regular column. In Django, this shows up when the field is changed from/to a TextField. What we need to do instead is: - Add the desired field with a temporary name - Update the table to transfer values from ol...
Oracle refuses to change a column type from/to LOB to/from a regular column. In Django, this shows up when the field is changed from/to a TextField. What we need to do instead is: - Add the desired field with a temporary name - Update the table to transfer values from ol...
def _alter_field_lob_workaround(self, model, old_field, new_field): """ Oracle refuses to change a column type from/to LOB to/from a regular column. In Django, this shows up when the field is changed from/to a TextField. What we need to do instead is: - Add the desired fi...
[ "def", "_alter_field_lob_workaround", "(", "self", ",", "model", ",", "old_field", ",", "new_field", ")", ":", "# Make a new field that's like the new one but with a temporary", "# column name.", "new_temp_field", "=", "copy", ".", "deepcopy", "(", "new_field", ")", "new_...
[ 62, 4 ]
[ 91, 31 ]
python
en
['en', 'error', 'th']
False
DatabaseSchemaEditor.normalize_name
(self, name)
Get the properly shortened and uppercased identifier as returned by quote_name(), but without the actual quotes.
Get the properly shortened and uppercased identifier as returned by quote_name(), but without the actual quotes.
def normalize_name(self, name): """ Get the properly shortened and uppercased identifier as returned by quote_name(), but without the actual quotes. """ nn = self.quote_name(name) if nn[0] == '"' and nn[-1] == '"': nn = nn[1:-1] return nn
[ "def", "normalize_name", "(", "self", ",", "name", ")", ":", "nn", "=", "self", ".", "quote_name", "(", "name", ")", "if", "nn", "[", "0", "]", "==", "'\"'", "and", "nn", "[", "-", "1", "]", "==", "'\"'", ":", "nn", "=", "nn", "[", "1", ":", ...
[ 93, 4 ]
[ 101, 17 ]
python
en
['en', 'error', 'th']
False
DatabaseSchemaEditor._generate_temp_name
(self, for_name)
Generates temporary names for workarounds that need temp columns
Generates temporary names for workarounds that need temp columns
def _generate_temp_name(self, for_name): """ Generates temporary names for workarounds that need temp columns """ suffix = hex(hash(for_name)).upper()[1:] return self.normalize_name(for_name + "_" + suffix)
[ "def", "_generate_temp_name", "(", "self", ",", "for_name", ")", ":", "suffix", "=", "hex", "(", "hash", "(", "for_name", ")", ")", ".", "upper", "(", ")", "[", "1", ":", "]", "return", "self", ".", "normalize_name", "(", "for_name", "+", "\"_\"", "+...
[ 103, 4 ]
[ 108, 59 ]
python
en
['en', 'error', 'th']
False
Read_input
(data, batch_size)
Returns: audios_np: a numpy array of size (batch_size, max_length) in float sample_rate: a numpy array trans: an array includes the targeted transcriptions (batch_size,) masks_freq: a numpy array to mask out the padding features in frequency domain
Returns: audios_np: a numpy array of size (batch_size, max_length) in float sample_rate: a numpy array trans: an array includes the targeted transcriptions (batch_size,) masks_freq: a numpy array to mask out the padding features in frequency domain
def Read_input(data, batch_size): """ Returns: audios_np: a numpy array of size (batch_size, max_length) in float sample_rate: a numpy array trans: an array includes the targeted transcriptions (batch_size,) masks_freq: a numpy array to mask out the padding features in frequency ...
[ "def", "Read_input", "(", "data", ",", "batch_size", ")", ":", "audios", "=", "[", "]", "lengths", "=", "[", "]", "for", "i", "in", "range", "(", "batch_size", ")", ":", "name", ",", "_", "=", "data", "[", "0", ",", "i", "]", ".", "split", "(",...
[ 25, 0 ]
[ 74, 55 ]
python
en
['en', 'error', 'th']
False
slack_workspace_to_realm
( domain_name: str, realm_id: int, user_list: List[ZerverFieldsT], realm_subdomain: str, slack_data_dir: str, custom_emoji_list: ZerverFieldsT, )
Returns: 1. realm, converted realm data 2. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user id to Zulip user id 3. slack_recipient_name_to_zulip_recipient_id, which is a dictionary to map from Slack recipient name(channel names, mpim names, usernames, etc) to Zulip re...
Returns: 1. realm, converted realm data 2. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user id to Zulip user id 3. slack_recipient_name_to_zulip_recipient_id, which is a dictionary to map from Slack recipient name(channel names, mpim names, usernames, etc) to Zulip re...
def slack_workspace_to_realm( domain_name: str, realm_id: int, user_list: List[ZerverFieldsT], realm_subdomain: str, slack_data_dir: str, custom_emoji_list: ZerverFieldsT, ) -> Tuple[ ZerverFieldsT, SlackToZulipUserIDT, SlackToZulipRecipientT, AddedChannelsT, AddedMPIMsT, ...
[ "def", "slack_workspace_to_realm", "(", "domain_name", ":", "str", ",", "realm_id", ":", "int", ",", "user_list", ":", "List", "[", "ZerverFieldsT", "]", ",", "realm_subdomain", ":", "str", ",", "slack_data_dir", ":", "str", ",", "custom_emoji_list", ":", "Zer...
[ 64, 0 ]
[ 134, 5 ]
python
en
['en', 'error', 'th']
False
users_to_zerver_userprofile
( slack_data_dir: str, users: List[ZerverFieldsT], realm_id: int, timestamp: Any, domain_name: str )
Returns: 1. zerver_userprofile, which is a list of user profile 2. avatar_list, which is list to map avatars to Zulip avatard records.json 3. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user ID to Zulip user id 4. zerver_customprofilefield, which is a list of all ...
Returns: 1. zerver_userprofile, which is a list of user profile 2. avatar_list, which is list to map avatars to Zulip avatard records.json 3. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user ID to Zulip user id 4. zerver_customprofilefield, which is a list of all ...
def users_to_zerver_userprofile( slack_data_dir: str, users: List[ZerverFieldsT], realm_id: int, timestamp: Any, domain_name: str ) -> Tuple[ List[ZerverFieldsT], List[ZerverFieldsT], SlackToZulipUserIDT, List[ZerverFieldsT], List[ZerverFieldsT], ]: """ Returns: 1. zerver_userprofile...
[ "def", "users_to_zerver_userprofile", "(", "slack_data_dir", ":", "str", ",", "users", ":", "List", "[", "ZerverFieldsT", "]", ",", "realm_id", ":", "int", ",", "timestamp", ":", "Any", ",", "domain_name", ":", "str", ")", "->", "Tuple", "[", "List", "[", ...
[ 161, 0 ]
[ 279, 5 ]
python
en
['en', 'error', 'th']
False
channels_to_zerver_stream
( slack_data_dir: str, realm_id: int, realm: Dict[str, Any], slack_user_id_to_zulip_user_id: SlackToZulipUserIDT, zerver_userprofile: List[ZerverFieldsT], )
Returns: 1. realm, converted realm data 2. added_channels, which is a dictionary to map from channel name to channel id, Zulip stream_id 3. added_mpims, which is a dictionary to map from MPIM(multiparty IM) name to MPIM id, Zulip huddle_id 4. dm_members, which is a dictionary to map from DM id to t...
Returns: 1. realm, converted realm data 2. added_channels, which is a dictionary to map from channel name to channel id, Zulip stream_id 3. added_mpims, which is a dictionary to map from MPIM(multiparty IM) name to MPIM id, Zulip huddle_id 4. dm_members, which is a dictionary to map from DM id to t...
def channels_to_zerver_stream( slack_data_dir: str, realm_id: int, realm: Dict[str, Any], slack_user_id_to_zulip_user_id: SlackToZulipUserIDT, zerver_userprofile: List[ZerverFieldsT], ) -> Tuple[ Dict[str, List[ZerverFieldsT]], AddedChannelsT, AddedMPIMsT, DMMembersT, SlackToZulipRecipientT ]: ...
[ "def", "channels_to_zerver_stream", "(", "slack_data_dir", ":", "str", ",", "realm_id", ":", "int", ",", "realm", ":", "Dict", "[", "str", ",", "Any", "]", ",", "slack_user_id_to_zulip_user_id", ":", "SlackToZulipUserIDT", ",", "zerver_userprofile", ":", "List", ...
[ 417, 0 ]
[ 585, 5 ]
python
en
['en', 'error', 'th']
False
process_long_term_idle_users
( slack_data_dir: str, users: List[ZerverFieldsT], slack_user_id_to_zulip_user_id: SlackToZulipUserIDT, added_channels: AddedChannelsT, added_mpims: AddedMPIMsT, dm_members: DMMembersT, zerver_userprofile: List[ZerverFieldsT], )
Algorithmically, we treat users who have sent at least 10 messages or have sent a message within the last 60 days as active. Everyone else is treated as long-term idle, which means they will have a slightly slower first page load when coming back to Zulip.
Algorithmically, we treat users who have sent at least 10 messages or have sent a message within the last 60 days as active. Everyone else is treated as long-term idle, which means they will have a slightly slower first page load when coming back to Zulip.
def process_long_term_idle_users( slack_data_dir: str, users: List[ZerverFieldsT], slack_user_id_to_zulip_user_id: SlackToZulipUserIDT, added_channels: AddedChannelsT, added_mpims: AddedMPIMsT, dm_members: DMMembersT, zerver_userprofile: List[ZerverFieldsT], ) -> Set[int]: """Algorithmic...
[ "def", "process_long_term_idle_users", "(", "slack_data_dir", ":", "str", ",", "users", ":", "List", "[", "ZerverFieldsT", "]", ",", "slack_user_id_to_zulip_user_id", ":", "SlackToZulipUserIDT", ",", "added_channels", ":", "AddedChannelsT", ",", "added_mpims", ":", "A...
[ 604, 0 ]
[ 657, 25 ]
python
en
['en', 'en', 'en']
True