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
AbstractUser.get_short_name
(self)
Returns the short name for the user.
Returns the short name for the user.
def get_short_name(self): "Returns the short name for the user." return self.first_name
[ "def", "get_short_name", "(", "self", ")", ":", "return", "self", ".", "first_name" ]
[ 420, 4 ]
[ 422, 30 ]
python
en
['en', 'en', 'en']
True
AbstractUser.email_user
(self, subject, message, from_email=None, **kwargs)
Sends an email to this User.
Sends an email to this User.
def email_user(self, subject, message, from_email=None, **kwargs): """ Sends an email to this User. """ send_mail(subject, message, from_email, [self.email], **kwargs)
[ "def", "email_user", "(", "self", ",", "subject", ",", "message", ",", "from_email", "=", "None", ",", "*", "*", "kwargs", ")", ":", "send_mail", "(", "subject", ",", "message", ",", "from_email", ",", "[", "self", ".", "email", "]", ",", "*", "*", ...
[ 424, 4 ]
[ 428, 71 ]
python
en
['en', 'error', 'th']
False
ImageFieldTestMixin.setUp
(self)
Creates a pristine temp directory (or deletes and recreates if it already exists) that the model uses as its storage directory. Sets up two ImageFile instances for use in tests.
Creates a pristine temp directory (or deletes and recreates if it already exists) that the model uses as its storage directory.
def setUp(self): """ Creates a pristine temp directory (or deletes and recreates if it already exists) that the model uses as its storage directory. Sets up two ImageFile instances for use in tests. """ if os.path.exists(temp_storage_dir): shutil.rmtree(temp_...
[ "def", "setUp", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "temp_storage_dir", ")", ":", "shutil", ".", "rmtree", "(", "temp_storage_dir", ")", "os", ".", "mkdir", "(", "temp_storage_dir", ")", "file_path1", "=", "os", ".", "pa...
[ 39, 4 ]
[ 54, 54 ]
python
en
['en', 'error', 'th']
False
ImageFieldTestMixin.tearDown
(self)
Removes temp directory and all its contents.
Removes temp directory and all its contents.
def tearDown(self): """ Removes temp directory and all its contents. """ self.file1.close() self.file2.close() shutil.rmtree(temp_storage_dir)
[ "def", "tearDown", "(", "self", ")", ":", "self", ".", "file1", ".", "close", "(", ")", "self", ".", "file2", ".", "close", "(", ")", "shutil", ".", "rmtree", "(", "temp_storage_dir", ")" ]
[ 56, 4 ]
[ 62, 39 ]
python
en
['en', 'error', 'th']
False
ImageFieldTestMixin.check_dimensions
(self, instance, width, height, field_name='mugshot')
Asserts that the given width and height values match both the field's height and width attributes and the height and width fields (if defined) the image field is caching to. Note, this method will check for dimension fields named by adding "_width" or "_height" to the name of t...
Asserts that the given width and height values match both the field's height and width attributes and the height and width fields (if defined) the image field is caching to.
def check_dimensions(self, instance, width, height, field_name='mugshot'): """ Asserts that the given width and height values match both the field's height and width attributes and the height and width fields (if defined) the image field is caching to. N...
[ "def", "check_dimensions", "(", "self", ",", "instance", ",", "width", ",", "height", ",", "field_name", "=", "'mugshot'", ")", ":", "field", "=", "getattr", "(", "instance", ",", "field_name", ")", "# Check height/width attributes of field.", "if", "width", "is...
[ 64, 4 ]
[ 94, 74 ]
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 missed message email template. The messages are collapsed into per-recipient and per-sender blocks, like our web interface
Builds the message list object for the missed message 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 missed message email template. The messages are collapsed into per-recipient and per-sender blocks, like...
[ "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 ]
[ 532, 54 ]
python
en
['en', 'error', 'th']
False
Node.__init__
(self, name)
Creates a Node :arg name: The tag name associated with the node
Creates a Node
def __init__(self, name): """Creates a Node :arg name: The tag name associated with the node """ # The tag name assocaited with the node self.name = name # The parent of the current node (or None for the document node) self.parent = None # The value of t...
[ "def", "__init__", "(", "self", ",", "name", ")", ":", "# The tag name assocaited with the node", "self", ".", "name", "=", "name", "# The parent of the current node (or None for the document node)", "self", ".", "parent", "=", "None", "# The value of the current node (applie...
[ 24, 4 ]
[ 42, 24 ]
python
en
['en', 'gl', 'en']
True
Node.appendChild
(self, node)
Insert node as a child of the current node :arg node: the node to insert
Insert node as a child of the current node
def appendChild(self, node): """Insert node as a child of the current node :arg node: the node to insert """ raise NotImplementedError
[ "def", "appendChild", "(", "self", ",", "node", ")", ":", "raise", "NotImplementedError" ]
[ 56, 4 ]
[ 62, 33 ]
python
en
['en', 'en', 'en']
True
Node.insertText
(self, data, insertBefore=None)
Insert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text. :arg data: the data to insert :arg insertBefore: True if you want to insert the text before the node and False if you want to insert it after the node ...
Insert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text.
def insertText(self, data, insertBefore=None): """Insert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text. :arg data: the data to insert :arg insertBefore: True if you want to insert the text before the node ...
[ "def", "insertText", "(", "self", ",", "data", ",", "insertBefore", "=", "None", ")", ":", "raise", "NotImplementedError" ]
[ 64, 4 ]
[ 74, 33 ]
python
en
['en', 'en', 'en']
True
Node.insertBefore
(self, node, refNode)
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node :arg node: the node to insert :arg refNode: the child node to insert the node before
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node
def insertBefore(self, node, refNode): """Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node :arg node: the node to insert :arg refNode: the child node to insert the node before ...
[ "def", "insertBefore", "(", "self", ",", "node", ",", "refNode", ")", ":", "raise", "NotImplementedError" ]
[ 76, 4 ]
[ 86, 33 ]
python
en
['en', 'en', 'en']
True
Node.removeChild
(self, node)
Remove node from the children of the current node :arg node: the child node to remove
Remove node from the children of the current node
def removeChild(self, node): """Remove node from the children of the current node :arg node: the child node to remove """ raise NotImplementedError
[ "def", "removeChild", "(", "self", ",", "node", ")", ":", "raise", "NotImplementedError" ]
[ 88, 4 ]
[ 94, 33 ]
python
en
['en', 'en', 'en']
True
Node.reparentChildren
(self, newParent)
Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way :arg newParent: the node to move all this node's children to
Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way
def reparentChildren(self, newParent): """Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way :arg newParent: the node to move all this node's children to """ # XXX - should...
[ "def", "reparentChildren", "(", "self", ",", "newParent", ")", ":", "# XXX - should this method be made more general?", "for", "child", "in", "self", ".", "childNodes", ":", "newParent", ".", "appendChild", "(", "child", ")", "self", ".", "childNodes", "=", "[", ...
[ 96, 4 ]
[ 107, 28 ]
python
en
['en', 'en', 'en']
True
Node.cloneNode
(self)
Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes
Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes
def cloneNode(self): """Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes """ raise NotImplementedError
[ "def", "cloneNode", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 109, 4 ]
[ 113, 33 ]
python
en
['en', 'pt', 'en']
True
Node.hasContent
(self)
Return true if the node has children or text, false otherwise
Return true if the node has children or text, false otherwise
def hasContent(self): """Return true if the node has children or text, false otherwise """ raise NotImplementedError
[ "def", "hasContent", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 115, 4 ]
[ 118, 33 ]
python
en
['en', 'en', 'en']
True
TreeBuilder.__init__
(self, namespaceHTMLElements)
Create a TreeBuilder :arg namespaceHTMLElements: whether or not to namespace HTML elements
Create a TreeBuilder
def __init__(self, namespaceHTMLElements): """Create a TreeBuilder :arg namespaceHTMLElements: whether or not to namespace HTML elements """ if namespaceHTMLElements: self.defaultNamespace = "http://www.w3.org/1999/xhtml" else: self.defaultNamespace = No...
[ "def", "__init__", "(", "self", ",", "namespaceHTMLElements", ")", ":", "if", "namespaceHTMLElements", ":", "self", ".", "defaultNamespace", "=", "\"http://www.w3.org/1999/xhtml\"", "else", ":", "self", ".", "defaultNamespace", "=", "None", "self", ".", "reset", "...
[ 171, 4 ]
[ 181, 20 ]
python
en
['en', 'ro', 'en']
True
TreeBuilder.elementInActiveFormattingElements
(self, name)
Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false
Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false
def elementInActiveFormattingElements(self, name): """Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false""" for item in self.activeFormattingElements[::-1]: # Check for Marker first becau...
[ "def", "elementInActiveFormattingElements", "(", "self", ",", "name", ")", ":", "for", "item", "in", "self", ".", "activeFormattingElements", "[", ":", ":", "-", "1", "]", ":", "# Check for Marker first because if it's a Marker it doesn't have a", "# name attribute.", "...
[ 268, 4 ]
[ 280, 20 ]
python
en
['en', 'en', 'en']
True
TreeBuilder.createElement
(self, token)
Create an element but don't insert it anywhere
Create an element but don't insert it anywhere
def createElement(self, token): """Create an element but don't insert it anywhere""" name = token["name"] namespace = token.get("namespace", self.defaultNamespace) element = self.elementClass(name, namespace) element.attributes = token["data"] return element
[ "def", "createElement", "(", "self", ",", "token", ")", ":", "name", "=", "token", "[", "\"name\"", "]", "namespace", "=", "token", ".", "get", "(", "\"namespace\"", ",", "self", ".", "defaultNamespace", ")", "element", "=", "self", ".", "elementClass", ...
[ 300, 4 ]
[ 306, 22 ]
python
en
['en', 'en', 'en']
True
TreeBuilder._setInsertFromTable
(self, value)
Switch the function used to insert an element from the normal one to the misnested table one and back again
Switch the function used to insert an element from the normal one to the misnested table one and back again
def _setInsertFromTable(self, value): """Switch the function used to insert an element from the normal one to the misnested table one and back again""" self._insertFromTable = value if value: self.insertElement = self.insertElementTable else: self.insertEl...
[ "def", "_setInsertFromTable", "(", "self", ",", "value", ")", ":", "self", ".", "_insertFromTable", "=", "value", "if", "value", ":", "self", ".", "insertElement", "=", "self", ".", "insertElementTable", "else", ":", "self", ".", "insertElement", "=", "self"...
[ 311, 4 ]
[ 318, 57 ]
python
en
['en', 'en', 'en']
True
TreeBuilder.insertElementTable
(self, token)
Create an element and insert it into the tree
Create an element and insert it into the tree
def insertElementTable(self, token): """Create an element and insert it into the tree""" element = self.createElement(token) if self.openElements[-1].name not in tableInsertModeElements: return self.insertElementNormal(token) else: # We should be in the InTable mo...
[ "def", "insertElementTable", "(", "self", ",", "token", ")", ":", "element", "=", "self", ".", "createElement", "(", "token", ")", "if", "self", ".", "openElements", "[", "-", "1", "]", ".", "name", "not", "in", "tableInsertModeElements", ":", "return", ...
[ 332, 4 ]
[ 346, 22 ]
python
en
['en', 'en', 'en']
True
TreeBuilder.insertText
(self, data, parent=None)
Insert text data.
Insert text data.
def insertText(self, data, parent=None): """Insert text data.""" if parent is None: parent = self.openElements[-1] if (not self.insertFromTable or (self.insertFromTable and self.openElements[-1].name n...
[ "def", "insertText", "(", "self", ",", "data", ",", "parent", "=", "None", ")", ":", "if", "parent", "is", "None", ":", "parent", "=", "self", ".", "openElements", "[", "-", "1", "]", "if", "(", "not", "self", ".", "insertFromTable", "or", "(", "se...
[ 348, 4 ]
[ 361, 49 ]
python
en
['fr', 'lb', 'en']
False
TreeBuilder.getTableMisnestedNodePosition
(self)
Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node
Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node
def getTableMisnestedNodePosition(self): """Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node""" # The foster parent element is the one which comes before the most # recently opened table element # XXX - this is really ine...
[ "def", "getTableMisnestedNodePosition", "(", "self", ")", ":", "# The foster parent element is the one which comes before the most", "# recently opened table element", "# XXX - this is really inelegant", "lastTable", "=", "None", "fosterParent", "=", "None", "insertBefore", "=", "N...
[ 363, 4 ]
[ 387, 41 ]
python
en
['en', 'en', 'en']
True
TreeBuilder.getDocument
(self)
Return the final tree
Return the final tree
def getDocument(self): """Return the final tree""" return self.document
[ "def", "getDocument", "(", "self", ")", ":", "return", "self", ".", "document" ]
[ 399, 4 ]
[ 401, 28 ]
python
en
['en', 'mt', 'en']
True
TreeBuilder.getFragment
(self)
Return the final fragment
Return the final fragment
def getFragment(self): """Return the final fragment""" # assert self.innerHTML fragment = self.fragmentClass() self.openElements[0].reparentChildren(fragment) return fragment
[ "def", "getFragment", "(", "self", ")", ":", "# assert self.innerHTML", "fragment", "=", "self", ".", "fragmentClass", "(", ")", "self", ".", "openElements", "[", "0", "]", ".", "reparentChildren", "(", "fragment", ")", "return", "fragment" ]
[ 403, 4 ]
[ 408, 23 ]
python
en
['en', 'no', 'en']
True
TreeBuilder.testSerializer
(self, node)
Serialize the subtree of node in the format required by unit tests :arg node: the node from which to start serializing
Serialize the subtree of node in the format required by unit tests
def testSerializer(self, node): """Serialize the subtree of node in the format required by unit tests :arg node: the node from which to start serializing """ raise NotImplementedError
[ "def", "testSerializer", "(", "self", ",", "node", ")", ":", "raise", "NotImplementedError" ]
[ 410, 4 ]
[ 416, 33 ]
python
en
['en', 'en', 'en']
True
DatabaseOperations.bulk_batch_size
(self, fields, objs)
SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of 999 variables per query. If there's only a single field to insert, the limit is 500 (SQLITE_MAX_COMPOUND_SELECT).
SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of 999 variables per query.
def bulk_batch_size(self, fields, objs): """ SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of 999 variables per query. If there's only a single field to insert, the limit is 500 (SQLITE_MAX_COMPOUND_SELECT). """ if len(fields) == 1: ...
[ "def", "bulk_batch_size", "(", "self", ",", "fields", ",", "objs", ")", ":", "if", "len", "(", "fields", ")", "==", "1", ":", "return", "500", "elif", "len", "(", "fields", ")", ">", "1", ":", "return", "self", ".", "connection", ".", "features", "...
[ 26, 4 ]
[ 39, 28 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.date_extract_sql
(self, lookup_type, field_name)
Support EXTRACT with a user-defined function django_date_extract() that's registered in connect(). Use single quotes because this is a string and could otherwise cause a collision with a field name.
Support EXTRACT with a user-defined function django_date_extract() that's registered in connect(). Use single quotes because this is a string and could otherwise cause a collision with a field name.
def date_extract_sql(self, lookup_type, field_name): """ Support EXTRACT with a user-defined function django_date_extract() that's registered in connect(). Use single quotes because this is a string and could otherwise cause a collision with a field name. """ return "djan...
[ "def", "date_extract_sql", "(", "self", ",", "lookup_type", ",", "field_name", ")", ":", "return", "\"django_date_extract('%s', %s)\"", "%", "(", "lookup_type", ".", "lower", "(", ")", ",", "field_name", ")" ]
[ 65, 4 ]
[ 71, 82 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.format_for_duration_arithmetic
(self, sql)
Do nothing since formatting is handled in the custom function.
Do nothing since formatting is handled in the custom function.
def format_for_duration_arithmetic(self, sql): """Do nothing since formatting is handled in the custom function.""" return sql
[ "def", "format_for_duration_arithmetic", "(", "self", ",", "sql", ")", ":", "return", "sql" ]
[ 76, 4 ]
[ 78, 18 ]
python
en
['en', 'en', 'en']
True
DatabaseOperations._quote_params_for_last_executed_query
(self, params)
Only for last_executed_query! Don't use this to execute SQL queries!
Only for last_executed_query! Don't use this to execute SQL queries!
def _quote_params_for_last_executed_query(self, params): """ Only for last_executed_query! Don't use this to execute SQL queries! """ # This function is limited both by SQLITE_LIMIT_VARIABLE_NUMBER (the # number of parameters, default = 999) and SQLITE_MAX_COLUMN (the # n...
[ "def", "_quote_params_for_last_executed_query", "(", "self", ",", "params", ")", ":", "# This function is limited both by SQLITE_LIMIT_VARIABLE_NUMBER (the", "# number of parameters, default = 999) and SQLITE_MAX_COLUMN (the", "# number of return values, default = 2000). Since Python's sqlite3",...
[ 117, 4 ]
[ 142, 26 ]
python
en
['en', 'error', 'th']
False
Paginator.validate_number
(self, number)
Validate the given 1-based page number.
Validate the given 1-based page number.
def validate_number(self, number): """Validate the given 1-based page number.""" try: if isinstance(number, float) and not number.is_integer(): raise ValueError number = int(number) except (TypeError, ValueError): raise PageNotAnInteger(_('That...
[ "def", "validate_number", "(", "self", ",", "number", ")", ":", "try", ":", "if", "isinstance", "(", "number", ",", "float", ")", "and", "not", "number", ".", "is_integer", "(", ")", ":", "raise", "ValueError", "number", "=", "int", "(", "number", ")",...
[ 37, 4 ]
[ 52, 21 ]
python
en
['en', 'en', 'en']
True
Paginator.get_page
(self, number)
Return a valid page, even if the page argument isn't a number or isn't in range.
Return a valid page, even if the page argument isn't a number or isn't in range.
def get_page(self, number): """ Return a valid page, even if the page argument isn't a number or isn't in range. """ try: number = self.validate_number(number) except PageNotAnInteger: number = 1 except EmptyPage: number = self....
[ "def", "get_page", "(", "self", ",", "number", ")", ":", "try", ":", "number", "=", "self", ".", "validate_number", "(", "number", ")", "except", "PageNotAnInteger", ":", "number", "=", "1", "except", "EmptyPage", ":", "number", "=", "self", ".", "num_pa...
[ 54, 4 ]
[ 65, 32 ]
python
en
['en', 'error', 'th']
False
Paginator.page
(self, number)
Return a Page object for the given 1-based page number.
Return a Page object for the given 1-based page number.
def page(self, number): """Return a Page object for the given 1-based page number.""" number = self.validate_number(number) bottom = (number - 1) * self.per_page top = bottom + self.per_page if top + self.orphans >= self.count: top = self.count return self._ge...
[ "def", "page", "(", "self", ",", "number", ")", ":", "number", "=", "self", ".", "validate_number", "(", "number", ")", "bottom", "=", "(", "number", "-", "1", ")", "*", "self", ".", "per_page", "top", "=", "bottom", "+", "self", ".", "per_page", "...
[ 67, 4 ]
[ 74, 73 ]
python
en
['en', 'en', 'en']
True
Paginator._get_page
(self, *args, **kwargs)
Return an instance of a single page. This hook can be used by subclasses to use an alternative to the standard :cls:`Page` object.
Return an instance of a single page.
def _get_page(self, *args, **kwargs): """ Return an instance of a single page. This hook can be used by subclasses to use an alternative to the standard :cls:`Page` object. """ return Page(*args, **kwargs)
[ "def", "_get_page", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "Page", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 76, 4 ]
[ 83, 36 ]
python
en
['en', 'error', 'th']
False
Paginator.count
(self)
Return the total number of objects, across all pages.
Return the total number of objects, across all pages.
def count(self): """Return the total number of objects, across all pages.""" c = getattr(self.object_list, 'count', None) if callable(c) and not inspect.isbuiltin(c) and method_has_no_args(c): return c() return len(self.object_list)
[ "def", "count", "(", "self", ")", ":", "c", "=", "getattr", "(", "self", ".", "object_list", ",", "'count'", ",", "None", ")", "if", "callable", "(", "c", ")", "and", "not", "inspect", ".", "isbuiltin", "(", "c", ")", "and", "method_has_no_args", "("...
[ 86, 4 ]
[ 91, 36 ]
python
en
['en', 'en', 'en']
True
Paginator.num_pages
(self)
Return the total number of pages.
Return the total number of pages.
def num_pages(self): """Return the total number of pages.""" if self.count == 0 and not self.allow_empty_first_page: return 0 hits = max(1, self.count - self.orphans) return ceil(hits / self.per_page)
[ "def", "num_pages", "(", "self", ")", ":", "if", "self", ".", "count", "==", "0", "and", "not", "self", ".", "allow_empty_first_page", ":", "return", "0", "hits", "=", "max", "(", "1", ",", "self", ".", "count", "-", "self", ".", "orphans", ")", "r...
[ 94, 4 ]
[ 99, 41 ]
python
en
['en', 'en', 'en']
True
Paginator.page_range
(self)
Return a 1-based range of pages for iterating through within a template for loop.
Return a 1-based range of pages for iterating through within a template for loop.
def page_range(self): """ Return a 1-based range of pages for iterating through within a template for loop. """ return range(1, self.num_pages + 1)
[ "def", "page_range", "(", "self", ")", ":", "return", "range", "(", "1", ",", "self", ".", "num_pages", "+", "1", ")" ]
[ 102, 4 ]
[ 107, 43 ]
python
en
['en', 'error', 'th']
False
Paginator._check_object_list_is_ordered
(self)
Warn if self.object_list is unordered (typically a QuerySet).
Warn if self.object_list is unordered (typically a QuerySet).
def _check_object_list_is_ordered(self): """ Warn if self.object_list is unordered (typically a QuerySet). """ ordered = getattr(self.object_list, 'ordered', None) if ordered is not None and not ordered: obj_list_repr = ( '{} {}'.format(self.object_lis...
[ "def", "_check_object_list_is_ordered", "(", "self", ")", ":", "ordered", "=", "getattr", "(", "self", ".", "object_list", ",", "'ordered'", ",", "None", ")", "if", "ordered", "is", "not", "None", "and", "not", "ordered", ":", "obj_list_repr", "=", "(", "'...
[ 109, 4 ]
[ 125, 13 ]
python
en
['en', 'error', 'th']
False
Page.start_index
(self)
Return the 1-based index of the first object on this page, relative to total objects in the paginator.
Return the 1-based index of the first object on this page, relative to total objects in the paginator.
def start_index(self): """ Return the 1-based index of the first object on this page, relative to total objects in the paginator. """ # Special case, return zero if no items. if self.paginator.count == 0: return 0 return (self.paginator.per_page * (sel...
[ "def", "start_index", "(", "self", ")", ":", "# Special case, return zero if no items.", "if", "self", ".", "paginator", ".", "count", "==", "0", ":", "return", "0", "return", "(", "self", ".", "paginator", ".", "per_page", "*", "(", "self", ".", "number", ...
[ 178, 4 ]
[ 186, 64 ]
python
en
['en', 'error', 'th']
False
Page.end_index
(self)
Return the 1-based index of the last object on this page, relative to total objects found (hits).
Return the 1-based index of the last object on this page, relative to total objects found (hits).
def end_index(self): """ Return the 1-based index of the last object on this page, relative to total objects found (hits). """ # Special case for the last page because there can be orphans. if self.number == self.paginator.num_pages: return self.paginator.coun...
[ "def", "end_index", "(", "self", ")", ":", "# Special case for the last page because there can be orphans.", "if", "self", ".", "number", "==", "self", ".", "paginator", ".", "num_pages", ":", "return", "self", ".", "paginator", ".", "count", "return", "self", "."...
[ 188, 4 ]
[ 196, 52 ]
python
en
['en', 'error', 'th']
False
IFDRational.__init__
(self, value, denominator=1)
:param value: either an integer numerator, a float/rational/other number, or an IFDRational :param denominator: Optional integer denominator
:param value: either an integer numerator, a float/rational/other number, or an IFDRational :param denominator: Optional integer denominator
def __init__(self, value, denominator=1): """ :param value: either an integer numerator, a float/rational/other number, or an IFDRational :param denominator: Optional integer denominator """ if isinstance(value, IFDRational): self._numerator = value.numerator ...
[ "def", "__init__", "(", "self", ",", "value", ",", "denominator", "=", "1", ")", ":", "if", "isinstance", "(", "value", ",", "IFDRational", ")", ":", "self", ".", "_numerator", "=", "value", ".", "numerator", "self", ".", "_denominator", "=", "value", ...
[ 301, 4 ]
[ 325, 52 ]
python
en
['en', 'error', 'th']
False
IFDRational.limit_rational
(self, max_denominator)
:param max_denominator: Integer, the maximum denominator value :returns: Tuple of (numerator, denominator)
def limit_rational(self, max_denominator): """ :param max_denominator: Integer, the maximum denominator value :returns: Tuple of (numerator, denominator) """ if self.denominator == 0: return (self.numerator, self.denominator) f = self._val.limit_denominator...
[ "def", "limit_rational", "(", "self", ",", "max_denominator", ")", ":", "if", "self", ".", "denominator", "==", "0", ":", "return", "(", "self", ".", "numerator", ",", "self", ".", "denominator", ")", "f", "=", "self", ".", "_val", ".", "limit_denominato...
[ 335, 4 ]
[ 346, 43 ]
python
en
['en', 'error', 'th']
False
ImageFileDirectory_v2.__init__
(self, ifh=b"II\052\0\0\0\0\0", prefix=None)
Initialize an ImageFileDirectory. To construct an ImageFileDirectory from a real file, pass the 8-byte magic header to the constructor. To only set the endianness, pass it as the 'prefix' keyword argument. :param ifh: One of the accepted magic headers (cf. PREFIXES); also sets ...
Initialize an ImageFileDirectory.
def __init__(self, ifh=b"II\052\0\0\0\0\0", prefix=None): """Initialize an ImageFileDirectory. To construct an ImageFileDirectory from a real file, pass the 8-byte magic header to the constructor. To only set the endianness, pass it as the 'prefix' keyword argument. :param ifh...
[ "def", "__init__", "(", "self", ",", "ifh", "=", "b\"II\\052\\0\\0\\0\\0\\0\"", ",", "prefix", "=", "None", ")", ":", "if", "ifh", "[", ":", "4", "]", "not", "in", "PREFIXES", ":", "raise", "SyntaxError", "(", "\"not a TIFF file (header %r not valid)\"", "%", ...
[ 454, 4 ]
[ 476, 32 ]
python
en
['en', 'en', 'en']
True
ImageFileDirectory_v2.named
(self)
:returns: dict of name|key: value Returns the complete tag dictionary, with named tags where possible.
:returns: dict of name|key: value
def named(self): """ :returns: dict of name|key: value Returns the complete tag dictionary, with named tags where possible. """ return {TiffTags.lookup(code).name: value for code, value in self.items()}
[ "def", "named", "(", "self", ")", ":", "return", "{", "TiffTags", ".", "lookup", "(", "code", ")", ".", "name", ":", "value", "for", "code", ",", "value", "in", "self", ".", "items", "(", ")", "}" ]
[ 497, 4 ]
[ 503, 82 ]
python
en
['en', 'error', 'th']
False
ImageFileDirectory_v1.from_v2
(cls, original)
Returns an :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` instance with the same data as is contained in the original :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` instance. :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`
Returns an :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` instance with the same data as is contained in the original :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` instance.
def from_v2(cls, original): """ Returns an :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` instance with the same data as is contained in the original :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` instance. :returns: :py:class:`~PIL.TiffImagePlugin.ImageF...
[ "def", "from_v2", "(", "cls", ",", "original", ")", ":", "ifd", "=", "cls", "(", "prefix", "=", "original", ".", "prefix", ")", "ifd", ".", "_tagdata", "=", "original", ".", "_tagdata", "ifd", ".", "tagtype", "=", "original", ".", "tagtype", "ifd", "...
[ 900, 4 ]
[ 915, 18 ]
python
en
['en', 'lb', 'en']
False
ImageFileDirectory_v1.to_v2
(self)
Returns an :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` instance with the same data as is contained in the original :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` instance. :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`
Returns an :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` instance with the same data as is contained in the original :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` instance.
def to_v2(self): """ Returns an :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` instance with the same data as is contained in the original :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` instance. :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirector...
[ "def", "to_v2", "(", "self", ")", ":", "ifd", "=", "ImageFileDirectory_v2", "(", "prefix", "=", "self", ".", "prefix", ")", "ifd", ".", "_tagdata", "=", "dict", "(", "self", ".", "_tagdata", ")", "ifd", ".", "tagtype", "=", "dict", "(", "self", ".", ...
[ 917, 4 ]
[ 932, 18 ]
python
en
['en', 'lb', 'en']
False
TiffImageFile._open
(self)
Open the first image in a TIFF file
Open the first image in a TIFF file
def _open(self): """Open the first image in a TIFF file""" # Header ifh = self.fp.read(8) # image file directory (tag dictionary) self.tag_v2 = ImageFileDirectory_v2(ifh) # legacy tag/ifd entries will be filled in later self.tag = self.ifd = None # set...
[ "def", "_open", "(", "self", ")", ":", "# Header", "ifh", "=", "self", ".", "fp", ".", "read", "(", "8", ")", "# image file directory (tag dictionary)", "self", ".", "tag_v2", "=", "ImageFileDirectory_v2", "(", "ifh", ")", "# legacy tag/ifd entries will be filled ...
[ 974, 4 ]
[ 998, 21 ]
python
en
['en', 'en', 'en']
True
TiffImageFile.seek
(self, frame)
Select a given frame as current image
Select a given frame as current image
def seek(self, frame): """Select a given frame as current image""" if not self._seek_check(frame): return self._seek(frame) # Create a new core image object on second and # subsequent frames in the image. Image may be # different size/mode. Image._deco...
[ "def", "seek", "(", "self", ",", "frame", ")", ":", "if", "not", "self", ".", "_seek_check", "(", "frame", ")", ":", "return", "self", ".", "_seek", "(", "frame", ")", "# Create a new core image object on second and", "# subsequent frames in the image. Image may be"...
[ 1010, 4 ]
[ 1019, 54 ]
python
en
['en', 'en', 'en']
True
TiffImageFile.tell
(self)
Return the current frame number
Return the current frame number
def tell(self): """Return the current frame number""" return self.__frame
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "__frame" ]
[ 1050, 4 ]
[ 1052, 27 ]
python
en
['en', 'da', 'en']
True
TiffImageFile._load_libtiff
(self)
Overload method triggered when we detect a compressed tiff Calls out to libtiff
Overload method triggered when we detect a compressed tiff Calls out to libtiff
def _load_libtiff(self): """ Overload method triggered when we detect a compressed tiff Calls out to libtiff """ Image.Image.load(self) self.load_prepare() if not len(self.tile) == 1: raise OSError("Not exactly one tile") # (self._compression, (extents...
[ "def", "_load_libtiff", "(", "self", ")", ":", "Image", ".", "Image", ".", "load", "(", "self", ")", "self", ".", "load_prepare", "(", ")", "if", "not", "len", "(", "self", ".", "tile", ")", "==", "1", ":", "raise", "OSError", "(", "\"Not exactly one...
[ 1079, 4 ]
[ 1162, 37 ]
python
en
['en', 'en', 'en']
True
TiffImageFile._setup
(self)
Setup this image object based on current tags
Setup this image object based on current tags
def _setup(self): """Setup this image object based on current tags""" if 0xBC01 in self.tag_v2: raise OSError("Windows Media Photo files not yet supported") # extract relevant tags self._compression = COMPRESSION_INFO[self.tag_v2.get(COMPRESSION, 1)] self._planar_co...
[ "def", "_setup", "(", "self", ")", ":", "if", "0xBC01", "in", "self", ".", "tag_v2", ":", "raise", "OSError", "(", "\"Windows Media Photo files not yet supported\"", ")", "# extract relevant tags", "self", ".", "_compression", "=", "COMPRESSION_INFO", "[", "self", ...
[ 1164, 4 ]
[ 1354, 56 ]
python
en
['en', 'en', 'en']
True
update_proxy_model_permissions
(apps, schema_editor, reverse=False)
Update the content_type of proxy model permissions to use the ContentType of the proxy model.
Update the content_type of proxy model permissions to use the ContentType of the proxy model.
def update_proxy_model_permissions(apps, schema_editor, reverse=False): """ Update the content_type of proxy model permissions to use the ContentType of the proxy model. """ style = color_style() Permission = apps.get_model('auth', 'Permission') ContentType = apps.get_model('contenttypes', '...
[ "def", "update_proxy_model_permissions", "(", "apps", ",", "schema_editor", ",", "reverse", "=", "False", ")", ":", "style", "=", "color_style", "(", ")", "Permission", "=", "apps", ".", "get_model", "(", "'auth'", ",", "'Permission'", ")", "ContentType", "=",...
[ 17, 0 ]
[ 51, 102 ]
python
en
['en', 'error', 'th']
False
revert_proxy_model_permissions
(apps, schema_editor)
Update the content_type of proxy model permissions to use the ContentType of the concrete model.
Update the content_type of proxy model permissions to use the ContentType of the concrete model.
def revert_proxy_model_permissions(apps, schema_editor): """ Update the content_type of proxy model permissions to use the ContentType of the concrete model. """ update_proxy_model_permissions(apps, schema_editor, reverse=True)
[ "def", "revert_proxy_model_permissions", "(", "apps", ",", "schema_editor", ")", ":", "update_proxy_model_permissions", "(", "apps", ",", "schema_editor", ",", "reverse", "=", "True", ")" ]
[ 54, 0 ]
[ 59, 69 ]
python
en
['en', 'error', 'th']
False
TestSigner.test_signature
(self)
signature() method should generate a signature
signature() method should generate a signature
def test_signature(self): "signature() method should generate a signature" signer = signing.Signer('predictable-secret') signer2 = signing.Signer('predictable-secret2') for s in ( b'hello', b'3098247:529:087:', '\u2019'.encode('utf-8'), ): ...
[ "def", "test_signature", "(", "self", ")", ":", "signer", "=", "signing", ".", "Signer", "(", "'predictable-secret'", ")", "signer2", "=", "signing", ".", "Signer", "(", "'predictable-secret2'", ")", "for", "s", "in", "(", "b'hello'", ",", "b'3098247:529:087:'...
[ 12, 4 ]
[ 26, 74 ]
python
en
['en', 'la', 'en']
True
TestSigner.test_signature_with_salt
(self)
signature(value, salt=...) should work
signature(value, salt=...) should work
def test_signature_with_salt(self): "signature(value, salt=...) should work" signer = signing.Signer('predictable-secret', salt='extra-salt') self.assertEqual( signer.signature('hello'), signing.base64_hmac('extra-salt' + 'signer', 'hello',...
[ "def", "test_signature_with_salt", "(", "self", ")", ":", "signer", "=", "signing", ".", "Signer", "(", "'predictable-secret'", ",", "salt", "=", "'extra-salt'", ")", "self", ".", "assertEqual", "(", "signer", ".", "signature", "(", "'hello'", ")", ",", "sig...
[ 28, 4 ]
[ 38, 80 ]
python
en
['en', 'da', 'en']
True
TestSigner.test_sign_unsign
(self)
sign/unsign should be reversible
sign/unsign should be reversible
def test_sign_unsign(self): "sign/unsign should be reversible" signer = signing.Signer('predictable-secret') examples = [ 'q;wjmbk;wkmb', '3098247529087', '3098247:529:087:', 'jkw osanteuh ,rcuh nthu aou oauh ,ud du', '\u2019', ...
[ "def", "test_sign_unsign", "(", "self", ")", ":", "signer", "=", "signing", ".", "Signer", "(", "'predictable-secret'", ")", "examples", "=", "[", "'q;wjmbk;wkmb'", ",", "'3098247529087'", ",", "'3098247:529:087:'", ",", "'jkw osanteuh ,rcuh nthu aou oauh ,ud du'", ",...
[ 40, 4 ]
[ 56, 60 ]
python
en
['en', 'en', 'en']
True
TestSigner.unsign_detects_tampering
(self)
unsign should raise an exception if the value has been tampered with
unsign should raise an exception if the value has been tampered with
def unsign_detects_tampering(self): "unsign should raise an exception if the value has been tampered with" signer = signing.Signer('predictable-secret') value = 'Another string' signed_value = signer.sign(value) transforms = ( lambda s: s.upper(), lambda s...
[ "def", "unsign_detects_tampering", "(", "self", ")", ":", "signer", "=", "signing", ".", "Signer", "(", "'predictable-secret'", ")", "value", "=", "'Another string'", "signed_value", "=", "signer", ".", "sign", "(", "value", ")", "transforms", "=", "(", "lambd...
[ 58, 4 ]
[ 72, 77 ]
python
en
['en', 'en', 'en']
True
TestSigner.test_dumps_loads
(self)
dumps and loads be reversible for any JSON serializable object
dumps and loads be reversible for any JSON serializable object
def test_dumps_loads(self): "dumps and loads be reversible for any JSON serializable object" objects = [ ['a', 'list'], 'a unicode string \u2019', {'a': 'dictionary'}, ] if six.PY2: objects.append(b'a byte string') for o in objects:...
[ "def", "test_dumps_loads", "(", "self", ")", ":", "objects", "=", "[", "[", "'a'", ",", "'list'", "]", ",", "'a unicode string \\u2019'", ",", "{", "'a'", ":", "'dictionary'", "}", ",", "]", "if", "six", ".", "PY2", ":", "objects", ".", "append", "(", ...
[ 74, 4 ]
[ 87, 79 ]
python
en
['en', 'en', 'en']
True
TestSigner.test_decode_detects_tampering
(self)
loads should raise exception for tampered objects
loads should raise exception for tampered objects
def test_decode_detects_tampering(self): "loads should raise exception for tampered objects" transforms = ( lambda s: s.upper(), lambda s: s + 'a', lambda s: 'a' + s[1:], lambda s: s.replace(':', ''), ) value = { 'foo': 'bar', ...
[ "def", "test_decode_detects_tampering", "(", "self", ")", ":", "transforms", "=", "(", "lambda", "s", ":", "s", ".", "upper", "(", ")", ",", "lambda", "s", ":", "s", "+", "'a'", ",", "lambda", "s", ":", "'a'", "+", "s", "[", "1", ":", "]", ",", ...
[ 89, 4 ]
[ 105, 72 ]
python
en
['en', 'en', 'en']
True
make_raw
(query: Any, exclude: Optional[List[Field]] = None)
Takes a Django query and returns a JSONable list of dictionaries corresponding to the database rows.
Takes a Django query and returns a JSONable list of dictionaries corresponding to the database rows.
def make_raw(query: Any, exclude: Optional[List[Field]] = None) -> List[Record]: """ Takes a Django query and returns a JSONable list of dictionaries corresponding to the database rows. """ rows = [] for instance in query: data = model_to_dict(instance, exclude=exclude) """ ...
[ "def", "make_raw", "(", "query", ":", "Any", ",", "exclude", ":", "Optional", "[", "List", "[", "Field", "]", "]", "=", "None", ")", "->", "List", "[", "Record", "]", ":", "rows", "=", "[", "]", "for", "instance", "in", "query", ":", "data", "=",...
[ 346, 0 ]
[ 366, 15 ]
python
en
['en', 'error', 'th']
False
fetch_attachment_data
(response: TableData, realm_id: int, message_ids: Set[int])
We usually export most messages for the realm, but not quite ALL messages for the realm. So, we need to clean up our attachment data to have correct values for response['zerver_attachment'][<n>]['messages'].
We usually export most messages for the realm, but not quite ALL messages for the realm. So, we need to clean up our attachment data to have correct values for response['zerver_attachment'][<n>]['messages'].
def fetch_attachment_data(response: TableData, realm_id: int, message_ids: Set[int]) -> None: filter_args = {"realm_id": realm_id} query = Attachment.objects.filter(**filter_args) response["zerver_attachment"] = make_raw(list(query)) floatify_datetime_fields(response, "zerver_attachment") """ W...
[ "def", "fetch_attachment_data", "(", "response", ":", "TableData", ",", "realm_id", ":", "int", ",", "message_ids", ":", "Set", "[", "int", "]", ")", "->", "None", ":", "filter_args", "=", "{", "\"realm_id\"", ":", "realm_id", "}", "query", "=", "Attachmen...
[ 908, 0 ]
[ 933, 5 ]
python
en
['en', 'error', 'th']
False
export_usermessages_batch
( input_path: Path, output_path: Path, consent_message_id: Optional[int] = None )
As part of the system for doing parallel exports, this runs on one batch of Message objects and adds the corresponding UserMessage objects. (This is called by the export_usermessage_batch management command).
As part of the system for doing parallel exports, this runs on one batch of Message objects and adds the corresponding UserMessage objects. (This is called by the export_usermessage_batch management command).
def export_usermessages_batch( input_path: Path, output_path: Path, consent_message_id: Optional[int] = None ) -> None: """As part of the system for doing parallel exports, this runs on one batch of Message objects and adds the corresponding UserMessage objects. (This is called by the export_usermessage...
[ "def", "export_usermessages_batch", "(", "input_path", ":", "Path", ",", "output_path", ":", "Path", ",", "consent_message_id", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "None", ":", "with", "open", "(", "input_path", ",", "\"rb\"", ")", "a...
[ 1010, 0 ]
[ 1028, 25 ]
python
en
['en', 'en', 'en']
True
BaseSpecifier.__str__
(self)
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
def __str__(self): """ Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. """
[ "def", "__str__", "(", "self", ")", ":" ]
[ 22, 4 ]
[ 26, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__hash__
(self)
Returns a hash value for this Specifier like object.
Returns a hash value for this Specifier like object.
def __hash__(self): """ Returns a hash value for this Specifier like object. """
[ "def", "__hash__", "(", "self", ")", ":" ]
[ 29, 4 ]
[ 32, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__eq__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are equal.
Returns a boolean representing whether or not the two Specifier like objects are equal.
def __eq__(self, other): """ Returns a boolean representing whether or not the two Specifier like objects are equal. """
[ "def", "__eq__", "(", "self", ",", "other", ")", ":" ]
[ 35, 4 ]
[ 39, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__ne__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are not equal.
Returns a boolean representing whether or not the two Specifier like objects are not equal.
def __ne__(self, other): """ Returns a boolean representing whether or not the two Specifier like objects are not equal. """
[ "def", "__ne__", "(", "self", ",", "other", ")", ":" ]
[ 42, 4 ]
[ 46, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.prereleases
(self)
Returns whether or not pre-releases as a whole are allowed by this specifier.
Returns whether or not pre-releases as a whole are allowed by this specifier.
def prereleases(self): """ Returns whether or not pre-releases as a whole are allowed by this specifier. """
[ "def", "prereleases", "(", "self", ")", ":" ]
[ 49, 4 ]
[ 53, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.prereleases
(self, value)
Sets whether or not pre-releases as a whole are allowed by this specifier.
Sets whether or not pre-releases as a whole are allowed by this specifier.
def prereleases(self, value): """ Sets whether or not pre-releases as a whole are allowed by this specifier. """
[ "def", "prereleases", "(", "self", ",", "value", ")", ":" ]
[ 56, 4 ]
[ 60, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.contains
(self, item, prereleases=None)
Determines if the given item is contained within this specifier.
Determines if the given item is contained within this specifier.
def contains(self, item, prereleases=None): """ Determines if the given item is contained within this specifier. """
[ "def", "contains", "(", "self", ",", "item", ",", "prereleases", "=", "None", ")", ":" ]
[ 63, 4 ]
[ 66, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.filter
(self, iterable, prereleases=None)
Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it.
Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it.
def filter(self, iterable, prereleases=None): """ Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. """
[ "def", "filter", "(", "self", ",", "iterable", ",", "prereleases", "=", "None", ")", ":" ]
[ 69, 4 ]
[ 73, 11 ]
python
en
['en', 'error', 'th']
False
to_native_string
(string, encoding='ascii')
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
def to_native_string(string, encoding='ascii'): """Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. """ if isinstance(string, builtin_str): out = stri...
[ "def", "to_native_string", "(", "string", ",", "encoding", "=", "'ascii'", ")", ":", "if", "isinstance", "(", "string", ",", "builtin_str", ")", ":", "out", "=", "string", "else", ":", "if", "is_py2", ":", "out", "=", "string", ".", "encode", "(", "enc...
[ 13, 0 ]
[ 26, 14 ]
python
en
['en', 'en', 'en']
True
unicode_is_ascii
(u_string)
Determine if unicode string only contains ASCII characters. :param str u_string: unicode string to check. Must be unicode and not Python 2 `str`. :rtype: bool
Determine if unicode string only contains ASCII characters.
def unicode_is_ascii(u_string): """Determine if unicode string only contains ASCII characters. :param str u_string: unicode string to check. Must be unicode and not Python 2 `str`. :rtype: bool """ assert isinstance(u_string, str) try: u_string.encode('ascii') return Tru...
[ "def", "unicode_is_ascii", "(", "u_string", ")", ":", "assert", "isinstance", "(", "u_string", ",", "str", ")", "try", ":", "u_string", ".", "encode", "(", "'ascii'", ")", "return", "True", "except", "UnicodeEncodeError", ":", "return", "False" ]
[ 29, 0 ]
[ 41, 20 ]
python
en
['en', 'en', 'en']
True
getiptcinfo
(im)
Get IPTC information from TIFF, JPEG, or IPTC file. :param im: An image containing IPTC data. :returns: A dictionary containing IPTC information, or None if no IPTC information block was found.
Get IPTC information from TIFF, JPEG, or IPTC file.
def getiptcinfo(im): """ Get IPTC information from TIFF, JPEG, or IPTC file. :param im: An image containing IPTC data. :returns: A dictionary containing IPTC information, or None if no IPTC information block was found. """ from . import TiffImagePlugin, JpegImagePlugin import io ...
[ "def", "getiptcinfo", "(", "im", ")", ":", "from", ".", "import", "TiffImagePlugin", ",", "JpegImagePlugin", "import", "io", "data", "=", "None", "if", "isinstance", "(", "im", ",", "IptcImageFile", ")", ":", "# return info dictionary right away", "return", "im"...
[ 175, 0 ]
[ 225, 18 ]
python
en
['en', 'error', 'th']
False
Mercurial.export
(self, location, url)
Export the Hg repository at the url to the destination location
Export the Hg repository at the url to the destination location
def export(self, location, url): # type: (str, HiddenText) -> None """Export the Hg repository at the url to the destination location""" with TempDirectory(kind="export") as temp_dir: self.unpack(temp_dir.path, url=url) self.run_command( ['archive', locat...
[ "def", "export", "(", "self", ",", "location", ",", "url", ")", ":", "# type: (str, HiddenText) -> None", "with", "TempDirectory", "(", "kind", "=", "\"export\"", ")", "as", "temp_dir", ":", "self", ".", "unpack", "(", "temp_dir", ".", "path", ",", "url", ...
[ 42, 4 ]
[ 50, 13 ]
python
en
['en', 'en', 'en']
True
Mercurial.get_revision
(cls, location)
Return the repository-local changeset revision number, as an integer.
Return the repository-local changeset revision number, as an integer.
def get_revision(cls, location): """ Return the repository-local changeset revision number, as an integer. """ current_revision = cls.run_command( ['parents', '--template={rev}'], show_stdout=False, cwd=location).strip() return current_revision
[ "def", "get_revision", "(", "cls", ",", "location", ")", ":", "current_revision", "=", "cls", ".", "run_command", "(", "[", "'parents'", ",", "'--template={rev}'", "]", ",", "show_stdout", "=", "False", ",", "cwd", "=", "location", ")", ".", "strip", "(", ...
[ 100, 4 ]
[ 107, 31 ]
python
en
['en', 'error', 'th']
False
Mercurial.get_requirement_revision
(cls, location)
Return the changeset identification hash, as a 40-character hexadecimal string
Return the changeset identification hash, as a 40-character hexadecimal string
def get_requirement_revision(cls, location): """ Return the changeset identification hash, as a 40-character hexadecimal string """ current_rev_hash = cls.run_command( ['parents', '--template={node}'], show_stdout=False, cwd=location).strip() retur...
[ "def", "get_requirement_revision", "(", "cls", ",", "location", ")", ":", "current_rev_hash", "=", "cls", ".", "run_command", "(", "[", "'parents'", ",", "'--template={node}'", "]", ",", "show_stdout", "=", "False", ",", "cwd", "=", "location", ")", ".", "st...
[ 110, 4 ]
[ 118, 31 ]
python
en
['en', 'error', 'th']
False
Mercurial.is_commit_id_equal
(cls, dest, name)
Always assume the versions don't match
Always assume the versions don't match
def is_commit_id_equal(cls, dest, name): """Always assume the versions don't match""" return False
[ "def", "is_commit_id_equal", "(", "cls", ",", "dest", ",", "name", ")", ":", "return", "False" ]
[ 121, 4 ]
[ 123, 20 ]
python
en
['en', 'en', 'en']
True
Mercurial.get_subdirectory
(cls, location)
Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root.
Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root.
def get_subdirectory(cls, location): """ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. """ # find the repo root repo_root = cls.run_command( ['root'], show_stdout=False, cwd=location).strip() if no...
[ "def", "get_subdirectory", "(", "cls", ",", "location", ")", ":", "# find the repo root", "repo_root", "=", "cls", ".", "run_command", "(", "[", "'root'", "]", ",", "show_stdout", "=", "False", ",", "cwd", "=", "location", ")", ".", "strip", "(", ")", "i...
[ 126, 4 ]
[ 136, 69 ]
python
en
['en', 'error', 'th']
False
form_hmac
(form)
Calculates a security hash for the given Form instance.
Calculates a security hash for the given Form instance.
def form_hmac(form): """ Calculates a security hash for the given Form instance. """ data = [] for bf in form: # Get the value from the form data. If the form allows empty or hasn't # changed then don't call clean() to avoid trigger validation errors. if form.empty_permitted ...
[ "def", "form_hmac", "(", "form", ")", ":", "data", "=", "[", "]", "for", "bf", "in", "form", ":", "# Get the value from the form data. If the form allows empty or hasn't", "# changed then don't call clean() to avoid trigger validation errors.", "if", "form", ".", "empty_permi...
[ 9, 0 ]
[ 27, 53 ]
python
en
['en', 'error', 'th']
False
PSDraw.begin_document
(self, id=None)
Set up printing of a document. (Write Postscript DSC header.)
Set up printing of a document. (Write Postscript DSC header.)
def begin_document(self, id=None): """Set up printing of a document. (Write Postscript DSC header.)""" # FIXME: incomplete self._fp_write( "%!PS-Adobe-3.0\n" "save\n" "/showpage { } def\n" "%%EndComments\n" "%%BeginDocument\n" )...
[ "def", "begin_document", "(", "self", ",", "id", "=", "None", ")", ":", "# FIXME: incomplete", "self", ".", "_fp_write", "(", "\"%!PS-Adobe-3.0\\n\"", "\"save\\n\"", "\"/showpage { } def\\n\"", "\"%%EndComments\\n\"", "\"%%BeginDocument\\n\"", ")", "# self._fp_write(ERROR_P...
[ 42, 4 ]
[ 56, 25 ]
python
en
['en', 'lb', 'en']
True
PSDraw.end_document
(self)
Ends printing. (Write Postscript DSC footer.)
Ends printing. (Write Postscript DSC footer.)
def end_document(self): """Ends printing. (Write Postscript DSC footer.)""" self._fp_write("%%EndDocument\nrestore showpage\n%%End\n") if hasattr(self.fp, "flush"): self.fp.flush()
[ "def", "end_document", "(", "self", ")", ":", "self", ".", "_fp_write", "(", "\"%%EndDocument\\nrestore showpage\\n%%End\\n\"", ")", "if", "hasattr", "(", "self", ".", "fp", ",", "\"flush\"", ")", ":", "self", ".", "fp", ".", "flush", "(", ")" ]
[ 58, 4 ]
[ 62, 27 ]
python
en
['de', 'en', 'en']
True
PSDraw.setfont
(self, font, size)
Selects which font to use. :param font: A Postscript font name :param size: Size in points.
Selects which font to use.
def setfont(self, font, size): """ Selects which font to use. :param font: A Postscript font name :param size: Size in points. """ if font not in self.isofont: # reencode font self._fp_write("/PSDraw-{} ISOLatin1Encoding /{} E\n".format(font, font...
[ "def", "setfont", "(", "self", ",", "font", ",", "size", ")", ":", "if", "font", "not", "in", "self", ".", "isofont", ":", "# reencode font", "self", ".", "_fp_write", "(", "\"/PSDraw-{} ISOLatin1Encoding /{} E\\n\"", ".", "format", "(", "font", ",", "font",...
[ 64, 4 ]
[ 76, 62 ]
python
en
['en', 'error', 'th']
False
PSDraw.line
(self, xy0, xy1)
Draws a line between the two points. Coordinates are given in Postscript point coordinates (72 points per inch, (0, 0) is the lower left corner of the page).
Draws a line between the two points. Coordinates are given in Postscript point coordinates (72 points per inch, (0, 0) is the lower left corner of the page).
def line(self, xy0, xy1): """ Draws a line between the two points. Coordinates are given in Postscript point coordinates (72 points per inch, (0, 0) is the lower left corner of the page). """ xy = xy0 + xy1 self._fp_write("%d %d %d %d Vl\n" % xy)
[ "def", "line", "(", "self", ",", "xy0", ",", "xy1", ")", ":", "xy", "=", "xy0", "+", "xy1", "self", ".", "_fp_write", "(", "\"%d %d %d %d Vl\\n\"", "%", "xy", ")" ]
[ 78, 4 ]
[ 85, 47 ]
python
en
['en', 'error', 'th']
False
PSDraw.rectangle
(self, box)
Draws a rectangle. :param box: A 4-tuple of integers whose order and function is currently undocumented. Hint: the tuple is passed into this format string: .. code-block:: python %d %d M %d %d 0 Vr\n
Draws a rectangle.
def rectangle(self, box): """ Draws a rectangle. :param box: A 4-tuple of integers whose order and function is currently undocumented. Hint: the tuple is passed into this format string: .. code-block:: python ...
[ "def", "rectangle", "(", "self", ",", "box", ")", ":", "self", ".", "_fp_write", "(", "\"%d %d M %d %d 0 Vr\\n\"", "%", "box", ")" ]
[ 87, 4 ]
[ 100, 52 ]
python
en
['en', 'error', 'th']
False
PSDraw.text
(self, xy, text)
Draws text at the given position. You must use :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
Draws text at the given position. You must use :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
def text(self, xy, text): """ Draws text at the given position. You must use :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method. """ text = "\\(".join(text.split("(")) text = "\\)".join(text.split(")")) xy = xy + (text,) self._fp_write("%d %d...
[ "def", "text", "(", "self", ",", "xy", ",", "text", ")", ":", "text", "=", "\"\\\\(\"", ".", "join", "(", "text", ".", "split", "(", "\"(\"", ")", ")", "text", "=", "\"\\\\)\"", ".", "join", "(", "text", ".", "split", "(", "\")\"", ")", ")", "x...
[ 102, 4 ]
[ 110, 47 ]
python
en
['en', 'error', 'th']
False
PSDraw.image
(self, box, im, dpi=None)
Draw a PIL image, centered in the given box.
Draw a PIL image, centered in the given box.
def image(self, box, im, dpi=None): """Draw a PIL image, centered in the given box.""" # default resolution depends on mode if not dpi: if im.mode == "1": dpi = 200 # fax else: dpi = 100 # greyscale # image size (on paper) ...
[ "def", "image", "(", "self", ",", "box", ",", "im", ",", "dpi", "=", "None", ")", ":", "# default resolution depends on mode", "if", "not", "dpi", ":", "if", "im", ".", "mode", "==", "\"1\"", ":", "dpi", "=", "200", "# fax", "else", ":", "dpi", "=", ...
[ 112, 4 ]
[ 141, 38 ]
python
en
['en', 'en', 'en']
True
_unicode_ci_compare
(s1, s2)
Perform case-insensitive comparison of two identifiers, using the recommended algorithm from Unicode Technical Report 36, section 2.11.2(B)(2).
Perform case-insensitive comparison of two identifiers, using the recommended algorithm from Unicode Technical Report 36, section 2.11.2(B)(2).
def _unicode_ci_compare(s1, s2): """ Perform case-insensitive comparison of two identifiers, using the recommended algorithm from Unicode Technical Report 36, section 2.11.2(B)(2). """ return unicodedata.normalize('NFKC', s1).casefold() == unicodedata.normalize('NFKC', s2).casefold()
[ "def", "_unicode_ci_compare", "(", "s1", ",", "s2", ")", ":", "return", "unicodedata", ".", "normalize", "(", "'NFKC'", ",", "s1", ")", ".", "casefold", "(", ")", "==", "unicodedata", ".", "normalize", "(", "'NFKC'", ",", "s2", ")", ".", "casefold", "(...
[ 22, 0 ]
[ 28, 103 ]
python
en
['en', 'error', 'th']
False
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().__init__(*args, **kwargs) ...
[ "def", "__init__", "(", "self", ",", "request", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "request", "=", "request", "self", ".", "user_cache", "=", "None", "super", "(", ")", ".", "__init__", "(", "*", "args", ...
[ 191, 4 ]
[ 206, 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'", ",", ")" ]
[ 221, 4 ]
[ 236, 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)
Send a django.core.mail.EmailMultiAlternatives to `to_email`.
Send 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): """ Send 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_...
[ 256, 4 ]
[ 271, 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. """ email_...
[ "def", "get_users", "(", "self", ",", "email", ")", ":", "email_field_name", "=", "UserModel", ".", "get_email_field_name", "(", ")", "active_users", "=", "UserModel", ".", "_default_manager", ".", "filter", "(", "*", "*", "{", "'%s__iexact'", "%", "email_fiel...
[ 273, 4 ]
[ 289, 9 ]
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...
Generate a one-use only link for resetting password and send it to the user.
Generate a one-use only link for resetting password and send it 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...
[ 291, 4 ]
[ 324, 13 ]
python
en
['en', 'error', 'th']
False
PasswordChangeForm.clean_old_password
(self)
Validate that the old_password field is correct.
Validate that the old_password field is correct.
def clean_old_password(self): """ Validate 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"...
[ 388, 4 ]
[ 398, 27 ]
python
en
['en', 'error', 'th']
False
AdminPasswordChangeForm.save
(self, commit=True)
Save the new password.
Save the new password.
def save(self, commit=True): """Save 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", ".", ...
[ 438, 4 ]
[ 444, 24 ]
python
en
['en', 'en', 'en']
True
resource_with_accessibility_data
(resource_in_unit, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red)
Resource is wheelchair accessible, not hearing accessible, unit is accessible to both
Resource is wheelchair accessible, not hearing accessible, unit is accessible to both
def resource_with_accessibility_data(resource_in_unit, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red): """ Resource is wheelchair accessible, not hearing accessible, un...
[ "def", "resource_with_accessibility_data", "(", "resource_in_unit", ",", "accessibility_viewpoint_wheelchair", ",", "accessibility_viewpoint_hearing", ",", "accessibility_value_green", ",", "accessibility_value_red", ")", ":", "ResourceAccessibility", ".", "objects", ".", "create...
[ 399, 0 ]
[ 427, 27 ]
python
en
['en', 'en', 'en']
True
resource_with_accessibility_data2
(resource_in_unit2, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red)
Resource is hearing accessible, not wheelchair accessible, unit is accessible to both
Resource is hearing accessible, not wheelchair accessible, unit is accessible to both
def resource_with_accessibility_data2(resource_in_unit2, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red): """ Resource is hearing accessible, not wheelchair accessible...
[ "def", "resource_with_accessibility_data2", "(", "resource_in_unit2", ",", "accessibility_viewpoint_wheelchair", ",", "accessibility_viewpoint_hearing", ",", "accessibility_value_green", ",", "accessibility_value_red", ")", ":", "ResourceAccessibility", ".", "objects", ".", "crea...
[ 431, 0 ]
[ 459, 28 ]
python
en
['en', 'en', 'en']
True
resource_with_accessibility_data3
(resource_in_unit3, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red)
Resource is accessible, unit is not
Resource is accessible, unit is not
def resource_with_accessibility_data3(resource_in_unit3, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red): """ Resource is accessible, unit is not """ ResourceAcces...
[ "def", "resource_with_accessibility_data3", "(", "resource_in_unit3", ",", "accessibility_viewpoint_wheelchair", ",", "accessibility_viewpoint_hearing", ",", "accessibility_value_green", ",", "accessibility_value_red", ")", ":", "ResourceAccessibility", ".", "objects", ".", "crea...
[ 463, 0 ]
[ 491, 28 ]
python
en
['en', 'en', 'en']
True
resource_with_accessibility_data4
(resource_in_unit4, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green)
Resource is accessible, unit is accessible
Resource is accessible, unit is accessible
def resource_with_accessibility_data4(resource_in_unit4, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green): """ Resource is accessible, unit is accessible """ ResourceAccessibility.objects.create( resource=resource_in_un...
[ "def", "resource_with_accessibility_data4", "(", "resource_in_unit4", ",", "accessibility_viewpoint_wheelchair", ",", "accessibility_viewpoint_hearing", ",", "accessibility_value_green", ")", ":", "ResourceAccessibility", ".", "objects", ".", "create", "(", "resource", "=", "...
[ 495, 0 ]
[ 522, 28 ]
python
en
['en', 'en', 'en']
True
BaseContext.__setitem__
(self, key, value)
Set a variable in the current context
Set a variable in the current context
def __setitem__(self, key, value): "Set a variable in the current context" self.dicts[-1][key] = value
[ "def", "__setitem__", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "dicts", "[", "-", "1", "]", "[", "key", "]", "=", "value" ]
[ 60, 4 ]
[ 62, 35 ]
python
en
['en', 'en', 'en']
True
BaseContext.__getitem__
(self, key)
Get a variable's value, starting at the current context and going upward
Get a variable's value, starting at the current context and going upward
def __getitem__(self, key): "Get a variable's value, starting at the current context and going upward" for d in reversed(self.dicts): if key in d: return d[key] raise KeyError(key)
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "for", "d", "in", "reversed", "(", "self", ".", "dicts", ")", ":", "if", "key", "in", "d", ":", "return", "d", "[", "key", "]", "raise", "KeyError", "(", "key", ")" ]
[ 64, 4 ]
[ 69, 27 ]
python
en
['en', 'en', 'en']
True