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
OracleOperations.get_geom_placeholder
(self, f, value, compiler)
Provides a proper substitution value for Geometries that are not in the SRID of the field. Specifically, this routine will substitute in the SDO_CS.TRANSFORM() function call.
Provides a proper substitution value for Geometries that are not in the SRID of the field. Specifically, this routine will substitute in the SDO_CS.TRANSFORM() function call.
def get_geom_placeholder(self, f, value, compiler): """ Provides a proper substitution value for Geometries that are not in the SRID of the field. Specifically, this routine will substitute in the SDO_CS.TRANSFORM() function call. """ if value is None: return...
[ "def", "get_geom_placeholder", "(", "self", ",", "f", ",", "value", ",", "compiler", ")", ":", "if", "value", "is", "None", ":", "return", "'NULL'", "def", "transform_value", "(", "val", ",", "srid", ")", ":", "return", "val", ".", "srid", "!=", "srid"...
[ 225, 4 ]
[ 250, 55 ]
python
en
['en', 'error', 'th']
False
OracleOperations.spatial_aggregate_name
(self, agg_name)
Returns the spatial aggregate SQL name.
Returns the spatial aggregate SQL name.
def spatial_aggregate_name(self, agg_name): """ Returns the spatial aggregate SQL name. """ agg_name = 'unionagg' if agg_name.lower() == 'union' else agg_name.lower() return getattr(self, agg_name)
[ "def", "spatial_aggregate_name", "(", "self", ",", "agg_name", ")", ":", "agg_name", "=", "'unionagg'", "if", "agg_name", ".", "lower", "(", ")", "==", "'union'", "else", "agg_name", ".", "lower", "(", ")", "return", "getattr", "(", "self", ",", "agg_name"...
[ 252, 4 ]
[ 257, 38 ]
python
en
['en', 'error', 'th']
False
OracleOperations.modify_insert_params
(self, placeholder, params)
Drop out insert parameters for NULL placeholder. Needed for Oracle Spatial backend due to #10888.
Drop out insert parameters for NULL placeholder. Needed for Oracle Spatial backend due to #10888.
def modify_insert_params(self, placeholder, params): """Drop out insert parameters for NULL placeholder. Needed for Oracle Spatial backend due to #10888. """ if placeholder == 'NULL': return [] return super(OracleOperations, self).modify_insert_params(placeholder, par...
[ "def", "modify_insert_params", "(", "self", ",", "placeholder", ",", "params", ")", ":", "if", "placeholder", "==", "'NULL'", ":", "return", "[", "]", "return", "super", "(", "OracleOperations", ",", "self", ")", ".", "modify_insert_params", "(", "placeholder"...
[ 268, 4 ]
[ 274, 86 ]
python
en
['en', 'en', 'en']
True
show_formats
()
Print list of available formats (arguments to "--format" option).
Print list of available formats (arguments to "--format" option).
def show_formats(): """Print list of available formats (arguments to "--format" option). """ from distutils.fancy_getopt import FancyGetopt formats = [] for format in bdist.format_commands: formats.append(("formats=" + format, None, bdist.format_command[format][1])) ...
[ "def", "show_formats", "(", ")", ":", "from", "distutils", ".", "fancy_getopt", "import", "FancyGetopt", "formats", "=", "[", "]", "for", "format", "in", "bdist", ".", "format_commands", ":", "formats", ".", "append", "(", "(", "\"formats=\"", "+", "format",...
[ 11, 0 ]
[ 20, 72 ]
python
en
['en', 'en', 'en']
True
ImageEmbedHandler.expand_db_attributes
(cls, attrs)
Given a dict of attributes from the <embed> tag, return the real HTML representation for use on the front-end.
Given a dict of attributes from the <embed> tag, return the real HTML representation for use on the front-end.
def expand_db_attributes(cls, attrs): """ Given a dict of attributes from the <embed> tag, return the real HTML representation for use on the front-end. """ try: image = cls.get_instance(attrs) except ObjectDoesNotExist: return '<img alt="">' ...
[ "def", "expand_db_attributes", "(", "cls", ",", "attrs", ")", ":", "try", ":", "image", "=", "cls", ".", "get_instance", "(", "attrs", ")", "except", "ObjectDoesNotExist", ":", "return", "'<img alt=\"\">'", "image_format", "=", "get_image_format", "(", "attrs", ...
[ 17, 4 ]
[ 28, 70 ]
python
en
['en', 'error', 'th']
False
remove_image_permissions
(apps, schema_editor)
Reverse the above additions of permissions.
Reverse the above additions of permissions.
def remove_image_permissions(apps, schema_editor): """Reverse the above additions of permissions.""" ContentType = apps.get_model('contenttypes.ContentType') Permission = apps.get_model('auth.Permission') image_content_type = ContentType.objects.get( model='image', app_label='wagtailimag...
[ "def", "remove_image_permissions", "(", "apps", ",", "schema_editor", ")", ":", "ContentType", "=", "apps", ".", "get_model", "(", "'contenttypes.ContentType'", ")", "Permission", "=", "apps", ".", "get_model", "(", "'auth.Permission'", ")", "image_content_type", "=...
[ 36, 0 ]
[ 48, 14 ]
python
en
['en', 'en', 'en']
True
TestDbWhitelister.assertHtmlEqual
(self, str1, str2)
Assert that two HTML strings are equal at the DOM level (necessary because we can't guarantee the order that attributes are output in)
Assert that two HTML strings are equal at the DOM level (necessary because we can't guarantee the order that attributes are output in)
def assertHtmlEqual(self, str1, str2): """ Assert that two HTML strings are equal at the DOM level (necessary because we can't guarantee the order that attributes are output in) """ self.assertEqual(BeautifulSoup(str1, 'html5lib'), BeautifulSoup(str2, 'html5lib'))
[ "def", "assertHtmlEqual", "(", "self", ",", "str1", ",", "str2", ")", ":", "self", ".", "assertEqual", "(", "BeautifulSoup", "(", "str1", ",", "'html5lib'", ")", ",", "BeautifulSoup", "(", "str2", ",", "'html5lib'", ")", ")" ]
[ 47, 4 ]
[ 52, 90 ]
python
en
['en', 'error', 'th']
False
run
()
Run the script in sys.argv[1] as if it had been invoked naturally.
Run the script in sys.argv[1] as if it had been invoked naturally.
def run(): """ Run the script in sys.argv[1] as if it had been invoked naturally. """ __builtins__ script_name = sys.argv[1] namespace = dict( __file__=script_name, __name__='__main__', __doc__=None, ) sys.argv[:] = sys.argv[1:] open_ = getattr(tokenize, ...
[ "def", "run", "(", ")", ":", "__builtins__", "script_name", "=", "sys", ".", "argv", "[", "1", "]", "namespace", "=", "dict", "(", "__file__", "=", "script_name", ",", "__name__", "=", "'__main__'", ",", "__doc__", "=", "None", ",", ")", "sys", ".", ...
[ 12, 0 ]
[ 31, 25 ]
python
en
['en', 'error', 'th']
False
sdkinfra.find_driver
(self, ipaddr, creds, protopref=None, pOptions=None, msgFlag=False)
Find a device driver for the given IPAddress or host name :param ipaddr: ipaddress or hostname of the device :param creds: bundle of credentials for finding the device driver. :param protopref: the preferred protocol to be used if the device supports the protocol ...
Find a device driver for the given IPAddress or host name :param ipaddr: ipaddress or hostname of the device :param creds: bundle of credentials for finding the device driver. :param protopref: the preferred protocol to be used if the device supports the protocol ...
def find_driver(self, ipaddr, creds, protopref=None, pOptions=None, msgFlag=False): """Find a device driver for the given IPAddress or host name :param ipaddr: ipaddress or hostname of the device :param creds: bundle of credentials for finding the device driver. ...
[ "def", "find_driver", "(", "self", ",", "ipaddr", ",", "creds", ",", "protopref", "=", "None", ",", "pOptions", "=", "None", ",", "msgFlag", "=", "False", ")", ":", "duplicSet", "=", "set", "(", ")", "msg", "=", "ipaddr", "+", "\" : Connection to Dell EM...
[ 90, 4 ]
[ 119, 18 ]
python
en
['en', 'en', 'en']
True
sdkinfra.get_driver
(self, driver_en, ipaddr, creds, protopref=None, pOptions=None)
Get a device driver for the given IPAddress or host name, also checking for a particular device type :param ipaddr: ipaddress or hostname of the device :param driver_en: enumeration of the device type :param creds: bundle of credentials for finding the device driver. ...
Get a device driver for the given IPAddress or host name, also checking for a particular device type :param ipaddr: ipaddress or hostname of the device :param driver_en: enumeration of the device type :param creds: bundle of credentials for finding the device driver. ...
def get_driver(self, driver_en, ipaddr, creds, protopref=None, pOptions=None): """Get a device driver for the given IPAddress or host name, also checking for a particular device type :param ipaddr: ipaddress or hostname of the device :param driver_en: enumeration of the device type ...
[ "def", "get_driver", "(", "self", ",", "driver_en", ",", "ipaddr", ",", "creds", ",", "protopref", "=", "None", ",", "pOptions", "=", "None", ")", ":", "mod", "=", "TypeHelper", ".", "resolve", "(", "driver_en", ")", "logger", ".", "debug", "(", "\"get...
[ 124, 4 ]
[ 143, 75 ]
python
en
['en', 'en', 'en']
True
confirm_workflow_cancellation
(request, page_id)
Provides a modal view to confirm that the user wants to publish the page even though it will cancel the current workflow
Provides a modal view to confirm that the user wants to publish the page even though it will cancel the current workflow
def confirm_workflow_cancellation(request, page_id): """Provides a modal view to confirm that the user wants to publish the page even though it will cancel the current workflow""" page = get_object_or_404(Page, id=page_id) workflow_state = page.current_workflow_state if (not workflow_state) or not geta...
[ "def", "confirm_workflow_cancellation", "(", "request", ",", "page_id", ")", ":", "page", "=", "get_object_or_404", "(", "Page", ",", "id", "=", "page_id", ")", "workflow_state", "=", "page", ".", "current_workflow_state", "if", "(", "not", "workflow_state", ")"...
[ 123, 0 ]
[ 138, 5 ]
python
en
['en', 'en', 'en']
True
preview_revision_for_task
(request, page_id, task_id)
Preview the revision linked to the in-progress TaskState of a specified Task. This enables pages in moderation to be edited and new TaskStates linked to the new revisions created, with preview links remaining valid
Preview the revision linked to the in-progress TaskState of a specified Task. This enables pages in moderation to be edited and new TaskStates linked to the new revisions created, with preview links remaining valid
def preview_revision_for_task(request, page_id, task_id): """Preview the revision linked to the in-progress TaskState of a specified Task. This enables pages in moderation to be edited and new TaskStates linked to the new revisions created, with preview links remaining valid""" page = get_object_or_404(Pag...
[ "def", "preview_revision_for_task", "(", "request", ",", "page_id", ",", "task_id", ")", ":", "page", "=", "get_object_or_404", "(", "Page", ",", "id", "=", "page_id", ")", "task", "=", "get_object_or_404", "(", "Task", ",", "id", "=", "task_id", ")", ".",...
[ 167, 0 ]
[ 190, 6 ]
python
en
['en', 'en', 'en']
True
AuthenticationForm.__init__
(self, request=None, *args, **kwargs)
The 'request' parameter is set for custom auth use by subclasses. The form data comes in via the standard 'data' kwarg.
The 'request' parameter is set for custom auth use by subclasses. The form data comes in via the standard 'data' kwarg.
def __init__(self, request=None, *args, **kwargs): """ The 'request' parameter is set for custom auth use by subclasses. The form data comes in via the standard 'data' kwarg. """ self.request = request self.user_cache = None super(AuthenticationForm, self).__init_...
[ "def", "__init__", "(", "self", ",", "request", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "request", "=", "request", "self", ".", "user_cache", "=", "None", "super", "(", "AuthenticationForm", ",", "self", ")", "....
[ 167, 4 ]
[ 179, 86 ]
python
en
['en', 'error', 'th']
False
AuthenticationForm.confirm_login_allowed
(self, user)
Controls whether the given User may log in. This is a policy setting, independent of end-user authentication. This default behavior is to allow login by active users, and reject login by inactive users. If the given user cannot log in, this method should raise a ``forms.Validat...
Controls whether the given User may log in. This is a policy setting, independent of end-user authentication. This default behavior is to allow login by active users, and reject login by inactive users.
def confirm_login_allowed(self, user): """ Controls whether the given User may log in. This is a policy setting, independent of end-user authentication. This default behavior is to allow login by active users, and reject login by inactive users. If the given user cannot log in, ...
[ "def", "confirm_login_allowed", "(", "self", ",", "user", ")", ":", "if", "not", "user", ".", "is_active", ":", "raise", "forms", ".", "ValidationError", "(", "self", ".", "error_messages", "[", "'inactive'", "]", ",", "code", "=", "'inactive'", ",", ")" ]
[ 198, 4 ]
[ 213, 13 ]
python
en
['en', 'error', 'th']
False
PasswordResetForm.send_mail
(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None)
Sends a django.core.mail.EmailMultiAlternatives to `to_email`.
Sends a django.core.mail.EmailMultiAlternatives to `to_email`.
def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None): """ Sends a django.core.mail.EmailMultiAlternatives to `to_email`. """ subject = loader.render_to_string(subject_template_name, context) ...
[ "def", "send_mail", "(", "self", ",", "subject_template_name", ",", "email_template_name", ",", "context", ",", "from_email", ",", "to_email", ",", "html_email_template_name", "=", "None", ")", ":", "subject", "=", "loader", ".", "render_to_string", "(", "subject_...
[ 227, 4 ]
[ 242, 28 ]
python
en
['en', 'error', 'th']
False
PasswordResetForm.get_users
(self, email)
Given an email, return matching user(s) who should receive a reset. This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable passwords from resetting their password.
Given an email, return matching user(s) who should receive a reset.
def get_users(self, email): """Given an email, return matching user(s) who should receive a reset. This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable passwords from resetting their password. """ active...
[ "def", "get_users", "(", "self", ",", "email", ")", ":", "active_users", "=", "UserModel", ".", "_default_manager", ".", "filter", "(", "*", "*", "{", "'%s__iexact'", "%", "UserModel", ".", "get_email_field_name", "(", ")", ":", "email", ",", "'is_active'", ...
[ 244, 4 ]
[ 255, 67 ]
python
en
['en', 'en', 'en']
True
PasswordResetForm.save
(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', email_template_name='registration/password_reset_email.html', use_https=False, token_generator=default_token_generator, from_email=None, request=None, html_email_template_nam...
Generates a one-use only link for resetting password and sends to the user.
Generates a one-use only link for resetting password and sends to the user.
def save(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', email_template_name='registration/password_reset_email.html', use_https=False, token_generator=default_token_generator, from_email=None, request=None, html_email_temp...
[ "def", "save", "(", "self", ",", "domain_override", "=", "None", ",", "subject_template_name", "=", "'registration/password_reset_subject.txt'", ",", "email_template_name", "=", "'registration/password_reset_email.html'", ",", "use_https", "=", "False", ",", "token_generato...
[ 257, 4 ]
[ 289, 13 ]
python
en
['en', 'error', 'th']
False
PasswordChangeForm.clean_old_password
(self)
Validates that the old_password field is correct.
Validates that the old_password field is correct.
def clean_old_password(self): """ Validates that the old_password field is correct. """ old_password = self.cleaned_data["old_password"] if not self.user.check_password(old_password): raise forms.ValidationError( self.error_messages['password_incorrect...
[ "def", "clean_old_password", "(", "self", ")", ":", "old_password", "=", "self", ".", "cleaned_data", "[", "\"old_password\"", "]", "if", "not", "self", ".", "user", ".", "check_password", "(", "old_password", ")", ":", "raise", "forms", ".", "ValidationError"...
[ 352, 4 ]
[ 362, 27 ]
python
en
['en', 'error', 'th']
False
AdminPasswordChangeForm.save
(self, commit=True)
Saves the new password.
Saves the new password.
def save(self, commit=True): """ Saves the new password. """ password = self.cleaned_data["password1"] self.user.set_password(password) if commit: self.user.save() return self.user
[ "def", "save", "(", "self", ",", "commit", "=", "True", ")", ":", "password", "=", "self", ".", "cleaned_data", "[", "\"password1\"", "]", "self", ".", "user", ".", "set_password", "(", "password", ")", "if", "commit", ":", "self", ".", "user", ".", ...
[ 402, 4 ]
[ 410, 24 ]
python
en
['en', 'error', 'th']
False
lossFun
(inputs, targets, hprev)
inputs,targets are both list of integers. hprev is Hx1 array of initial hidden state returns the loss, gradients on model parameters, and last hidden state
inputs,targets are both list of integers. hprev is Hx1 array of initial hidden state returns the loss, gradients on model parameters, and last hidden state
def lossFun(inputs, targets, hprev): """ inputs,targets are both list of integers. hprev is Hx1 array of initial hidden state returns the loss, gradients on model parameters, and last hidden state """ xs, hs, ys, ps = {}, {}, {}, {} hs[-1] = np.copy(hprev) loss = 0 # forward pass for t in xrange(len...
[ "def", "lossFun", "(", "inputs", ",", "targets", ",", "hprev", ")", ":", "xs", ",", "hs", ",", "ys", ",", "ps", "=", "{", "}", ",", "{", "}", ",", "{", "}", ",", "{", "}", "hs", "[", "-", "1", "]", "=", "np", ".", "copy", "(", "hprev", ...
[ 22, 0 ]
[ 56, 60 ]
python
en
['en', 'error', 'th']
False
sample
(h, seed_ix, n)
sample a sequence of integers from the model h is memory state, seed_ix is seed letter for first time step
sample a sequence of integers from the model h is memory state, seed_ix is seed letter for first time step
def sample(h, seed_ix, n): """ sample a sequence of integers from the model h is memory state, seed_ix is seed letter for first time step """ x = np.zeros((vocab_size, 1)) x[seed_ix] = 1 ixes = [] for t in xrange(n): h = np.tanh(np.dot(Wxh, x) + np.dot(Whh, h) + bh) y = np.dot(Why, h) + by ...
[ "def", "sample", "(", "h", ",", "seed_ix", ",", "n", ")", ":", "x", "=", "np", ".", "zeros", "(", "(", "vocab_size", ",", "1", ")", ")", "x", "[", "seed_ix", "]", "=", "1", "ixes", "=", "[", "]", "for", "t", "in", "xrange", "(", "n", ")", ...
[ 58, 0 ]
[ 74, 13 ]
python
en
['en', 'ja', 'th']
False
Join.as_sql
(self, compiler, connection)
Generates the full LEFT OUTER JOIN sometable ON sometable.somecol = othertable.othercol, params clause for this join.
Generates the full LEFT OUTER JOIN sometable ON sometable.somecol = othertable.othercol, params clause for this join.
def as_sql(self, compiler, connection): """ Generates the full LEFT OUTER JOIN sometable ON sometable.somecol = othertable.othercol, params clause for this join. """ join_conditions = [] params = [] qn = compiler.quote_name_unless_alias qn2 = co...
[ "def", "as_sql", "(", "self", ",", "compiler", ",", "connection", ")", ":", "join_conditions", "=", "[", "]", "params", "=", "[", "]", "qn", "=", "compiler", ".", "quote_name_unless_alias", "qn2", "=", "connection", ".", "ops", ".", "quote_name", "# Add a ...
[ 59, 4 ]
[ 98, 26 ]
python
en
['en', 'error', 'th']
False
TestTopologicallySorted.test_Valid
(self)
Test that sorting works on a valid graph with one possible order.
Test that sorting works on a valid graph with one possible order.
def test_Valid(self): """Test that sorting works on a valid graph with one possible order.""" graph = { "a": ["b", "c"], "b": [], "c": ["d"], "d": ["b"], } def GetEdge(node): return tuple(graph[node]) self.assertEqual(...
[ "def", "test_Valid", "(", "self", ")", ":", "graph", "=", "{", "\"a\"", ":", "[", "\"b\"", ",", "\"c\"", "]", ",", "\"b\"", ":", "[", "]", ",", "\"c\"", ":", "[", "\"d\"", "]", ",", "\"d\"", ":", "[", "\"b\"", "]", ",", "}", "def", "GetEdge", ...
[ 14, 4 ]
[ 28, 9 ]
python
en
['en', 'en', 'en']
True
TestTopologicallySorted.test_Cycle
(self)
Test that an exception is thrown on a cyclic graph.
Test that an exception is thrown on a cyclic graph.
def test_Cycle(self): """Test that an exception is thrown on a cyclic graph.""" graph = { "a": ["b"], "b": ["c"], "c": ["d"], "d": ["a"], } def GetEdge(node): return tuple(graph[node]) self.assertRaises( gy...
[ "def", "test_Cycle", "(", "self", ")", ":", "graph", "=", "{", "\"a\"", ":", "[", "\"b\"", "]", ",", "\"b\"", ":", "[", "\"c\"", "]", ",", "\"c\"", ":", "[", "\"d\"", "]", ",", "\"d\"", ":", "[", "\"a\"", "]", ",", "}", "def", "GetEdge", "(", ...
[ 30, 4 ]
[ 44, 9 ]
python
en
['en', 'en', 'en']
True
check_disk_usage
(disk)
Verifies that there's enough free space on disk
Verifies that there's enough free space on disk
def check_disk_usage(disk): """Verifies that there's enough free space on disk""" du = shutil.disk_usage(disk) free = du.free / du.total * 100 return free > 20
[ "def", "check_disk_usage", "(", "disk", ")", ":", "du", "=", "shutil", ".", "disk_usage", "(", "disk", ")", "free", "=", "du", ".", "free", "/", "du", ".", "total", "*", "100", "return", "free", ">", "20" ]
[ 4, 0 ]
[ 8, 20 ]
python
en
['en', 'en', 'en']
True
check_cpu_usage
()
Verifies that there's enough unused CPU
Verifies that there's enough unused CPU
def check_cpu_usage(): """Verifies that there's enough unused CPU""" usage = psutil.cpu_percent(1) return usage < 75
[ "def", "check_cpu_usage", "(", ")", ":", "usage", "=", "psutil", ".", "cpu_percent", "(", "1", ")", "return", "usage", "<", "75" ]
[ 9, 0 ]
[ 12, 21 ]
python
en
['en', 'en', 'en']
True
sentence
()
Returns a randomly generated sentence of lorem ipsum text. The first word is capitalized, and the sentence ends in either a period or question mark. Commas are added at random.
Returns a randomly generated sentence of lorem ipsum text.
def sentence(): """ Returns a randomly generated sentence of lorem ipsum text. The first word is capitalized, and the sentence ends in either a period or question mark. Commas are added at random. """ # Determine the number of comma-separated sections and number of words in # each section f...
[ "def", "sentence", "(", ")", ":", "# Determine the number of comma-separated sections and number of words in", "# each section for this sentence.", "sections", "=", "[", "' '", ".", "join", "(", "random", ".", "sample", "(", "WORDS", ",", "random", ".", "randint", "(", ...
[ 57, 0 ]
[ 69, 64 ]
python
en
['en', 'error', 'th']
False
paragraph
()
Returns a randomly generated paragraph of lorem ipsum text. The paragraph consists of between 1 and 4 sentences, inclusive.
Returns a randomly generated paragraph of lorem ipsum text.
def paragraph(): """ Returns a randomly generated paragraph of lorem ipsum text. The paragraph consists of between 1 and 4 sentences, inclusive. """ return ' '.join(sentence() for i in range(random.randint(1, 4)))
[ "def", "paragraph", "(", ")", ":", "return", "' '", ".", "join", "(", "sentence", "(", ")", "for", "i", "in", "range", "(", "random", ".", "randint", "(", "1", ",", "4", ")", ")", ")" ]
[ 72, 0 ]
[ 78, 68 ]
python
en
['en', 'error', 'th']
False
paragraphs
(count, common=True)
Returns a list of paragraphs as returned by paragraph(). If `common` is True, then the first paragraph will be the standard 'lorem ipsum' paragraph. Otherwise, the first paragraph will be random Latin text. Either way, subsequent paragraphs will be random Latin text.
Returns a list of paragraphs as returned by paragraph().
def paragraphs(count, common=True): """ Returns a list of paragraphs as returned by paragraph(). If `common` is True, then the first paragraph will be the standard 'lorem ipsum' paragraph. Otherwise, the first paragraph will be random Latin text. Either way, subsequent paragraphs will be random Lat...
[ "def", "paragraphs", "(", "count", ",", "common", "=", "True", ")", ":", "paras", "=", "[", "]", "for", "i", "in", "range", "(", "count", ")", ":", "if", "common", "and", "i", "==", "0", ":", "paras", ".", "append", "(", "COMMON_P", ")", "else", ...
[ 81, 0 ]
[ 95, 16 ]
python
en
['en', 'error', 'th']
False
words
(count, common=True)
Returns a string of `count` lorem ipsum words separated by a single space. If `common` is True, then the first 19 words will be the standard 'lorem ipsum' words. Otherwise, all words will be selected randomly.
Returns a string of `count` lorem ipsum words separated by a single space.
def words(count, common=True): """ Returns a string of `count` lorem ipsum words separated by a single space. If `common` is True, then the first 19 words will be the standard 'lorem ipsum' words. Otherwise, all words will be selected randomly. """ word_list = list(COMMON_WORDS) if common else ...
[ "def", "words", "(", "count", ",", "common", "=", "True", ")", ":", "word_list", "=", "list", "(", "COMMON_WORDS", ")", "if", "common", "else", "[", "]", "c", "=", "len", "(", "word_list", ")", "if", "count", ">", "c", ":", "count", "-=", "c", "w...
[ 98, 0 ]
[ 115, 30 ]
python
en
['en', 'error', 'th']
False
skipIfCustomUser
(test_func)
Skip a test if a custom user model is in use.
Skip a test if a custom user model is in use.
def skipIfCustomUser(test_func): """ Skip a test if a custom user model is in use. """ warnings.warn( "django.contrib.auth.tests.utils.skipIfCustomUser is deprecated.", RemovedInDjango20Warning, stacklevel=2) return skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model ...
[ "def", "skipIfCustomUser", "(", "test_func", ")", ":", "warnings", ".", "warn", "(", "\"django.contrib.auth.tests.utils.skipIfCustomUser is deprecated.\"", ",", "RemovedInDjango20Warning", ",", "stacklevel", "=", "2", ")", "return", "skipIf", "(", "settings", ".", "AUTH...
[ 7, 0 ]
[ 15, 97 ]
python
en
['en', 'error', 'th']
False
get_abi3_suffix
()
Return the file extension for an abi3-compliant Extension()
Return the file extension for an abi3-compliant Extension()
def get_abi3_suffix(): """Return the file extension for an abi3-compliant Extension()""" for suffix in EXTENSION_SUFFIXES: if '.abi3' in suffix: # Unix return suffix elif suffix == '.pyd': # Windows return suffix
[ "def", "get_abi3_suffix", "(", ")", ":", "for", "suffix", "in", "EXTENSION_SUFFIXES", ":", "if", "'.abi3'", "in", "suffix", ":", "# Unix", "return", "suffix", "elif", "suffix", "==", "'.pyd'", ":", "# Windows", "return", "suffix" ]
[ 65, 0 ]
[ 71, 25 ]
python
en
['en', 'en', 'en']
True
build_ext.run
(self)
Build extensions in build directory, then copy if --inplace
Build extensions in build directory, then copy if --inplace
def run(self): """Build extensions in build directory, then copy if --inplace""" old_inplace, self.inplace = self.inplace, 0 _build_ext.run(self) self.inplace = old_inplace if old_inplace: self.copy_extensions_to_source()
[ "def", "run", "(", "self", ")", ":", "old_inplace", ",", "self", ".", "inplace", "=", "self", ".", "inplace", ",", "0", "_build_ext", ".", "run", "(", "self", ")", "self", ".", "inplace", "=", "old_inplace", "if", "old_inplace", ":", "self", ".", "co...
[ 75, 4 ]
[ 81, 44 ]
python
en
['en', 'en', 'en']
True
build_ext.links_to_dynamic
(self, ext)
Return true if 'ext' links to a dynamic lib in the same package
Return true if 'ext' links to a dynamic lib in the same package
def links_to_dynamic(self, ext): """Return true if 'ext' links to a dynamic lib in the same package""" # XXX this should check to ensure the lib is actually being built # XXX as dynamic, and not just using a locally-found version or a # XXX static-compiled version libnames = dict...
[ "def", "links_to_dynamic", "(", "self", ",", "ext", ")", ":", "# XXX this should check to ensure the lib is actually being built", "# XXX as dynamic, and not just using a locally-found version or a", "# XXX static-compiled version", "libnames", "=", "dict", ".", "fromkeys", "(", "[...
[ 202, 4 ]
[ 209, 74 ]
python
en
['en', 'en', 'en']
True
bootstrap_setting
(value)
Return value of a setting. Please consider this filter private for now, do not use it in your own templates.
Return value of a setting.
def bootstrap_setting(value): """ Return value of a setting. Please consider this filter private for now, do not use it in your own templates. """ return get_bootstrap_setting(value)
[ "def", "bootstrap_setting", "(", "value", ")", ":", "return", "get_bootstrap_setting", "(", "value", ")" ]
[ 43, 0 ]
[ 49, 39 ]
python
en
['en', 'error', 'th']
False
bootstrap_message_classes
(message)
Return the message classes for a message.
Return the message classes for a message.
def bootstrap_message_classes(message): """Return the message classes for a message.""" extra_tags = None try: extra_tags = message.extra_tags except AttributeError: pass if not extra_tags: extra_tags = "" classes = [extra_tags] try: level = message.level ...
[ "def", "bootstrap_message_classes", "(", "message", ")", ":", "extra_tags", "=", "None", "try", ":", "extra_tags", "=", "message", ".", "extra_tags", "except", "AttributeError", ":", "pass", "if", "not", "extra_tags", ":", "extra_tags", "=", "\"\"", "classes", ...
[ 53, 0 ]
[ 72, 36 ]
python
en
['en', 'en', 'en']
True
bootstrap_jquery_url
()
Return url to jquery resource. **Tag name**:: bootstrap_jquery_url Return the full url to jQuery file to use Default value: ``//code.jquery.com/jquery.min.js`` This value is configurable, see Settings section **Usage**:: {% bootstrap_jquery_url %} **Example**:: ...
Return url to jquery resource.
def bootstrap_jquery_url(): """ Return url to jquery resource. **Tag name**:: bootstrap_jquery_url Return the full url to jQuery file to use Default value: ``//code.jquery.com/jquery.min.js`` This value is configurable, see Settings section **Usage**:: {% bootstrap_jqu...
[ "def", "bootstrap_jquery_url", "(", ")", ":", "return", "jquery_url", "(", ")" ]
[ 76, 0 ]
[ 98, 23 ]
python
en
['en', 'error', 'th']
False
bootstrap_javascript_url
()
Return the full url to the Bootstrap JavaScript library. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_javascript_url **Usage**:: {% bootstrap_javascript_url %} **Example**:: {% bootstrap_javascript_url %}
Return the full url to the Bootstrap JavaScript library.
def bootstrap_javascript_url(): """ Return the full url to the Bootstrap JavaScript library. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_javascript_url **Usage**:: {% bootstrap_javascript_url %} **Example**:: ...
[ "def", "bootstrap_javascript_url", "(", ")", ":", "return", "javascript_url", "(", ")" ]
[ 102, 0 ]
[ 122, 27 ]
python
en
['en', 'error', 'th']
False
bootstrap_css_url
()
Return the full url to the Bootstrap CSS library. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_css_url **Usage**:: {% bootstrap_css_url %} **Example**:: {% bootstrap_css_url %}
Return the full url to the Bootstrap CSS library.
def bootstrap_css_url(): """ Return the full url to the Bootstrap CSS library. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_css_url **Usage**:: {% bootstrap_css_url %} **Example**:: {% bootstrap_css_url %} ...
[ "def", "bootstrap_css_url", "(", ")", ":", "return", "css_url", "(", ")" ]
[ 126, 0 ]
[ 146, 20 ]
python
en
['en', 'error', 'th']
False
bootstrap_theme_url
()
Return the full url to a Bootstrap theme CSS library. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_theme_url **Usage**:: {% bootstrap_theme_url %} **Example**:: {% bootstrap_theme_url %}
Return the full url to a Bootstrap theme CSS library.
def bootstrap_theme_url(): """ Return the full url to a Bootstrap theme CSS library. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_theme_url **Usage**:: {% bootstrap_theme_url %} **Example**:: {% bootstrap_th...
[ "def", "bootstrap_theme_url", "(", ")", ":", "return", "theme_url", "(", ")" ]
[ 150, 0 ]
[ 170, 22 ]
python
en
['en', 'error', 'th']
False
bootstrap_css
()
Return HTML for Bootstrap CSS. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_css **Usage**:: {% b...
Return HTML for Bootstrap CSS. Adjust url in settings.
def bootstrap_css(): """ Return HTML for Bootstrap CSS. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_css ...
[ "def", "bootstrap_css", "(", ")", ":", "rendered_urls", "=", "[", "render_link_tag", "(", "bootstrap_css_url", "(", ")", ")", "]", "if", "bootstrap_theme_url", "(", ")", ":", "rendered_urls", ".", "append", "(", "render_link_tag", "(", "bootstrap_theme_url", "("...
[ 174, 0 ]
[ 199, 61 ]
python
en
['en', 'error', 'th']
False
bootstrap_javascript
(jquery=None)
Return HTML for Bootstrap JavaScript. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: bootstrap_javascript **P...
Return HTML for Bootstrap JavaScript.
def bootstrap_javascript(jquery=None): """ Return HTML for Bootstrap JavaScript. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag n...
[ "def", "bootstrap_javascript", "(", "jquery", "=", "None", ")", ":", "javascript", "=", "\"\"", "# See if we have to include jQuery", "if", "jquery", "is", "None", ":", "jquery", "=", "get_bootstrap_setting", "(", "\"include_jquery\"", ",", "False", ")", "# NOTE: No...
[ 203, 0 ]
[ 244, 32 ]
python
en
['en', 'error', 'th']
False
bootstrap_formset
(*args, **kwargs)
Render a formset. **Tag name**:: bootstrap_formset **Parameters**: formset The formset that is being rendered See bootstrap_field_ for other arguments **Usage**:: {% bootstrap_formset formset %} **Example**:: {% bootstrap_formset formset...
Render a formset.
def bootstrap_formset(*args, **kwargs): """ Render a formset. **Tag name**:: bootstrap_formset **Parameters**: formset The formset that is being rendered See bootstrap_field_ for other arguments **Usage**:: {% bootstrap_formset formset %} **Ex...
[ "def", "bootstrap_formset", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_formset", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 248, 0 ]
[ 272, 42 ]
python
en
['en', 'error', 'th']
False
bootstrap_formset_errors
(*args, **kwargs)
Render formset errors. **Tag name**:: bootstrap_formset_errors **Parameters**: formset The formset that is being rendered layout Context value that is available in the template ``bootstrap3/form_errors.html`` as ``layout``. **Usage**:: ...
Render formset errors.
def bootstrap_formset_errors(*args, **kwargs): """ Render formset errors. **Tag name**:: bootstrap_formset_errors **Parameters**: formset The formset that is being rendered layout Context value that is available in the template ``bootstrap3/form_error...
[ "def", "bootstrap_formset_errors", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_formset_errors", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 276, 0 ]
[ 301, 49 ]
python
en
['en', 'error', 'th']
False
bootstrap_form
(*args, **kwargs)
Render a form. **Tag name**:: bootstrap_form **Parameters**: form The form that is to be rendered exclude A list of field names (comma separated) that should not be rendered E.g. exclude=subject,bcc error_types This contr...
Render a form.
def bootstrap_form(*args, **kwargs): """ Render a form. **Tag name**:: bootstrap_form **Parameters**: form The form that is to be rendered exclude A list of field names (comma separated) that should not be rendered E.g. exclude=subject,bcc...
[ "def", "bootstrap_form", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_form", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 305, 0 ]
[ 339, 39 ]
python
en
['en', 'error', 'th']
False
bootstrap_form_errors
(*args, **kwargs)
Render form errors. **Tag name**:: bootstrap_form_errors **Parameters**: form The form that is to be rendered error_types Control which type of errors should be rendered. One of the following values: * ``'all'`` ...
Render form errors.
def bootstrap_form_errors(*args, **kwargs): """ Render form errors. **Tag name**:: bootstrap_form_errors **Parameters**: form The form that is to be rendered error_types Control which type of errors should be rendered. One of the followin...
[ "def", "bootstrap_form_errors", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_form_errors", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 343, 0 ]
[ 378, 46 ]
python
en
['en', 'error', 'th']
False
bootstrap_field
(*args, **kwargs)
Render a field. **Tag name**:: bootstrap_field **Parameters**: field The form field to be rendered layout If set to ``'horizontal'`` then the field and label will be rendered side-by-side, as long as there is no ``field_class`` set as well. ...
Render a field.
def bootstrap_field(*args, **kwargs): """ Render a field. **Tag name**:: bootstrap_field **Parameters**: field The form field to be rendered layout If set to ``'horizontal'`` then the field and label will be rendered side-by-side, as long as there ...
[ "def", "bootstrap_field", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_field", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 382, 0 ]
[ 504, 40 ]
python
en
['en', 'error', 'th']
False
bootstrap_label
(*args, **kwargs)
Render a label. **Tag name**:: bootstrap_label **Parameters**: content The label's text label_for The value that will be in the ``for`` attribute of the rendered ``<label>`` label_class The CSS class for the rendered ``<label>`` ...
Render a label.
def bootstrap_label(*args, **kwargs): """ Render a label. **Tag name**:: bootstrap_label **Parameters**: content The label's text label_for The value that will be in the ``for`` attribute of the rendered ``<label>`` label_class Th...
[ "def", "bootstrap_label", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_label", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 508, 0 ]
[ 538, 40 ]
python
en
['en', 'error', 'th']
False
bootstrap_button
(*args, **kwargs)
Render a button. **Tag name**:: bootstrap_button **Parameters**: content The text to be displayed in the button button_type Optional field defining what type of button this is. Accepts one of the following values: * ``'submi...
Render a button.
def bootstrap_button(*args, **kwargs): """ Render a button. **Tag name**:: bootstrap_button **Parameters**: content The text to be displayed in the button button_type Optional field defining what type of button this is. Accepts one of the...
[ "def", "bootstrap_button", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "render_button", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 542, 0 ]
[ 604, 41 ]
python
en
['en', 'error', 'th']
False
bootstrap_icon
(icon, **kwargs)
Render an icon. **Tag name**:: bootstrap_icon **Parameters**: icon Icon name. See the `Bootstrap docs <http://getbootstrap.com/components/#glyphicons>`_ for all icons. extra_classes Extra CSS classes to add to the icon HTML title A t...
Render an icon.
def bootstrap_icon(icon, **kwargs): """ Render an icon. **Tag name**:: bootstrap_icon **Parameters**: icon Icon name. See the `Bootstrap docs <http://getbootstrap.com/components/#glyphicons>`_ for all icons. extra_classes Extra CSS classes to add to t...
[ "def", "bootstrap_icon", "(", "icon", ",", "*", "*", "kwargs", ")", ":", "return", "render_icon", "(", "icon", ",", "*", "*", "kwargs", ")" ]
[ 608, 0 ]
[ 635, 38 ]
python
en
['en', 'error', 'th']
False
bootstrap_alert
(content, alert_type="info", dismissable=True)
Render an alert. **Tag name**:: bootstrap_alert **Parameters**: content HTML content of alert alert_type * ``'info'`` * ``'warning'`` * ``'danger'`` * ``'success'`` :default: ``'info'`` dismissabl...
Render an alert.
def bootstrap_alert(content, alert_type="info", dismissable=True): """ Render an alert. **Tag name**:: bootstrap_alert **Parameters**: content HTML content of alert alert_type * ``'info'`` * ``'warning'`` * ``'danger'`` ...
[ "def", "bootstrap_alert", "(", "content", ",", "alert_type", "=", "\"info\"", ",", "dismissable", "=", "True", ")", ":", "return", "render_alert", "(", "content", ",", "alert_type", ",", "dismissable", ")" ]
[ 639, 0 ]
[ 673, 57 ]
python
en
['en', 'error', 'th']
False
bootstrap_buttons
(parser, token)
Render buttons for form. **Tag name**:: buttons **Parameters**: submit Text for a submit button reset Text for a reset button **Usage**:: {% buttons %}{% endbuttons %} **Example**:: {% buttons submit='OK' reset="Cancel" %}{% e...
Render buttons for form.
def bootstrap_buttons(parser, token): """ Render buttons for form. **Tag name**:: buttons **Parameters**: submit Text for a submit button reset Text for a reset button **Usage**:: {% buttons %}{% endbuttons %} **Example**:: ...
[ "def", "bootstrap_buttons", "(", "parser", ",", "token", ")", ":", "kwargs", "=", "parse_token_contents", "(", "parser", ",", "token", ")", "kwargs", "[", "\"nodelist\"", "]", "=", "parser", ".", "parse", "(", "(", "\"endbuttons\"", ",", ")", ")", "parser"...
[ 677, 0 ]
[ 704, 32 ]
python
en
['en', 'error', 'th']
False
bootstrap_messages
(context, *args, **kwargs)
Show django.contrib.messages Messages in Bootstrap alert containers. In order to make the alerts dismissable (with the close button), we have to set the jquery parameter too when using the bootstrap_javascript tag. Uses the template ``bootstrap3/messages.html``. **Tag name**:: boots...
Show django.contrib.messages Messages in Bootstrap alert containers.
def bootstrap_messages(context, *args, **kwargs): """ Show django.contrib.messages Messages in Bootstrap alert containers. In order to make the alerts dismissable (with the close button), we have to set the jquery parameter too when using the bootstrap_javascript tag. Uses the template ``boots...
[ "def", "bootstrap_messages", "(", "context", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Custom template tags with takes_context=True somehow return Context objects. These", "# should be forced to dict, using Context.flatten()", "if", "isinstance", "(", "context", "...
[ 736, 0 ]
[ 768, 76 ]
python
en
['en', 'error', 'th']
False
bootstrap_pagination
(page, **kwargs)
Render pagination for a page. **Tag name**:: bootstrap_pagination **Parameters**: page The page of results to show. pages_to_show Number of pages in total :default: ``11`` url URL to navigate to for pagination forward an...
Render pagination for a page.
def bootstrap_pagination(page, **kwargs): """ Render pagination for a page. **Tag name**:: bootstrap_pagination **Parameters**: page The page of results to show. pages_to_show Number of pages in total :default: ``11`` url ...
[ "def", "bootstrap_pagination", "(", "page", ",", "*", "*", "kwargs", ")", ":", "pagination_kwargs", "=", "kwargs", ".", "copy", "(", ")", "pagination_kwargs", "[", "\"page\"", "]", "=", "page", "return", "get_pagination_context", "(", "*", "*", "pagination_kwa...
[ 772, 0 ]
[ 828, 54 ]
python
en
['en', 'error', 'th']
False
get_pagination_context
(page, pages_to_show=11, url=None, size=None, extra=None, parameter_name="page")
Generate Bootstrap pagination context from a page object.
Generate Bootstrap pagination context from a page object.
def get_pagination_context(page, pages_to_show=11, url=None, size=None, extra=None, parameter_name="page"): """Generate Bootstrap pagination context from a page object.""" pages_to_show = int(pages_to_show) if pages_to_show < 1: raise ValueError( "Pagination pages_to_show should be a pos...
[ "def", "get_pagination_context", "(", "page", ",", "pages_to_show", "=", "11", ",", "url", "=", "None", ",", "size", "=", "None", ",", "extra", "=", "None", ",", "parameter_name", "=", "\"page\"", ")", ":", "pages_to_show", "=", "int", "(", "pages_to_show"...
[ 836, 0 ]
[ 913, 5 ]
python
en
['en', 'en', 'en']
True
ScriptMaker._build_shebang
(self, executable, post_interp)
Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using ...
Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using ...
def _build_shebang(self, executable, post_interp): """ Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang wh...
[ "def", "_build_shebang", "(", "self", ",", "executable", ",", "post_interp", ")", ":", "if", "os", ".", "name", "!=", "'posix'", ":", "simple_shebang", "=", "True", "else", ":", "# Add 3 for '#!' prefix and newline suffix.", "shebang_length", "=", "len", "(", "e...
[ 126, 4 ]
[ 155, 21 ]
python
en
['en', 'error', 'th']
False
ScriptMaker.make
(self, specification, options=None)
Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). ...
Make a script.
def make(self, specification, options=None): """ Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by ...
[ "def", "make", "(", "self", ",", "specification", ",", "options", "=", "None", ")", ":", "filenames", "=", "[", "]", "entry", "=", "get_export_entry", "(", "specification", ")", "if", "entry", "is", "None", ":", "self", ".", "_copy_script", "(", "specifi...
[ 390, 4 ]
[ 407, 24 ]
python
en
['en', 'error', 'th']
False
ScriptMaker.make_multiple
(self, specifications, options=None)
Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to,
Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to,
def make_multiple(self, specifications, options=None): """ Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, """ filenames = [] for specification in spec...
[ "def", "make_multiple", "(", "self", ",", "specifications", ",", "options", "=", "None", ")", ":", "filenames", "=", "[", "]", "for", "specification", "in", "specifications", ":", "filenames", ".", "extend", "(", "self", ".", "make", "(", "specification", ...
[ 409, 4 ]
[ 418, 24 ]
python
en
['en', 'error', 'th']
False
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): # type: (Optional[Dict[str, str]]) -> bool """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. ...
[ "def", "evaluate", "(", "self", ",", "environment", "=", "None", ")", ":", "# type: (Optional[Dict[str, str]]) -> bool", "current_environment", "=", "default_environment", "(", ")", "if", "environment", "is", "not", "None", ":", "current_environment", ".", "update", ...
[ 313, 4 ]
[ 327, 68 ]
python
en
['en', 'en', 'en']
True
diff_text
(a, b)
Performs a diffing algorithm on two pieces of text. Returns a string of HTML containing the content of both texts with <span> tags inserted indicating where the differences are.
Performs a diffing algorithm on two pieces of text. Returns a string of HTML containing the content of both texts with <span> tags inserted indicating where the differences are.
def diff_text(a, b): """ Performs a diffing algorithm on two pieces of text. Returns a string of HTML containing the content of both texts with <span> tags inserted indicating where the differences are. """ def tokenise(text): """ Tokenises a string by splitting it into individua...
[ "def", "diff_text", "(", "a", ",", "b", ")", ":", "def", "tokenise", "(", "text", ")", ":", "\"\"\"\n Tokenises a string by splitting it into individual characters\n and grouping the alphanumeric ones together.\n\n This means that punctuation, whitespace, CJK charact...
[ 602, 0 ]
[ 677, 35 ]
python
en
['en', 'error', 'th']
False
FieldComparison.field_label
(self)
Returns a label for this field to be displayed to the user
Returns a label for this field to be displayed to the user
def field_label(self): """ Returns a label for this field to be displayed to the user """ verbose_name = getattr(self.field, 'verbose_name', None) if verbose_name is None: # Relations don't have a verbose_name verbose_name = self.field.name.replace('_', '...
[ "def", "field_label", "(", "self", ")", ":", "verbose_name", "=", "getattr", "(", "self", ".", "field", ",", "'verbose_name'", ",", "None", ")", "if", "verbose_name", "is", "None", ":", "# Relations don't have a verbose_name", "verbose_name", "=", "self", ".", ...
[ 26, 4 ]
[ 36, 37 ]
python
en
['en', 'error', 'th']
False
FieldComparison.has_changed
(self)
Returns True if the field has changed
Returns True if the field has changed
def has_changed(self): """ Returns True if the field has changed """ return self.val_a != self.val_b
[ "def", "has_changed", "(", "self", ")", ":", "return", "self", ".", "val_a", "!=", "self", ".", "val_b" ]
[ 44, 4 ]
[ 48, 39 ]
python
en
['en', 'error', 'th']
False
BlockComparison.htmlvalue
(self, val)
Return an HTML representation of this block that is safe to be included in comparison views
Return an HTML representation of this block that is safe to be included in comparison views
def htmlvalue(self, val): """ Return an HTML representation of this block that is safe to be included in comparison views """ return escape(text_from_html(self.block.render_basic(val)))
[ "def", "htmlvalue", "(", "self", ",", "val", ")", ":", "return", "escape", "(", "text_from_html", "(", "self", ".", "block", ".", "render_basic", "(", "val", ")", ")", ")" ]
[ 100, 4 ]
[ 105, 67 ]
python
en
['en', 'error', 'th']
False
ChildRelationComparison.field_label
(self)
Returns a label for this field to be displayed to the user
Returns a label for this field to be displayed to the user
def field_label(self): """ Returns a label for this field to be displayed to the user """ verbose_name = getattr(self.field, 'verbose_name', None) if verbose_name is None: # Relations don't have a verbose_name verbose_name = self.field.name.replace('_', '...
[ "def", "field_label", "(", "self", ")", ":", "verbose_name", "=", "getattr", "(", "self", ".", "field", ",", "'verbose_name'", ",", "None", ")", "if", "verbose_name", "is", "None", ":", "# Relations don't have a verbose_name", "verbose_name", "=", "self", ".", ...
[ 345, 4 ]
[ 355, 37 ]
python
en
['en', 'error', 'th']
False
ChildRelationComparison.get_mapping
(self, objs_a, objs_b)
This bit of code attempts to match the objects in the A revision with their counterpart in the B revision. A match is firstly attempted by PK (where a matching ID indicates they're the same). We compare remaining the objects by their field data; the objects with the fewest fiel...
This bit of code attempts to match the objects in the A revision with their counterpart in the B revision.
def get_mapping(self, objs_a, objs_b): """ This bit of code attempts to match the objects in the A revision with their counterpart in the B revision. A match is firstly attempted by PK (where a matching ID indicates they're the same). We compare remaining the objects by their fi...
[ "def", "get_mapping", "(", "self", ",", "objs_a", ",", "objs_b", ")", ":", "map_forwards", "=", "{", "}", "map_backwards", "=", "{", "}", "added", "=", "[", "]", "deleted", "=", "[", "]", "# Match child objects on PK (ID)", "for", "a_idx", ",", "a_child", ...
[ 357, 4 ]
[ 445, 58 ]
python
en
['en', 'error', 'th']
False
ChildRelationComparison.get_child_comparisons
(self)
Returns a list of ChildObjectComparison objects. Representing all child objects that existed in either version. They are returned in the order they appear in the B version with deletions appended at the end. All child objects are returned, regardless of whether they were actua...
Returns a list of ChildObjectComparison objects. Representing all child objects that existed in either version.
def get_child_comparisons(self): """ Returns a list of ChildObjectComparison objects. Representing all child objects that existed in either version. They are returned in the order they appear in the B version with deletions appended at the end. All child objects are ret...
[ "def", "get_child_comparisons", "(", "self", ")", ":", "objs_a", "=", "list", "(", "self", ".", "val_a", ".", "all", "(", ")", ")", "objs_b", "=", "list", "(", "self", ".", "val_b", ".", "all", "(", ")", ")", "map_forwards", ",", "map_backwards", ","...
[ 450, 4 ]
[ 479, 26 ]
python
en
['en', 'error', 'th']
False
ChildRelationComparison.has_changed
(self)
Returns true if any changes were made to any of the child objects. This includes adding, deleting and reordering.
Returns true if any changes were made to any of the child objects. This includes adding, deleting and reordering.
def has_changed(self): """ Returns true if any changes were made to any of the child objects. This includes adding, deleting and reordering. """ objs_a = list(self.val_a.all()) objs_b = list(self.val_b.all()) map_forwards, map_backwards, added, deleted = self.get...
[ "def", "has_changed", "(", "self", ")", ":", "objs_a", "=", "list", "(", "self", ".", "val_a", ".", "all", "(", ")", ")", "objs_b", "=", "list", "(", "self", ".", "val_b", ".", "all", "(", ")", ")", "map_forwards", ",", "map_backwards", ",", "added...
[ 481, 4 ]
[ 500, 20 ]
python
en
['en', 'error', 'th']
False
ChildObjectComparison.is_addition
(self)
Returns True if this child object was created since obj_a
Returns True if this child object was created since obj_a
def is_addition(self): """ Returns True if this child object was created since obj_a """ return self.obj_b and not self.obj_a
[ "def", "is_addition", "(", "self", ")", ":", "return", "self", ".", "obj_b", "and", "not", "self", ".", "obj_a" ]
[ 510, 4 ]
[ 514, 44 ]
python
en
['en', 'error', 'th']
False
ChildObjectComparison.is_deletion
(self)
Returns True if this child object was deleted in obj_b
Returns True if this child object was deleted in obj_b
def is_deletion(self): """ Returns True if this child object was deleted in obj_b """ return self.obj_a and not self.obj_b
[ "def", "is_deletion", "(", "self", ")", ":", "return", "self", ".", "obj_a", "and", "not", "self", ".", "obj_b" ]
[ 516, 4 ]
[ 520, 44 ]
python
en
['en', 'error', 'th']
False
ChildObjectComparison.get_position_change
(self)
Returns the change in position as an integer. Positive if the object was moved down, negative if it moved up. For example: '3' indicates the object moved down three spaces. '-1' indicates the object moved up one space.
Returns the change in position as an integer. Positive if the object was moved down, negative if it moved up.
def get_position_change(self): """ Returns the change in position as an integer. Positive if the object was moved down, negative if it moved up. For example: '3' indicates the object moved down three spaces. '-1' indicates the object moved up one space. """ if no...
[ "def", "get_position_change", "(", "self", ")", ":", "if", "not", "self", ".", "is_addition", "(", ")", "and", "not", "self", ".", "is_deletion", "(", ")", ":", "sort_a", "=", "getattr", "(", "self", ".", "obj_a", ",", "'sort_order'", ",", "0", ")", ...
[ 522, 4 ]
[ 533, 34 ]
python
en
['en', 'error', 'th']
False
ChildObjectComparison.get_field_comparisons
(self)
Returns a list of comparisons for all the fields in this object. Fields that haven't changed are included as well.
Returns a list of comparisons for all the fields in this object. Fields that haven't changed are included as well.
def get_field_comparisons(self): """ Returns a list of comparisons for all the fields in this object. Fields that haven't changed are included as well. """ comparisons = [] if self.is_addition() or self.is_deletion(): # Display the fields without diff as one ...
[ "def", "get_field_comparisons", "(", "self", ")", ":", "comparisons", "=", "[", "]", "if", "self", ".", "is_addition", "(", ")", "or", "self", ".", "is_deletion", "(", ")", ":", "# Display the fields without diff as one of the versions are missing", "obj", "=", "s...
[ 535, 4 ]
[ 552, 26 ]
python
en
['en', 'error', 'th']
False
ChildObjectComparison.get_num_differences
(self)
Returns the number of fields that differ between the two objects.
Returns the number of fields that differ between the two objects.
def get_num_differences(self): """ Returns the number of fields that differ between the two objects. """ num_differences = 0 for comparison in self.get_field_comparisons(): if comparison.has_changed(): num_differences += 1 return num_...
[ "def", "get_num_differences", "(", "self", ")", ":", "num_differences", "=", "0", "for", "comparison", "in", "self", ".", "get_field_comparisons", "(", ")", ":", "if", "comparison", ".", "has_changed", "(", ")", ":", "num_differences", "+=", "1", "return", "...
[ 561, 4 ]
[ 572, 30 ]
python
en
['en', 'error', 'th']
False
AzureRMVirtualMachineScaleSet.get_vmss
(self)
Get the VMSS :return: VirtualMachineScaleSet object
Get the VMSS
def get_vmss(self): ''' Get the VMSS :return: VirtualMachineScaleSet object ''' try: vmss = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name) return vmss except CloudError as exc: self.fail("Error getti...
[ "def", "get_vmss", "(", "self", ")", ":", "try", ":", "vmss", "=", "self", ".", "compute_client", ".", "virtual_machine_scale_sets", ".", "get", "(", "self", ".", "resource_group", ",", "self", ".", "name", ")", "return", "vmss", "except", "CloudError", "a...
[ 883, 4 ]
[ 893, 102 ]
python
en
['en', 'error', 'th']
False
AzureRMVirtualMachineScaleSet.serialize_vmss
(self, vmss)
Convert a VirtualMachineScaleSet object to dict. :param vm: VirtualMachineScaleSet object :return: dict
Convert a VirtualMachineScaleSet object to dict.
def serialize_vmss(self, vmss): ''' Convert a VirtualMachineScaleSet object to dict. :param vm: VirtualMachineScaleSet object :return: dict ''' result = self.serialize_obj(vmss, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES) result['id'] = vmss.id ...
[ "def", "serialize_vmss", "(", "self", ",", "vmss", ")", ":", "result", "=", "self", ".", "serialize_obj", "(", "vmss", ",", "AZURE_OBJECT_CLASS", ",", "enum_modules", "=", "AZURE_ENUM_MODULES", ")", "result", "[", "'id'", "]", "=", "vmss", ".", "id", "resu...
[ 927, 4 ]
[ 942, 21 ]
python
en
['en', 'error', 'th']
False
AzureRMVirtualMachineScaleSet.vm_size_is_valid
(self)
Validate self.vm_size against the list of virtual machine sizes available for the account and location. :return: boolean
Validate self.vm_size against the list of virtual machine sizes available for the account and location.
def vm_size_is_valid(self): ''' Validate self.vm_size against the list of virtual machine sizes available for the account and location. :return: boolean ''' try: sizes = self.compute_client.virtual_machine_sizes.list(self.location) except CloudError as exc: ...
[ "def", "vm_size_is_valid", "(", "self", ")", ":", "try", ":", "sizes", "=", "self", ".", "compute_client", ".", "virtual_machine_sizes", ".", "list", "(", "self", ".", "location", ")", "except", "CloudError", "as", "exc", ":", "self", ".", "fail", "(", "...
[ 1002, 4 ]
[ 1015, 20 ]
python
en
['en', 'error', 'th']
False
build_message_list
( user: UserProfile, messages: List[Message], stream_map: Dict[int, Stream], # only needs id, name )
Builds the message list object for the message notification email template. The messages are collapsed into per-recipient and per-sender blocks, like our web interface
Builds the message list object for the message notification email template. The messages are collapsed into per-recipient and per-sender blocks, like our web interface
def build_message_list( user: UserProfile, messages: List[Message], stream_map: Dict[int, Stream], # only needs id, name ) -> List[Dict[str, Any]]: """ Builds the message list object for the message notification email template. The messages are collapsed into per-recipient and per-sender blocks...
[ "def", "build_message_list", "(", "user", ":", "UserProfile", ",", "messages", ":", "List", "[", "Message", "]", ",", "stream_map", ":", "Dict", "[", "int", ",", "Stream", "]", ",", "# only needs id, name", ")", "->", "List", "[", "Dict", "[", "str", ","...
[ 180, 0 ]
[ 317, 29 ]
python
en
['en', 'error', 'th']
False
get_narrow_url
( user_profile: UserProfile, message: Message, display_recipient: Optional[DisplayRecipientT] = None, stream: Optional[Stream] = None, )
The display_recipient and stream arguments are optional. If not provided, we'll compute them from the message; they exist as a performance optimization for cases where the caller needs those data too.
The display_recipient and stream arguments are optional. If not provided, we'll compute them from the message; they exist as a performance optimization for cases where the caller needs those data too.
def get_narrow_url( user_profile: UserProfile, message: Message, display_recipient: Optional[DisplayRecipientT] = None, stream: Optional[Stream] = None, ) -> str: """The display_recipient and stream arguments are optional. If not provided, we'll compute them from the message; they exist as a ...
[ "def", "get_narrow_url", "(", "user_profile", ":", "UserProfile", ",", "message", ":", "Message", ",", "display_recipient", ":", "Optional", "[", "DisplayRecipientT", "]", "=", "None", ",", "stream", ":", "Optional", "[", "Stream", "]", "=", "None", ",", ")"...
[ 320, 0 ]
[ 353, 81 ]
python
en
['en', 'en', 'en']
True
do_send_missedmessage_events_reply_in_zulip
( user_profile: UserProfile, missed_messages: List[Dict[str, Any]], message_count: int )
Send a reminder email to a user if she's missed some PMs by being offline. The email will have its reply to address set to a limited used email address that will send a Zulip message to the correct recipient. This allows the user to respond to missed PMs, huddles, and @-mentions directly from the ...
Send a reminder email to a user if she's missed some PMs by being offline.
def do_send_missedmessage_events_reply_in_zulip( user_profile: UserProfile, missed_messages: List[Dict[str, Any]], message_count: int ) -> None: """ Send a reminder email to a user if she's missed some PMs by being offline. The email will have its reply to address set to a limited used email addres...
[ "def", "do_send_missedmessage_events_reply_in_zulip", "(", "user_profile", ":", "UserProfile", ",", "missed_messages", ":", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ",", "message_count", ":", "int", ")", "->", "None", ":", "from", "zerver", ".", ...
[ 364, 0 ]
[ 528, 54 ]
python
en
['en', 'error', 'th']
False
MetaSequential._get_item_by_idx
(self, iterator, idx)
Get the idx-th item of the iterator
Get the idx-th item of the iterator
def _get_item_by_idx(self, iterator, idx): """Get the idx-th item of the iterator""" size = len(self) idx = operator.index(idx) if not -size <= idx < size: raise IndexError('index {} is out of range'.format(idx)) idx %= size return next(islice(iterator, idx, N...
[ "def", "_get_item_by_idx", "(", "self", ",", "iterator", ",", "idx", ")", ":", "size", "=", "len", "(", "self", ")", "idx", "=", "operator", ".", "index", "(", "idx", ")", "if", "not", "-", "size", "<=", "idx", "<", "size", ":", "raise", "IndexErro...
[ 234, 4 ]
[ 241, 48 ]
python
en
['en', 'en', 'en']
True
MetaModuleList._get_abs_string_index
(self, idx)
Get the absolute index for the list of modules
Get the absolute index for the list of modules
def _get_abs_string_index(self, idx): """Get the absolute index for the list of modules""" idx = operator.index(idx) if not (-len(self) <= idx < len(self)): raise IndexError('index {} is out of range'.format(idx)) if idx < 0: idx += len(self) return str(id...
[ "def", "_get_abs_string_index", "(", "self", ",", "idx", ")", ":", "idx", "=", "operator", ".", "index", "(", "idx", ")", "if", "not", "(", "-", "len", "(", "self", ")", "<=", "idx", "<", "len", "(", "self", ")", ")", ":", "raise", "IndexError", ...
[ 304, 4 ]
[ 311, 23 ]
python
en
['en', 'en', 'en']
True
MetaModuleList.insert
(self, index, module)
r"""Insert a given module before a given index in the list. Arguments: index (int): index to insert. module (MetaModule): module to insert
r"""Insert a given module before a given index in the list.
def insert(self, index, module): r"""Insert a given module before a given index in the list. Arguments: index (int): index to insert. module (MetaModule): module to insert """ for i in range(len(self._modules), index, -1): self._modules[str(i)] = self...
[ "def", "insert", "(", "self", ",", "index", ",", "module", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_modules", ")", ",", "index", ",", "-", "1", ")", ":", "self", ".", "_modules", "[", "str", "(", "i", ")", "]", "="...
[ 347, 4 ]
[ 356, 42 ]
python
en
['en', 'en', 'en']
True
MetaModuleList.append
(self, module)
r"""Appends a given module to the end of the list. Arguments: module (MetaModule): module to append
r"""Appends a given module to the end of the list.
def append(self, module): r"""Appends a given module to the end of the list. Arguments: module (MetaModule): module to append """ self.add_module(str(len(self)), module) return self
[ "def", "append", "(", "self", ",", "module", ")", ":", "self", ".", "add_module", "(", "str", "(", "len", "(", "self", ")", ")", ",", "module", ")", "return", "self" ]
[ 358, 4 ]
[ 365, 19 ]
python
en
['en', 'en', 'en']
True
MetaModuleList.extend
(self, modules)
r"""Appends modules from a Python iterable to the end of the list. Arguments: modules (iterable): iterable of modules to append
r"""Appends modules from a Python iterable to the end of the list.
def extend(self, modules): r"""Appends modules from a Python iterable to the end of the list. Arguments: modules (iterable): iterable of modules to append """ if not isinstance(modules, container_abcs.Iterable): raise TypeError("ModuleList.extend should be called...
[ "def", "extend", "(", "self", ",", "modules", ")", ":", "if", "not", "isinstance", "(", "modules", ",", "container_abcs", ".", "Iterable", ")", ":", "raise", "TypeError", "(", "\"ModuleList.extend should be called with an \"", "\"iterable, but got \"", "+", "type", ...
[ 367, 4 ]
[ 379, 19 ]
python
en
['en', 'en', 'en']
True
ModuleDict.clear
(self)
Remove all items from the ModuleDict.
Remove all items from the ModuleDict.
def clear(self): """Remove all items from the ModuleDict. """ self._modules.clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_modules", ".", "clear", "(", ")" ]
[ 447, 4 ]
[ 450, 29 ]
python
en
['en', 'en', 'en']
True
ModuleDict.pop
(self, key)
r"""Remove key from the ModuleDict and return its module. Arguments: key (string): key to pop from the ModuleDict
r"""Remove key from the ModuleDict and return its module.
def pop(self, key): r"""Remove key from the ModuleDict and return its module. Arguments: key (string): key to pop from the ModuleDict """ v = self[key] del self[key] return v
[ "def", "pop", "(", "self", ",", "key", ")", ":", "v", "=", "self", "[", "key", "]", "del", "self", "[", "key", "]", "return", "v" ]
[ 452, 4 ]
[ 460, 16 ]
python
en
['en', 'en', 'en']
True
ModuleDict.keys
(self)
r"""Return an iterable of the ModuleDict keys.
r"""Return an iterable of the ModuleDict keys.
def keys(self): r"""Return an iterable of the ModuleDict keys. """ return self._modules.keys()
[ "def", "keys", "(", "self", ")", ":", "return", "self", ".", "_modules", ".", "keys", "(", ")" ]
[ 462, 4 ]
[ 465, 35 ]
python
en
['en', 'en', 'en']
True
ModuleDict.items
(self)
r"""Return an iterable of the ModuleDict key/value pairs.
r"""Return an iterable of the ModuleDict key/value pairs.
def items(self): r"""Return an iterable of the ModuleDict key/value pairs. """ return self._modules.items()
[ "def", "items", "(", "self", ")", ":", "return", "self", ".", "_modules", ".", "items", "(", ")" ]
[ 467, 4 ]
[ 470, 36 ]
python
en
['en', 'en', 'en']
True
ModuleDict.values
(self)
r"""Return an iterable of the ModuleDict values.
r"""Return an iterable of the ModuleDict values.
def values(self): r"""Return an iterable of the ModuleDict values. """ return self._modules.values()
[ "def", "values", "(", "self", ")", ":", "return", "self", ".", "_modules", ".", "values", "(", ")" ]
[ 472, 4 ]
[ 475, 37 ]
python
en
['en', 'en', 'en']
True
ModuleDict.update
(self, modules)
r"""Update the :class:`~MetaModuleDict` with the key-value pairs from a mapping or an iterable, overwriting existing keys. .. note:: If :attr:`modules` is an ``OrderedDict``, a :class:`~MetaModuleDict`, or an iterable of key-value pairs, the order of new elements in it is preser...
r"""Update the :class:`~MetaModuleDict` with the key-value pairs from a mapping or an iterable, overwriting existing keys.
def update(self, modules): r"""Update the :class:`~MetaModuleDict` with the key-value pairs from a mapping or an iterable, overwriting existing keys. .. note:: If :attr:`modules` is an ``OrderedDict``, a :class:`~MetaModuleDict`, or an iterable of key-value pairs, the or...
[ "def", "update", "(", "self", ",", "modules", ")", ":", "if", "not", "isinstance", "(", "modules", ",", "container_abcs", ".", "Iterable", ")", ":", "raise", "TypeError", "(", "\"ModuleDict.update should be called with an \"", "\"iterable of key/value pairs, but got \""...
[ 477, 4 ]
[ 511, 33 ]
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
MiscTest.test_data_type_schema
(self)
We really only test this to get test coverage. The code covered here is really only used in testing tools.
We really only test this to get test coverage. The code covered here is really only used in testing tools.
def test_data_type_schema(self) -> None: """ We really only test this to get test coverage. The code covered here is really only used in testing tools. """ test_schema = DictType( [ ("type", Equals("realm")), ("maybe_n", OptionalType(i...
[ "def", "test_data_type_schema", "(", "self", ")", "->", "None", ":", "test_schema", "=", "DictType", "(", "[", "(", "\"type\"", ",", "Equals", "(", "\"realm\"", ")", ")", ",", "(", "\"maybe_n\"", ",", "OptionalType", "(", "int", ")", ")", ",", "(", "\"...
[ 17, 4 ]
[ 57, 79 ]
python
en
['en', 'error', 'th']
False
add_provision_check_override_param
(parser: ArgumentParser)
Registers --skip-provision-check argument to be used with various commands/tests in our tools.
Registers --skip-provision-check argument to be used with various commands/tests in our tools.
def add_provision_check_override_param(parser: ArgumentParser) -> None: """ Registers --skip-provision-check argument to be used with various commands/tests in our tools. """ parser.add_argument( "--skip-provision-check", action="store_true", help="Skip check that provision has b...
[ "def", "add_provision_check_override_param", "(", "parser", ":", "ArgumentParser", ")", "->", "None", ":", "parser", ".", "add_argument", "(", "\"--skip-provision-check\"", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"Skip check that provision has been run; ...
[ 93, 0 ]
[ 101, 5 ]
python
en
['en', 'error', 'th']
False
MakeGuid
(name, seed="msvs_new")
Returns a GUID for the specified target name. Args: name: Target name. seed: Seed for MD5 hash. Returns: A GUID-line string calculated from the name and seed. This generates something which looks like a GUID, but depends only on the name and seed. This means the same name/seed will always generat...
Returns a GUID for the specified target name.
def MakeGuid(name, seed="msvs_new"): """Returns a GUID for the specified target name. Args: name: Target name. seed: Seed for MD5 hash. Returns: A GUID-line string calculated from the name and seed. This generates something which looks like a GUID, but depends only on the name and seed. This ...
[ "def", "MakeGuid", "(", "name", ",", "seed", "=", "\"msvs_new\"", ")", ":", "# Calculate a MD5 signature for the seed and name.", "d", "=", "hashlib", ".", "md5", "(", "(", "str", "(", "seed", ")", "+", "str", "(", "name", ")", ")", ".", "encode", "(", "...
[ 34, 0 ]
[ 65, 15 ]
python
en
['en', 'en', 'en']
True
MSVSFolder.__init__
(self, path, name=None, entries=None, guid=None, items=None)
Initializes the folder. Args: path: Full path to the folder. name: Name of the folder. entries: List of folder entries to nest inside this folder. May contain Folder or Project objects. May be None, if the folder is empty. guid: GUID to use for folder, if not None. items: ...
Initializes the folder.
def __init__(self, path, name=None, entries=None, guid=None, items=None): """Initializes the folder. Args: path: Full path to the folder. name: Name of the folder. entries: List of folder entries to nest inside this folder. May contain Folder or Project objects. May be None, i...
[ "def", "__init__", "(", "self", ",", "path", ",", "name", "=", "None", ",", "entries", "=", "None", ",", "guid", "=", "None", ",", "items", "=", "None", ")", ":", "if", "name", ":", "self", ".", "name", "=", "name", "else", ":", "# Use last layer."...
[ 80, 4 ]
[ 105, 57 ]
python
en
['en', 'zu', 'en']
True
MSVSProject.__init__
( self, path, name=None, dependencies=None, guid=None, spec=None, build_file=None, config_platform_overrides=None, fixpath_prefix=None, )
Initializes the project. Args: path: Absolute path to the project file. name: Name of project. If None, the name will be the same as the base name of the project file. dependencies: List of other Project objects this project is dependent upon, if not None. guid: GUID to...
Initializes the project.
def __init__( self, path, name=None, dependencies=None, guid=None, spec=None, build_file=None, config_platform_overrides=None, fixpath_prefix=None, ): """Initializes the project. Args: path: Absolute path to the project file....
[ "def", "__init__", "(", "self", ",", "path", ",", "name", "=", "None", ",", "dependencies", "=", "None", ",", "guid", "=", "None", ",", "spec", "=", "None", ",", "build_file", "=", "None", ",", "config_platform_overrides", "=", "None", ",", "fixpath_pref...
[ 120, 4 ]
[ 163, 35 ]
python
en
['en', 'en', 'en']
True
MSVSSolution.__init__
( self, path, version, entries=None, variants=None, websiteProperties=True )
Initializes the solution. Args: path: Path to solution file. version: Format version to emit. entries: List of entries in solution. May contain Folder or Project objects. May be None, if the folder is empty. variants: List of build variant strings. If none, a default list will ...
Initializes the solution.
def __init__( self, path, version, entries=None, variants=None, websiteProperties=True ): """Initializes the solution. Args: path: Path to solution file. version: Format version to emit. entries: List of entries in solution. May contain Folder or Project objects. M...
[ "def", "__init__", "(", "self", ",", "path", ",", "version", ",", "entries", "=", "None", ",", "variants", "=", "None", ",", "websiteProperties", "=", "True", ")", ":", "self", ".", "path", "=", "path", "self", ".", "websiteProperties", "=", "websiteProp...
[ 195, 4 ]
[ 230, 20 ]
python
en
['en', 'en', 'en']
True
MSVSSolution.Write
(self, writer=gyp.common.WriteOnDiff)
Writes the solution file to disk. Raises: IndexError: An entry appears multiple times.
Writes the solution file to disk.
def Write(self, writer=gyp.common.WriteOnDiff): """Writes the solution file to disk. Raises: IndexError: An entry appears multiple times. """ # Walk the entry tree and collect all the folders and projects. all_entries = set() entries_to_check = self.entries[:] whil...
[ "def", "Write", "(", "self", ",", "writer", "=", "gyp", ".", "common", ".", "WriteOnDiff", ")", ":", "# Walk the entry tree and collect all the folders and projects.", "all_entries", "=", "set", "(", ")", "entries_to_check", "=", "self", ".", "entries", "[", ":", ...
[ 232, 4 ]
[ 369, 17 ]
python
en
['en', 'en', 'en']
True
get_object_usage
(obj)
Returns a queryset of pages that link to a particular object
Returns a queryset of pages that link to a particular object
def get_object_usage(obj): """Returns a queryset of pages that link to a particular object""" pages = Page.objects.none() # get all the relation objects for obj relations = [f for f in type(obj)._meta.get_fields(include_hidden=True) if (f.one_to_many or f.one_to_one) and f.auto_create...
[ "def", "get_object_usage", "(", "obj", ")", ":", "pages", "=", "Page", ".", "objects", ".", "none", "(", ")", "# get all the relation objects for obj", "relations", "=", "[", "f", "for", "f", "in", "type", "(", "obj", ")", ".", "_meta", ".", "get_fields", ...
[ 24, 0 ]
[ 54, 16 ]
python
en
['en', 'en', 'en']
True
popular_tags_for_model
(model, count=10)
Return a queryset of the most frequently used tags used on this model class
Return a queryset of the most frequently used tags used on this model class
def popular_tags_for_model(model, count=10): """Return a queryset of the most frequently used tags used on this model class""" content_type = ContentType.objects.get_for_model(model) return Tag.objects.filter( taggit_taggeditem_items__content_type=content_type ).annotate( item_count=Coun...
[ "def", "popular_tags_for_model", "(", "model", ",", "count", "=", "10", ")", ":", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "model", ")", "return", "Tag", ".", "objects", ".", "filter", "(", "taggit_taggeditem_items__content_...
[ 57, 0 ]
[ 64, 37 ]
python
en
['en', 'en', 'en']
True
parse_bits
(parser, bits, params, varargs, varkw, defaults, takes_context, name)
Parse bits for template tag helpers simple_tag and inclusion_tag, in particular by detecting syntax errors and by extracting positional and keyword arguments.
Parse bits for template tag helpers simple_tag and inclusion_tag, in particular by detecting syntax errors and by extracting positional and keyword arguments.
def parse_bits(parser, bits, params, varargs, varkw, defaults, takes_context, name): """ Parse bits for template tag helpers simple_tag and inclusion_tag, in particular by detecting syntax errors and by extracting positional and keyword arguments. """ if takes_context: if ...
[ "def", "parse_bits", "(", "parser", ",", "bits", ",", "params", ",", "varargs", ",", "varkw", ",", "defaults", ",", "takes_context", ",", "name", ")", ":", "if", "takes_context", ":", "if", "params", "[", "0", "]", "==", "'context'", ":", "params", "="...
[ 247, 0 ]
[ 312, 23 ]
python
en
['en', 'error', 'th']
False