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
SchemaObject.all
(self)
Get whether this is an <xs:all/> @return: True if any, else False @rtype: boolean
Get whether this is an <xs:all/>
def all(self): """ Get whether this is an <xs:all/> @return: True if any, else False @rtype: boolean """ return False
[ "def", "all", "(", "self", ")", ":", "return", "False" ]
[ 236, 4 ]
[ 242, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.choice
(self)
Get whether this is n <xs:choice/> @return: True if any, else False @rtype: boolean
Get whether this is n <xs:choice/>
def choice(self): """ Get whether this is n <xs:choice/> @return: True if any, else False @rtype: boolean """ return False
[ "def", "choice", "(", "self", ")", ":", "return", "False" ]
[ 244, 4 ]
[ 250, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.any
(self)
Get whether this is an <xs:any/> @return: True if any, else False @rtype: boolean
Get whether this is an <xs:any/>
def any(self): """ Get whether this is an <xs:any/> @return: True if any, else False @rtype: boolean """ return False
[ "def", "any", "(", "self", ")", ":", "return", "False" ]
[ 252, 4 ]
[ 258, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.builtin
(self)
Get whether this is a schema-instance (xs) type. @return: True if any, else False @rtype: boolean
Get whether this is a schema-instance (xs) type.
def builtin(self): """ Get whether this is a schema-instance (xs) type. @return: True if any, else False @rtype: boolean """ return False
[ "def", "builtin", "(", "self", ")", ":", "return", "False" ]
[ 260, 4 ]
[ 266, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.enum
(self)
Get whether this is a simple-type containing an enumeration. @return: True if any, else False @rtype: boolean
Get whether this is a simple-type containing an enumeration.
def enum(self): """ Get whether this is a simple-type containing an enumeration. @return: True if any, else False @rtype: boolean """ return False
[ "def", "enum", "(", "self", ")", ":", "return", "False" ]
[ 268, 4 ]
[ 274, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.isattr
(self)
Get whether the object is a schema I{attribute} definition. @return: True if an attribute, else False. @rtype: boolean
Get whether the object is a schema I{attribute} definition.
def isattr(self): """ Get whether the object is a schema I{attribute} definition. @return: True if an attribute, else False. @rtype: boolean """ return False
[ "def", "isattr", "(", "self", ")", ":", "return", "False" ]
[ 276, 4 ]
[ 282, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.extension
(self)
Get whether the object is an extension of another type. @return: True if an extension, else False. @rtype: boolean
Get whether the object is an extension of another type.
def extension(self): """ Get whether the object is an extension of another type. @return: True if an extension, else False. @rtype: boolean """ return False
[ "def", "extension", "(", "self", ")", ":", "return", "False" ]
[ 284, 4 ]
[ 290, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.restriction
(self)
Get whether the object is an restriction of another type. @return: True if an restriction, else False. @rtype: boolean
Get whether the object is an restriction of another type.
def restriction(self): """ Get whether the object is an restriction of another type. @return: True if an restriction, else False. @rtype: boolean """ return False
[ "def", "restriction", "(", "self", ")", ":", "return", "False" ]
[ 292, 4 ]
[ 298, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.mixed
(self)
Get whether this I{mixed} content.
Get whether this I{mixed} content.
def mixed(self): """ Get whether this I{mixed} content. """ return False
[ "def", "mixed", "(", "self", ")", ":", "return", "False" ]
[ 300, 4 ]
[ 304, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.find
(self, qref, classes=())
Find a referenced type in self or children. @param qref: A qualified reference. @type qref: qref @param classes: A list of classes used to qualify the match. @type classes: [I{class},...] @return: The referenced type. @rtype: L{SchemaObject} @see: L{qual...
Find a referenced type in self or children.
def find(self, qref, classes=()): """ Find a referenced type in self or children. @param qref: A qualified reference. @type qref: qref @param classes: A list of classes used to qualify the match. @type classes: [I{class},...] @return: The referenced type. ...
[ "def", "find", "(", "self", ",", "qref", ",", "classes", "=", "(", ")", ")", ":", "if", "not", "len", "(", "classes", ")", ":", "classes", "=", "(", "self", ".", "__class__", ",", ")", "if", "self", ".", "qname", "==", "qref", "and", "self", "....
[ 306, 4 ]
[ 325, 19 ]
python
en
['en', 'error', 'th']
False
SchemaObject.translate
(self, value, topython=True)
Translate a value (type) to/from a python type. @param value: A value to translate. @return: The converted I{language} type.
Translate a value (type) to/from a python type.
def translate(self, value, topython=True): """ Translate a value (type) to/from a python type. @param value: A value to translate. @return: The converted I{language} type. """ return value
[ "def", "translate", "(", "self", ",", "value", ",", "topython", "=", "True", ")", ":", "return", "value" ]
[ 327, 4 ]
[ 333, 20 ]
python
en
['en', 'error', 'th']
False
SchemaObject.childtags
(self)
Get a list of valid child tag names. @return: A list of child tag names. @rtype: [str,...]
Get a list of valid child tag names.
def childtags(self): """ Get a list of valid child tag names. @return: A list of child tag names. @rtype: [str,...] """ return ()
[ "def", "childtags", "(", "self", ")", ":", "return", "(", ")" ]
[ 335, 4 ]
[ 341, 17 ]
python
en
['en', 'error', 'th']
False
SchemaObject.dependencies
(self)
Get a list of dependancies for dereferencing. @return: A merge dependancy index and a list of dependancies. @rtype: (int, [L{SchemaObject},...])
Get a list of dependancies for dereferencing.
def dependencies(self): """ Get a list of dependancies for dereferencing. @return: A merge dependancy index and a list of dependancies. @rtype: (int, [L{SchemaObject},...]) """ return (None, [])
[ "def", "dependencies", "(", "self", ")", ":", "return", "(", "None", ",", "[", "]", ")" ]
[ 343, 4 ]
[ 349, 25 ]
python
en
['en', 'error', 'th']
False
SchemaObject.autoqualified
(self)
The list of I{auto} qualified attribute values. Qualification means to convert values into I{qref}. @return: A list of attibute names. @rtype: list
The list of I{auto} qualified attribute values. Qualification means to convert values into I{qref}.
def autoqualified(self): """ The list of I{auto} qualified attribute values. Qualification means to convert values into I{qref}. @return: A list of attibute names. @rtype: list """ return ['type', 'ref']
[ "def", "autoqualified", "(", "self", ")", ":", "return", "[", "'type'", ",", "'ref'", "]" ]
[ 351, 4 ]
[ 358, 30 ]
python
en
['en', 'error', 'th']
False
SchemaObject.qualify
(self)
Convert attribute values, that are references to other objects, into I{qref}. Qualfied using default document namespace. Since many wsdls are written improperly: when the document does not define a default namespace, the schema target namespace is used to qualify references. ...
Convert attribute values, that are references to other objects, into I{qref}. Qualfied using default document namespace. Since many wsdls are written improperly: when the document does not define a default namespace, the schema target namespace is used to qualify references. ...
def qualify(self): """ Convert attribute values, that are references to other objects, into I{qref}. Qualfied using default document namespace. Since many wsdls are written improperly: when the document does not define a default namespace, the schema target namespace is used ...
[ "def", "qualify", "(", "self", ")", ":", "defns", "=", "self", ".", "root", ".", "defaultNamespace", "(", ")", "if", "Namespace", ".", "none", "(", "defns", ")", ":", "defns", "=", "self", ".", "schema", ".", "tns", "for", "a", "in", "self", ".", ...
[ 360, 4 ]
[ 379, 34 ]
python
en
['en', 'error', 'th']
False
SchemaObject.merge
(self, other)
Merge another object as needed.
Merge another object as needed.
def merge(self, other): """ Merge another object as needed. """ other.qualify() for n in ('name', 'qname', 'min', 'max', 'default', 'type', 'nillable', 'f...
[ "def", "merge", "(", "self", ",", "other", ")", ":", "other", ".", "qualify", "(", ")", "for", "n", "in", "(", "'name'", ",", "'qname'", ",", "'min'", ",", "'max'", ",", "'default'", ",", "'type'", ",", "'nillable'", ",", "'form_qualified'", ",", ")"...
[ 381, 4 ]
[ 399, 31 ]
python
en
['en', 'error', 'th']
False
SchemaObject.content
(self, collection=None, filter=Filter(), history=None)
Get a I{flattened} list of this nodes contents. @param collection: A list to fill. @type collection: list @param filter: A filter used to constrain the result. @type filter: L{Filter} @param history: The history list used to prevent cyclic dependency. @type histo...
Get a I{flattened} list of this nodes contents.
def content(self, collection=None, filter=Filter(), history=None): """ Get a I{flattened} list of this nodes contents. @param collection: A list to fill. @type collection: list @param filter: A filter used to constrain the result. @type filter: L{Filter} @param hi...
[ "def", "content", "(", "self", ",", "collection", "=", "None", ",", "filter", "=", "Filter", "(", ")", ",", "history", "=", "None", ")", ":", "if", "collection", "is", "None", ":", "collection", "=", "[", "]", "if", "history", "is", "None", ":", "h...
[ 402, 4 ]
[ 425, 25 ]
python
en
['en', 'error', 'th']
False
SchemaObject.str
(self, indent=0, history=None)
Get a string representation of this object. @param indent: The indent. @type indent: int @return: A string. @rtype: str
Get a string representation of this object.
def str(self, indent=0, history=None): """ Get a string representation of this object. @param indent: The indent. @type indent: int @return: A string. @rtype: str """ if history is None: history = [] if self in history: ret...
[ "def", "str", "(", "self", ",", "indent", "=", "0", ",", "history", "=", "None", ")", ":", "if", "history", "is", "None", ":", "history", "=", "[", "]", "if", "self", "in", "history", ":", "return", "'%s ...'", "%", "Repr", "(", "self", ")", "his...
[ 427, 4 ]
[ 461, 30 ]
python
en
['en', 'error', 'th']
False
SchemaObject.description
(self)
Get the names used for str() and repr() description. @return: A dictionary of relavent attributes. @rtype: [str,...]
Get the names used for str() and repr() description.
def description(self): """ Get the names used for str() and repr() description. @return: A dictionary of relavent attributes. @rtype: [str,...] """ return ()
[ "def", "description", "(", "self", ")", ":", "return", "(", ")" ]
[ 463, 4 ]
[ 469, 17 ]
python
en
['en', 'error', 'th']
False
Iter.__init__
(self, sx)
@param sx: A schema object. @type sx: L{SchemaObject}
def __init__(self, sx): """ @param sx: A schema object. @type sx: L{SchemaObject} """ self.stack = [] self.push(sx)
[ "def", "__init__", "(", "self", ",", "sx", ")", ":", "self", ".", "stack", "=", "[", "]", "self", ".", "push", "(", "sx", ")" ]
[ 538, 4 ]
[ 544, 21 ]
python
en
['en', 'error', 'th']
False
Iter.push
(self, sx)
Create a frame and push the specified object. @param sx: A schema object to push. @type sx: L{SchemaObject}
Create a frame and push the specified object.
def push(self, sx): """ Create a frame and push the specified object. @param sx: A schema object to push. @type sx: L{SchemaObject} """ self.stack.append(Iter.Frame(sx))
[ "def", "push", "(", "self", ",", "sx", ")", ":", "self", ".", "stack", ".", "append", "(", "Iter", ".", "Frame", "(", "sx", ")", ")" ]
[ 546, 4 ]
[ 552, 41 ]
python
en
['en', 'error', 'th']
False
Iter.pop
(self)
Pop the I{top} frame. @return: The popped frame. @rtype: L{Frame} @raise StopIteration: when stack is empty.
Pop the I{top} frame.
def pop(self): """ Pop the I{top} frame. @return: The popped frame. @rtype: L{Frame} @raise StopIteration: when stack is empty. """ if len(self.stack): return self.stack.pop() else: raise StopIteration()
[ "def", "pop", "(", "self", ")", ":", "if", "len", "(", "self", ".", "stack", ")", ":", "return", "self", ".", "stack", ".", "pop", "(", ")", "else", ":", "raise", "StopIteration", "(", ")" ]
[ 554, 4 ]
[ 564, 33 ]
python
en
['en', 'error', 'th']
False
Iter.top
(self)
Get the I{top} frame. @return: The top frame. @rtype: L{Frame} @raise StopIteration: when stack is empty.
Get the I{top} frame.
def top(self): """ Get the I{top} frame. @return: The top frame. @rtype: L{Frame} @raise StopIteration: when stack is empty. """ if len(self.stack): return self.stack[-1] else: raise StopIteration()
[ "def", "top", "(", "self", ")", ":", "if", "len", "(", "self", ".", "stack", ")", ":", "return", "self", ".", "stack", "[", "-", "1", "]", "else", ":", "raise", "StopIteration", "(", ")" ]
[ 566, 4 ]
[ 576, 33 ]
python
en
['en', 'error', 'th']
False
Iter.next
(self)
Get the next item. @return: A tuple: the next (child, ancestry). @rtype: (L{SchemaObject}, [L{SchemaObject},..]) @raise StopIteration: A the end.
Get the next item.
def next(self): """ Get the next item. @return: A tuple: the next (child, ancestry). @rtype: (L{SchemaObject}, [L{SchemaObject},..]) @raise StopIteration: A the end. """ frame = self.top() while True: result = frame.next() if result...
[ "def", "next", "(", "self", ")", ":", "frame", "=", "self", ".", "top", "(", ")", "while", "True", ":", "result", "=", "frame", ".", "next", "(", ")", "if", "result", "is", "None", ":", "self", ".", "pop", "(", ")", "return", "self", ".", "next...
[ 578, 4 ]
[ 595, 30 ]
python
en
['en', 'error', 'th']
False
XBuiltin.__init__
(self, schema, name)
@param schema: The containing schema. @type schema: L{schema.Schema}
def __init__(self, schema, name): """ @param schema: The containing schema. @type schema: L{schema.Schema} """ root = Element(name) SchemaObject.__init__(self, schema, root) self.name = name self.nillable = True
[ "def", "__init__", "(", "self", ",", "schema", ",", "name", ")", ":", "root", "=", "Element", "(", "name", ")", "SchemaObject", ".", "__init__", "(", "self", ",", "schema", ",", "root", ")", "self", ".", "name", "=", "name", "self", ".", "nillable", ...
[ 606, 4 ]
[ 614, 28 ]
python
en
['en', 'error', 'th']
False
NodeFinder.__init__
(self, matcher, limit=0)
@param matcher: An object used as criteria for match. @type matcher: I{any}.match(n) @param limit: Limit the number of matches. 0=unlimited. @type limit: int
def __init__(self, matcher, limit=0): """ @param matcher: An object used as criteria for match. @type matcher: I{any}.match(n) @param limit: Limit the number of matches. 0=unlimited. @type limit: int """ self.matcher = matcher self.limit = limit
[ "def", "__init__", "(", "self", ",", "matcher", ",", "limit", "=", "0", ")", ":", "self", ".", "matcher", "=", "matcher", "self", ".", "limit", "=", "limit" ]
[ 643, 4 ]
[ 651, 26 ]
python
en
['en', 'error', 'th']
False
NodeFinder.find
(self, node, list)
Traverse the tree looking for matches. @param node: A node to match on. @type node: L{SchemaObject} @param list: A list to fill. @type list: list
Traverse the tree looking for matches.
def find(self, node, list): """ Traverse the tree looking for matches. @param node: A node to match on. @type node: L{SchemaObject} @param list: A list to fill. @type list: list """ if self.matcher.match(node): list.append(node) sel...
[ "def", "find", "(", "self", ",", "node", ",", "list", ")", ":", "if", "self", ".", "matcher", ".", "match", "(", "node", ")", ":", "list", ".", "append", "(", "node", ")", "self", ".", "limit", "-=", "1", "if", "self", ".", "limit", "==", "0", ...
[ 653, 4 ]
[ 668, 19 ]
python
en
['en', 'error', 'th']
False
AppveyorHookTests.test_appveyor_build_success_message
(self)
Tests if appveyor build success notification is handled correctly
Tests if appveyor build success notification is handled correctly
def test_appveyor_build_success_message(self) -> None: """ Tests if appveyor build success notification is handled correctly """ expected_topic = "Hubot-DSC-Resource" expected_message = """ [Build Hubot-DSC-Resource 2.0.59 completed](https://ci.appveyor.com/project/joebloggs/hubo...
[ "def", "test_appveyor_build_success_message", "(", "self", ")", "->", "None", ":", "expected_topic", "=", "\"Hubot-DSC-Resource\"", "expected_message", "=", "\"\"\"\n[Build Hubot-DSC-Resource 2.0.59 completed](https://ci.appveyor.com/project/joebloggs/hubot-dsc-resource/build/2.0.59):\n* *...
[ 8, 4 ]
[ 20, 86 ]
python
en
['en', 'error', 'th']
False
AppveyorHookTests.test_appveyor_build_failure_message
(self)
Tests if appveyor build failure notification is handled correctly
Tests if appveyor build failure notification is handled correctly
def test_appveyor_build_failure_message(self) -> None: """ Tests if appveyor build failure notification is handled correctly """ expected_topic = "Hubot-DSC-Resource" expected_message = """ [Build Hubot-DSC-Resource 2.0.59 failed](https://ci.appveyor.com/project/joebloggs/hubot-d...
[ "def", "test_appveyor_build_failure_message", "(", "self", ")", "->", "None", ":", "expected_topic", "=", "\"Hubot-DSC-Resource\"", "expected_message", "=", "\"\"\"\n[Build Hubot-DSC-Resource 2.0.59 failed](https://ci.appveyor.com/project/joebloggs/hubot-dsc-resource/build/2.0.59):\n* **Co...
[ 22, 4 ]
[ 34, 86 ]
python
en
['en', 'error', 'th']
False
validate_system
(system)
Ensure build system has the requisite fields.
Ensure build system has the requisite fields.
def validate_system(system): """ Ensure build system has the requisite fields. """ required = {'requires', 'build-backend'} if not (required <= set(system)): message = "Missing required fields: {missing}".format( missing=required-set(system), ) raise ValueError(me...
[ "def", "validate_system", "(", "system", ")", ":", "required", "=", "{", "'requires'", ",", "'build-backend'", "}", "if", "not", "(", "required", "<=", "set", "(", "system", ")", ")", ":", "message", "=", "\"Missing required fields: {missing}\"", ".", "format"...
[ 16, 0 ]
[ 25, 33 ]
python
en
['en', 'error', 'th']
False
load_system
(source_dir)
Load the build system from a source dir (pyproject.toml).
Load the build system from a source dir (pyproject.toml).
def load_system(source_dir): """ Load the build system from a source dir (pyproject.toml). """ pyproject = os.path.join(source_dir, 'pyproject.toml') with open(pyproject) as f: pyproject_data = toml.load(f) return pyproject_data['build-system']
[ "def", "load_system", "(", "source_dir", ")", ":", "pyproject", "=", "os", ".", "path", ".", "join", "(", "source_dir", ",", "'pyproject.toml'", ")", "with", "open", "(", "pyproject", ")", "as", "f", ":", "pyproject_data", "=", "toml", ".", "load", "(", ...
[ 28, 0 ]
[ 35, 41 ]
python
en
['en', 'error', 'th']
False
compat_system
(source_dir)
Given a source dir, attempt to get a build system backend and requirements from pyproject.toml. Fallback to setuptools but only if the file was not found or a build system was not indicated.
Given a source dir, attempt to get a build system backend and requirements from pyproject.toml. Fallback to setuptools but only if the file was not found or a build system was not indicated.
def compat_system(source_dir): """ Given a source dir, attempt to get a build system backend and requirements from pyproject.toml. Fallback to setuptools but only if the file was not found or a build system was not indicated. """ try: system = load_system(source_dir) except (File...
[ "def", "compat_system", "(", "source_dir", ")", ":", "try", ":", "system", "=", "load_system", "(", "source_dir", ")", "except", "(", "FileNotFoundError", ",", "KeyError", ")", ":", "system", "=", "{", "}", "system", ".", "setdefault", "(", "'build-backend'"...
[ 38, 0 ]
[ 54, 17 ]
python
en
['en', 'error', 'th']
False
main
(args=None)
This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498.
This is preserved for old console scripts that may still be referencing it.
def main(args=None): # type: (Optional[List[str]]) -> int """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args)
[ "def", "main", "(", "args", "=", "None", ")", ":", "# type: (Optional[List[str]]) -> int", "from", "pip", ".", "_internal", ".", "utils", ".", "entrypoints", "import", "_wrapper", "return", "_wrapper", "(", "args", ")" ]
[ 7, 0 ]
[ 16, 25 ]
python
en
['en', 'en', 'en']
True
TorchRandomForestClassifier.fit
(self, vectors, labels)
Function which must be used after the initialisation to fit the random forest and build the successive :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeClassifier` to solve a specific classification problem. Args: vectors(:class:`torch.FloatTensor`): Vectors tensor used to fit ...
Function which must be used after the initialisation to fit the random forest and build the successive :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeClassifier` to solve a specific classification problem.
def fit(self, vectors, labels): """ Function which must be used after the initialisation to fit the random forest and build the successive :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeClassifier` to solve a specific classification problem. Args: vectors(:class:`torch...
[ "def", "fit", "(", "self", ",", "vectors", ",", "labels", ")", ":", "for", "_", "in", "range", "(", "self", ".", "nb_trees", ")", ":", "tree", "=", "TorchDecisionTreeClassifier", "(", "self", ".", "max_depth", ")", "list_features", "=", "sample_dimensions"...
[ 33, 4 ]
[ 56, 35 ]
python
en
['en', 'error', 'th']
False
TorchRandomForestClassifier.predict
(self, vector)
Function which must be used after the the fitting of the random forest. It calls recursively the different :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeClassifier` to classify the vector. Args: vector(:class:`torch.FloatTensor`): Vectors tensor which must be classified. It ...
Function which must be used after the the fitting of the random forest. It calls recursively the different :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeClassifier` to classify the vector.
def predict(self, vector): """ Function which must be used after the the fitting of the random forest. It calls recursively the different :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeClassifier` to classify the vector. Args: vector(:class:`torch.FloatTensor`): Vector...
[ "def", "predict", "(", "self", ",", "vector", ")", ":", "predictions", "=", "[", "]", "for", "tree", ",", "index_features", "in", "zip", "(", "self", ".", "trees", ",", "self", ".", "trees_features", ")", ":", "sampled_vector", "=", "torch", ".", "inde...
[ 58, 4 ]
[ 76, 59 ]
python
en
['en', 'error', 'th']
False
TorchRandomForestRegressor.fit
(self, vectors, values)
Function which must be used after the initialisation to fit the random forest and build the successive :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeRegressor` to solve a specific classification problem. Args: vectors(:class:`torch.FloatTensor`): Vectors tensor used to fit t...
Function which must be used after the initialisation to fit the random forest and build the successive :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeRegressor` to solve a specific classification problem.
def fit(self, vectors, values): """ Function which must be used after the initialisation to fit the random forest and build the successive :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeRegressor` to solve a specific classification problem. Args: vectors(:class:`torch....
[ "def", "fit", "(", "self", ",", "vectors", ",", "values", ")", ":", "for", "_", "in", "range", "(", "self", ".", "nb_trees", ")", ":", "tree", "=", "TorchDecisionTreeRegressor", "(", "self", ".", "max_depth", ")", "list_features", "=", "sample_dimensions",...
[ 105, 4 ]
[ 129, 35 ]
python
en
['en', 'error', 'th']
False
TorchRandomForestRegressor.predict
(self, vector)
Function which must be used after the the fitting of the random forest. It calls recursively the different :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeRegressor` to regress the vector. Args: vector(:class:`torch.FloatTensor`): Vectors tensor which must be regressed. It rep...
Function which must be used after the the fitting of the random forest. It calls recursively the different :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeRegressor` to regress the vector.
def predict(self, vector): """ Function which must be used after the the fitting of the random forest. It calls recursively the different :class:`Sklearn_PyTorch.binary_tree.TorchDecisionTreeRegressor` to regress the vector. Args: vector(:class:`torch.FloatTensor`): Vectors ...
[ "def", "predict", "(", "self", ",", "vector", ")", ":", "predictions_sum", "=", "0", "for", "tree", ",", "index_features", "in", "zip", "(", "self", ".", "trees", ",", "self", ".", "trees_features", ")", ":", "sampled_vector", "=", "torch", ".", "index_s...
[ 131, 4 ]
[ 149, 46 ]
python
en
['en', 'error', 'th']
False
announce
(ctx, version)
Generates a new release announcement entry in the docs.
Generates a new release announcement entry in the docs.
def announce(ctx, version): """Generates a new release announcement entry in the docs.""" # Get our list of authors stdout = check_output(["git", "describe", "--abbrev=0", '--tags']) stdout = stdout.decode('utf-8') last_version = stdout.strip() stdout = check_output(["git", "log", "{}..HEAD".fo...
[ "def", "announce", "(", "ctx", ",", "version", ")", ":", "# Get our list of authors", "stdout", "=", "check_output", "(", "[", "\"git\"", ",", "\"describe\"", ",", "\"--abbrev=0\"", ",", "'--tags'", "]", ")", "stdout", "=", "stdout", ".", "decode", "(", "'ut...
[ 12, 0 ]
[ 49, 43 ]
python
en
['en', 'en', 'en']
True
regen
(ctx)
Call regendoc tool to update examples and pytest output in the docs.
Call regendoc tool to update examples and pytest output in the docs.
def regen(ctx): """Call regendoc tool to update examples and pytest output in the docs.""" print("[generate.regen] Updating docs") check_call(['tox', '-e', 'regen'])
[ "def", "regen", "(", "ctx", ")", ":", "print", "(", "\"[generate.regen] Updating docs\"", ")", "check_call", "(", "[", "'tox'", ",", "'-e'", ",", "'regen'", "]", ")" ]
[ 53, 0 ]
[ 56, 38 ]
python
en
['en', 'en', 'en']
True
make_tag
(ctx, version)
Create a new, local tag for the release, only if the repository is clean.
Create a new, local tag for the release, only if the repository is clean.
def make_tag(ctx, version): """Create a new, local tag for the release, only if the repository is clean.""" from git import Repo repo = Repo('.') if repo.is_dirty(): print('Current repository is dirty. Please commit any changes and try again.') raise invoke.Exit(code=2) tag_names =...
[ "def", "make_tag", "(", "ctx", ",", "version", ")", ":", "from", "git", "import", "Repo", "repo", "=", "Repo", "(", "'.'", ")", "if", "repo", ".", "is_dirty", "(", ")", ":", "print", "(", "'Current repository is dirty. Please commit any changes and try again.'",...
[ 60, 0 ]
[ 75, 28 ]
python
en
['en', 'en', 'en']
True
pre_release
(ctx, version)
Generates new docs, release announcements and creates a local tag.
Generates new docs, release announcements and creates a local tag.
def pre_release(ctx, version): """Generates new docs, release announcements and creates a local tag.""" announce(ctx, version) regen(ctx) changelog(ctx, version, write_out=True) msg = 'Preparing release version {}'.format(version) check_call(['git', 'commit', '-a', '-m', msg]) make_tag(ctx...
[ "def", "pre_release", "(", "ctx", ",", "version", ")", ":", "announce", "(", "ctx", ",", "version", ")", "regen", "(", "ctx", ")", "changelog", "(", "ctx", ",", "version", ",", "write_out", "=", "True", ")", "msg", "=", "'Preparing release version {}'", ...
[ 81, 0 ]
[ 93, 74 ]
python
en
['en', 'en', 'en']
True
PageObject.__init__
(self, driver, conf)
Constructor.
Constructor.
def __init__(self, driver, conf): """Constructor.""" super(PageObject, self).__init__(driver, conf) self._page_title = None
[ "def", "__init__", "(", "self", ",", "driver", ",", "conf", ")", ":", "super", "(", "PageObject", ",", "self", ")", ".", "__init__", "(", "driver", ",", "conf", ")", "self", ".", "_page_title", "=", "None" ]
[ 22, 4 ]
[ 25, 31 ]
python
en
['en', 'en', 'en']
False
PageObject.switch_window
(self, window_name=None, window_index=None)
Switches focus between the webdriver windows. Args: - window_name: The name of the window to switch to. - window_index: The index of the window handle to switch to. If the method is called without arguments it switches to the last window in the driver window_handles list. ...
Switches focus between the webdriver windows.
def switch_window(self, window_name=None, window_index=None): """Switches focus between the webdriver windows. Args: - window_name: The name of the window to switch to. - window_index: The index of the window handle to switch to. If the method is called without arguments it swit...
[ "def", "switch_window", "(", "self", ",", "window_name", "=", "None", ",", "window_index", "=", "None", ")", ":", "if", "window_name", "is", "not", "None", "and", "window_index", "is", "not", "None", ":", "raise", "ValueError", "(", "\"switch_window receives t...
[ 56, 4 ]
[ 80, 72 ]
python
en
['en', 'en', 'en']
True
namedtuple
(typename, field_names, *, verbose=False, rename=False, module=None)
Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # ind...
Returns a new subclass of tuple with named fields.
def namedtuple(typename, field_names, *, verbose=False, rename=False, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) #...
[ "def", "namedtuple", "(", "typename", ",", "field_names", ",", "*", ",", "verbose", "=", "False", ",", "rename", "=", "False", ",", "module", "=", "None", ")", ":", "# Validate the field names. At the user's option, either generate an error", "# message or automaticall...
[ 356, 0 ]
[ 447, 17 ]
python
en
['en', 'en', 'en']
True
_count_elements
(mapping, iterable)
Tally elements from the iterable.
Tally elements from the iterable.
def _count_elements(mapping, iterable): 'Tally elements from the iterable.' mapping_get = mapping.get for elem in iterable: mapping[elem] = mapping_get(elem, 0) + 1
[ "def", "_count_elements", "(", "mapping", ",", "iterable", ")", ":", "mapping_get", "=", "mapping", ".", "get", "for", "elem", "in", "iterable", ":", "mapping", "[", "elem", "]", "=", "mapping_get", "(", "elem", ",", "0", ")", "+", "1" ]
[ 454, 0 ]
[ 458, 48 ]
python
en
['en', 'en', 'en']
True
OrderedDict.__init__
(*args, **kwds)
Initialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved.
Initialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved.
def __init__(*args, **kwds): '''Initialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. ''' if not args: raise TypeError("descriptor '__init__' of 'OrderedDict' object " "needs an ...
[ "def", "__init__", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "not", "args", ":", "raise", "TypeError", "(", "\"descriptor '__init__' of 'OrderedDict' object \"", "\"needs an argument\"", ")", "self", ",", "", "*", "args", "=", "args", "if", "l...
[ 85, 4 ]
[ 102, 36 ]
python
en
['en', 'en', 'en']
True
OrderedDict.__setitem__
(self, key, value, dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link)
od.__setitem__(i, y) <==> od[i]=y
od.__setitem__(i, y) <==> od[i]=y
def __setitem__(self, key, value, dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link at the end of the linked list, # and the inherited dictionary is updated with the new key/value pair. ...
[ "def", "__setitem__", "(", "self", ",", "key", ",", "value", ",", "dict_setitem", "=", "dict", ".", "__setitem__", ",", "proxy", "=", "_proxy", ",", "Link", "=", "_Link", ")", ":", "# Setting a new item creates a new link at the end of the linked list,", "# and the ...
[ 104, 4 ]
[ 116, 38 ]
python
cy
['de', 'cy', 'es']
False
OrderedDict.__delitem__
(self, key, dict_delitem=dict.__delitem__)
od.__delitem__(y) <==> del od[y]
od.__delitem__(y) <==> del od[y]
def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which gets # removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link = self.__map....
[ "def", "__delitem__", "(", "self", ",", "key", ",", "dict_delitem", "=", "dict", ".", "__delitem__", ")", ":", "# Deleting an existing item uses self.__map to find the link which gets", "# removed by updating the links in the predecessor and successor nodes.", "dict_delitem", "(", ...
[ 118, 4 ]
[ 129, 24 ]
python
it
['it', 'es', 'it']
True
OrderedDict.__iter__
(self)
od.__iter__() <==> iter(od)
od.__iter__() <==> iter(od)
def __iter__(self): 'od.__iter__() <==> iter(od)' # Traverse the linked list in order. root = self.__root curr = root.next while curr is not root: yield curr.key curr = curr.next
[ "def", "__iter__", "(", "self", ")", ":", "# Traverse the linked list in order.", "root", "=", "self", ".", "__root", "curr", "=", "root", ".", "next", "while", "curr", "is", "not", "root", ":", "yield", "curr", ".", "key", "curr", "=", "curr", ".", "nex...
[ 131, 4 ]
[ 138, 28 ]
python
en
['en', 'hr', 'ur']
False
OrderedDict.__reversed__
(self)
od.__reversed__() <==> reversed(od)
od.__reversed__() <==> reversed(od)
def __reversed__(self): 'od.__reversed__() <==> reversed(od)' # Traverse the linked list in reverse order. root = self.__root curr = root.prev while curr is not root: yield curr.key curr = curr.prev
[ "def", "__reversed__", "(", "self", ")", ":", "# Traverse the linked list in reverse order.", "root", "=", "self", ".", "__root", "curr", "=", "root", ".", "prev", "while", "curr", "is", "not", "root", ":", "yield", "curr", ".", "key", "curr", "=", "curr", ...
[ 140, 4 ]
[ 147, 28 ]
python
en
['en', 'no', 'en']
True
OrderedDict.clear
(self)
od.clear() -> None. Remove all items from od.
od.clear() -> None. Remove all items from od.
def clear(self): 'od.clear() -> None. Remove all items from od.' root = self.__root root.prev = root.next = root self.__map.clear() dict.clear(self)
[ "def", "clear", "(", "self", ")", ":", "root", "=", "self", ".", "__root", "root", ".", "prev", "=", "root", ".", "next", "=", "root", "self", ".", "__map", ".", "clear", "(", ")", "dict", ".", "clear", "(", "self", ")" ]
[ 149, 4 ]
[ 154, 24 ]
python
en
['en', 'en', 'en']
True
OrderedDict.popitem
(self, last=True)
Remove and return a (key, value) pair from the dictionary. Pairs are returned in LIFO order if last is true or FIFO order if false.
Remove and return a (key, value) pair from the dictionary.
def popitem(self, last=True): '''Remove and return a (key, value) pair from the dictionary. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: ...
[ "def", "popitem", "(", "self", ",", "last", "=", "True", ")", ":", "if", "not", "self", ":", "raise", "KeyError", "(", "'dictionary is empty'", ")", "root", "=", "self", ".", "__root", "if", "last", ":", "link", "=", "root", ".", "prev", "link_prev", ...
[ 156, 4 ]
[ 177, 25 ]
python
en
['en', 'en', 'en']
True
OrderedDict.move_to_end
(self, key, last=True)
Move an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key).
Move an existing element to the end (or beginning if last==False).
def move_to_end(self, key, last=True): '''Move an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). ''' link = self.__map[key] link_prev = link.p...
[ "def", "move_to_end", "(", "self", ",", "key", ",", "last", "=", "True", ")", ":", "link", "=", "self", ".", "__map", "[", "key", "]", "link_prev", "=", "link", ".", "prev", "link_next", "=", "link", ".", "next", "soft_link", "=", "link_next", ".", ...
[ 179, 4 ]
[ 204, 28 ]
python
en
['en', 'en', 'en']
True
OrderedDict.keys
(self)
D.keys() -> a set-like object providing a view on D's keys
D.keys() -> a set-like object providing a view on D's keys
def keys(self): "D.keys() -> a set-like object providing a view on D's keys" return _OrderedDictKeysView(self)
[ "def", "keys", "(", "self", ")", ":", "return", "_OrderedDictKeysView", "(", "self", ")" ]
[ 217, 4 ]
[ 219, 41 ]
python
en
['en', 'cs', 'en']
True
OrderedDict.items
(self)
D.items() -> a set-like object providing a view on D's items
D.items() -> a set-like object providing a view on D's items
def items(self): "D.items() -> a set-like object providing a view on D's items" return _OrderedDictItemsView(self)
[ "def", "items", "(", "self", ")", ":", "return", "_OrderedDictItemsView", "(", "self", ")" ]
[ 221, 4 ]
[ 223, 42 ]
python
en
['en', 'en', 'en']
True
OrderedDict.values
(self)
D.values() -> an object providing a view on D's values
D.values() -> an object providing a view on D's values
def values(self): "D.values() -> an object providing a view on D's values" return _OrderedDictValuesView(self)
[ "def", "values", "(", "self", ")", ":", "return", "_OrderedDictValuesView", "(", "self", ")" ]
[ 225, 4 ]
[ 227, 43 ]
python
en
['en', 'en', 'en']
True
OrderedDict.pop
(self, key, default=__marker)
od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] ...
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "__marker", ")", ":", "if", "key", "in", "self", ":", "result", "=", "self", "[", "key", "]", "del", "self", "[", "key", "]", "return", "result", "if", "default", "is", "self", ".", "__m...
[ 233, 4 ]
[ 245, 22 ]
python
en
['en', 'en', 'en']
True
OrderedDict.setdefault
(self, key, default=None)
od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od
od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od
def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "self", ":", "return", "self", "[", "key", "]", "self", "[", "key", "]", "=", "default", "return", "default" ]
[ 247, 4 ]
[ 252, 22 ]
python
en
['en', 'sl', 'en']
True
OrderedDict.__repr__
(self)
od.__repr__() <==> repr(od)
od.__repr__() <==> repr(od)
def __repr__(self): 'od.__repr__() <==> repr(od)' if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, list(self.items()))
[ "def", "__repr__", "(", "self", ")", ":", "if", "not", "self", ":", "return", "'%s()'", "%", "(", "self", ".", "__class__", ".", "__name__", ",", ")", "return", "'%s(%r)'", "%", "(", "self", ".", "__class__", ".", "__name__", ",", "list", "(", "self"...
[ 255, 4 ]
[ 259, 71 ]
python
en
['en', 'it', 'hi']
False
OrderedDict.__reduce__
(self)
Return state information for pickling
Return state information for pickling
def __reduce__(self): 'Return state information for pickling' inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) return self.__class__, (), inst_dict or None, None, iter(self.items())
[ "def", "__reduce__", "(", "self", ")", ":", "inst_dict", "=", "vars", "(", "self", ")", ".", "copy", "(", ")", "for", "k", "in", "vars", "(", "OrderedDict", "(", ")", ")", ":", "inst_dict", ".", "pop", "(", "k", ",", "None", ")", "return", "self"...
[ 261, 4 ]
[ 266, 78 ]
python
en
['en', 'da', 'en']
True
OrderedDict.copy
(self)
od.copy() -> a shallow copy of od
od.copy() -> a shallow copy of od
def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self)
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ")" ]
[ 268, 4 ]
[ 270, 35 ]
python
en
['en', 'cs', 'en']
True
OrderedDict.fromkeys
(cls, iterable, value=None)
OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None.
OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None.
def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. ''' self = cls() for key in iterable: self[key] = value return self
[ "def", "fromkeys", "(", "cls", ",", "iterable", ",", "value", "=", "None", ")", ":", "self", "=", "cls", "(", ")", "for", "key", "in", "iterable", ":", "self", "[", "key", "]", "=", "value", "return", "self" ]
[ 273, 4 ]
[ 281, 19 ]
python
en
['en', 'en', 'en']
True
OrderedDict.__eq__
(self, other)
od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive.
od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive.
def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return dict.__eq__(self, other) and all(map(_eq, self, other)) return ...
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "OrderedDict", ")", ":", "return", "dict", ".", "__eq__", "(", "self", ",", "other", ")", "and", "all", "(", "map", "(", "_eq", ",", "self", ",", "other", ...
[ 283, 4 ]
[ 290, 39 ]
python
en
['en', 'en', 'en']
True
Counter.__init__
(*args, **kwds)
Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts. >>> c = Counter() # a new, empty counter >>> c = Counter('gallahad') # a new co...
Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts.
def __init__(*args, **kwds): '''Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts. >>> c = Counter() # a new, empty counter >>> c = Counte...
[ "def", "__init__", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "not", "args", ":", "raise", "TypeError", "(", "\"descriptor '__init__' of 'Counter' object \"", "\"needs an argument\"", ")", "self", ",", "", "*", "args", "=", "args", "if", "len",...
[ 516, 4 ]
[ 534, 34 ]
python
en
['en', 'en', 'en']
True
Counter.__missing__
(self, key)
The count of elements not in the Counter is zero.
The count of elements not in the Counter is zero.
def __missing__(self, key): 'The count of elements not in the Counter is zero.' # Needed so that self[missing_item] does not raise KeyError return 0
[ "def", "__missing__", "(", "self", ",", "key", ")", ":", "# Needed so that self[missing_item] does not raise KeyError", "return", "0" ]
[ 536, 4 ]
[ 539, 16 ]
python
en
['en', 'en', 'en']
True
Counter.most_common
(self, n=None)
List the n most common elements and their counts from the most common to the least. If n is None, then list all element counts. >>> Counter('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)]
List the n most common elements and their counts from the most common to the least. If n is None, then list all element counts.
def most_common(self, n=None): '''List the n most common elements and their counts from the most common to the least. If n is None, then list all element counts. >>> Counter('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] ''' # Emulate Bag.sortedByCoun...
[ "def", "most_common", "(", "self", ",", "n", "=", "None", ")", ":", "# Emulate Bag.sortedByCount from Smalltalk", "if", "n", "is", "None", ":", "return", "sorted", "(", "self", ".", "items", "(", ")", ",", "key", "=", "_itemgetter", "(", "1", ")", ",", ...
[ 541, 4 ]
[ 552, 67 ]
python
en
['en', 'en', 'en']
True
Counter.elements
(self)
Iterator over elements repeating each as many times as its count. >>> c = Counter('ABCABC') >>> sorted(c.elements()) ['A', 'A', 'B', 'B', 'C', 'C'] # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> pro...
Iterator over elements repeating each as many times as its count.
def elements(self): '''Iterator over elements repeating each as many times as its count. >>> c = Counter('ABCABC') >>> sorted(c.elements()) ['A', 'A', 'B', 'B', 'C', 'C'] # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 >>> prime_factors = Counter({2: 2...
[ "def", "elements", "(", "self", ")", ":", "# Emulate Bag.do from Smalltalk and Multiset.begin from C++.", "return", "_chain", ".", "from_iterable", "(", "_starmap", "(", "_repeat", ",", "self", ".", "items", "(", ")", ")", ")" ]
[ 554, 4 ]
[ 574, 68 ]
python
en
['en', 'en', 'en']
True
Counter.update
(*args, **kwds)
Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch') >>> c.update(d) ...
Like dict.update() but add counts instead of replacing them.
def update(*args, **kwds): '''Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch'...
[ "def", "update", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "# The regular dict.update() operation makes no sense here because the", "# replace behavior results in the some of original untouched counts", "# being mixed-in with all of the other counts for a mismash that", "# doesn...
[ 585, 4 ]
[ 623, 29 ]
python
en
['en', 'en', 'en']
True
Counter.subtract
(*args, **kwds)
Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> ...
Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts.
def subtract(*args, **kwds): '''Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts. Source can be an iterable, a dictionary, or another Counter instance. ...
[ "def", "subtract", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "not", "args", ":", "raise", "TypeError", "(", "\"descriptor 'subtract' of 'Counter' object \"", "\"needs an argument\"", ")", "self", ",", "", "*", "args", "=", "args", "if", "len",...
[ 625, 4 ]
[ 657, 31 ]
python
en
['en', 'en', 'en']
True
Counter.copy
(self)
Return a shallow copy.
Return a shallow copy.
def copy(self): 'Return a shallow copy.' return self.__class__(self)
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ")" ]
[ 659, 4 ]
[ 661, 35 ]
python
en
['en', 'pt', 'en']
True
Counter.__delitem__
(self, elem)
Like dict.__delitem__() but does not raise KeyError for missing values.
Like dict.__delitem__() but does not raise KeyError for missing values.
def __delitem__(self, elem): 'Like dict.__delitem__() but does not raise KeyError for missing values.' if elem in self: super().__delitem__(elem)
[ "def", "__delitem__", "(", "self", ",", "elem", ")", ":", "if", "elem", "in", "self", ":", "super", "(", ")", ".", "__delitem__", "(", "elem", ")" ]
[ 666, 4 ]
[ 669, 37 ]
python
en
['en', 'no', 'en']
True
Counter.__add__
(self, other)
Add counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1})
Add counts from two counters.
def __add__(self, other): '''Add counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): ...
[ "def", "__add__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Counter", ")", ":", "return", "NotImplemented", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")...
[ 690, 4 ]
[ 707, 21 ]
python
en
['en', 'en', 'en']
True
Counter.__sub__
(self, other)
Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1})
Subtract count, but keep only results with positive counts.
def __sub__(self, other): ''' Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count...
[ "def", "__sub__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Counter", ")", ":", "return", "NotImplemented", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")...
[ 709, 4 ]
[ 726, 21 ]
python
en
['en', 'en', 'en']
True
Counter.__or__
(self, other)
Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1})
Union is the maximum of value in either of the input counters.
def __or__(self, other): '''Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem...
[ "def", "__or__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Counter", ")", ":", "return", "NotImplemented", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")"...
[ 728, 4 ]
[ 746, 21 ]
python
en
['en', 'en', 'en']
True
Counter.__and__
(self, other)
Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1})
Intersection is the minimum of corresponding counts.
def __and__(self, other): ''' Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items():...
[ "def", "__and__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Counter", ")", ":", "return", "NotImplemented", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")...
[ 748, 4 ]
[ 763, 21 ]
python
en
['en', 'en', 'en']
True
Counter.__pos__
(self)
Adds an empty counter, effectively stripping negative and zero counts
Adds an empty counter, effectively stripping negative and zero counts
def __pos__(self): 'Adds an empty counter, effectively stripping negative and zero counts' result = Counter() for elem, count in self.items(): if count > 0: result[elem] = count return result
[ "def", "__pos__", "(", "self", ")", ":", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")", ":", "if", "count", ">", "0", ":", "result", "[", "elem", "]", "=", "count", "return", "result" ]
[ 765, 4 ]
[ 771, 21 ]
python
en
['en', 'en', 'en']
True
Counter.__neg__
(self)
Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts.
Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts.
def __neg__(self): '''Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. ''' result = Counter() for elem, count in self.items(): if count < 0: result[elem] = 0 - count return result
[ "def", "__neg__", "(", "self", ")", ":", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")", ":", "if", "count", "<", "0", ":", "result", "[", "elem", "]", "=", "0", "-", "count", "return", "re...
[ 773, 4 ]
[ 782, 21 ]
python
en
['en', 'en', 'en']
True
Counter._keep_positive
(self)
Internal method to strip elements with a negative or zero count
Internal method to strip elements with a negative or zero count
def _keep_positive(self): '''Internal method to strip elements with a negative or zero count''' nonpositive = [elem for elem, count in self.items() if not count > 0] for elem in nonpositive: del self[elem] return self
[ "def", "_keep_positive", "(", "self", ")", ":", "nonpositive", "=", "[", "elem", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")", "if", "not", "count", ">", "0", "]", "for", "elem", "in", "nonpositive", ":", "del", "self", "[", "e...
[ 784, 4 ]
[ 789, 19 ]
python
en
['en', 'en', 'en']
True
Counter.__iadd__
(self, other)
Inplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1})
Inplace add from another counter, keeping only positive counts.
def __iadd__(self, other): '''Inplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) ''' for elem, count in other.items(): self[elem] += count re...
[ "def", "__iadd__", "(", "self", ",", "other", ")", ":", "for", "elem", ",", "count", "in", "other", ".", "items", "(", ")", ":", "self", "[", "elem", "]", "+=", "count", "return", "self", ".", "_keep_positive", "(", ")" ]
[ 791, 4 ]
[ 802, 36 ]
python
en
['en', 'en', 'en']
True
Counter.__isub__
(self, other)
Inplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1})
Inplace subtract counter, but keep only results with positive counts.
def __isub__(self, other): '''Inplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) ''' for elem, count in other.items(): self[elem] -= count re...
[ "def", "__isub__", "(", "self", ",", "other", ")", ":", "for", "elem", ",", "count", "in", "other", ".", "items", "(", ")", ":", "self", "[", "elem", "]", "-=", "count", "return", "self", ".", "_keep_positive", "(", ")" ]
[ 804, 4 ]
[ 815, 36 ]
python
en
['en', 'en', 'en']
True
Counter.__ior__
(self, other)
Inplace union is the maximum of value from either counter. >>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1})
Inplace union is the maximum of value from either counter.
def __ior__(self, other): '''Inplace union is the maximum of value from either counter. >>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) ''' for elem, other_count in other.items(): count = self[elem] ...
[ "def", "__ior__", "(", "self", ",", "other", ")", ":", "for", "elem", ",", "other_count", "in", "other", ".", "items", "(", ")", ":", "count", "=", "self", "[", "elem", "]", "if", "other_count", ">", "count", ":", "self", "[", "elem", "]", "=", "...
[ 817, 4 ]
[ 830, 36 ]
python
en
['en', 'en', 'en']
True
Counter.__iand__
(self, other)
Inplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1})
Inplace intersection is the minimum of corresponding counts.
def __iand__(self, other): '''Inplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) ''' for elem, count in self.items(): other_count = other[elem] if other_cou...
[ "def", "__iand__", "(", "self", ",", "other", ")", ":", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")", ":", "other_count", "=", "other", "[", "elem", "]", "if", "other_count", "<", "count", ":", "self", "[", "elem", "]", "=", ...
[ 832, 4 ]
[ 845, 36 ]
python
en
['en', 'en', 'en']
True
ChainMap.__init__
(self, *maps)
Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used.
Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used.
def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}]
[ "def", "__init__", "(", "self", ",", "*", "maps", ")", ":", "self", ".", "maps", "=", "list", "(", "maps", ")", "or", "[", "{", "}", "]" ]
[ 866, 4 ]
[ 871, 38 ]
python
en
['en', 'en', 'en']
True
ChainMap.fromkeys
(cls, iterable, *args)
Create a ChainMap with a single dict created from the iterable.
Create a ChainMap with a single dict created from the iterable.
def fromkeys(cls, iterable, *args): 'Create a ChainMap with a single dict created from the iterable.' return cls(dict.fromkeys(iterable, *args))
[ "def", "fromkeys", "(", "cls", ",", "iterable", ",", "*", "args", ")", ":", "return", "cls", "(", "dict", ".", "fromkeys", "(", "iterable", ",", "*", "args", ")", ")" ]
[ 905, 4 ]
[ 907, 50 ]
python
en
['en', 'en', 'en']
True
ChainMap.copy
(self)
New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]
New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]
def copy(self): 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' return self.__class__(self.maps[0].copy(), *self.maps[1:])
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "maps", "[", "0", "]", ".", "copy", "(", ")", ",", "*", "self", ".", "maps", "[", "1", ":", "]", ")" ]
[ 909, 4 ]
[ 911, 66 ]
python
en
['en', 'en', 'en']
True
ChainMap.new_child
(self, m=None)
New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used.
New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used.
def new_child(self, m=None): # like Django's Context.push() '''New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. ''' if m is None: m = {} return self.__class__(m, *self.maps)
[ "def", "new_child", "(", "self", ",", "m", "=", "None", ")", ":", "# like Django's Context.push()", "if", "m", "is", "None", ":", "m", "=", "{", "}", "return", "self", ".", "__class__", "(", "m", ",", "*", "self", ".", "maps", ")" ]
[ 915, 4 ]
[ 921, 44 ]
python
en
['en', 'en', 'en']
True
ChainMap.parents
(self)
New ChainMap from maps[1:].
New ChainMap from maps[1:].
def parents(self): # like Django's Context.pop() 'New ChainMap from maps[1:].' return self.__class__(*self.maps[1:])
[ "def", "parents", "(", "self", ")", ":", "# like Django's Context.pop()", "return", "self", ".", "__class__", "(", "*", "self", ".", "maps", "[", "1", ":", "]", ")" ]
[ 924, 4 ]
[ 926, 45 ]
python
en
['en', 'en', 'en']
True
ChainMap.popitem
(self)
Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.
Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.
def popitem(self): 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' try: return self.maps[0].popitem() except KeyError: raise KeyError('No keys found in the first mapping.')
[ "def", "popitem", "(", "self", ")", ":", "try", ":", "return", "self", ".", "maps", "[", "0", "]", ".", "popitem", "(", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "'No keys found in the first mapping.'", ")" ]
[ 937, 4 ]
[ 942, 65 ]
python
en
['en', 'en', 'en']
True
ChainMap.pop
(self, key, *args)
Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].
Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].
def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key))
[ "def", "pop", "(", "self", ",", "key", ",", "*", "args", ")", ":", "try", ":", "return", "self", ".", "maps", "[", "0", "]", ".", "pop", "(", "key", ",", "*", "args", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "'Key not found in the ...
[ 944, 4 ]
[ 949, 82 ]
python
en
['en', 'en', 'en']
True
ChainMap.clear
(self)
Clear maps[0], leaving maps[1:] intact.
Clear maps[0], leaving maps[1:] intact.
def clear(self): 'Clear maps[0], leaving maps[1:] intact.' self.maps[0].clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "maps", "[", "0", "]", ".", "clear", "(", ")" ]
[ 951, 4 ]
[ 953, 28 ]
python
en
['en', 'en', 'en']
True
gravatar_hash
(email: str)
Compute the Gravatar hash for an email address.
Compute the Gravatar hash for an email address.
def gravatar_hash(email: str) -> str: """Compute the Gravatar hash for an email address.""" # Non-ASCII characters aren't permitted by the currently active e-mail # RFCs. However, the IETF has published https://tools.ietf.org/html/rfc4952, # outlining internationalization of email addresses, and regardl...
[ "def", "gravatar_hash", "(", "email", ":", "str", ")", "->", "str", ":", "# Non-ASCII characters aren't permitted by the currently active e-mail", "# RFCs. However, the IETF has published https://tools.ietf.org/html/rfc4952,", "# outlining internationalization of email addresses, and regardl...
[ 8, 0 ]
[ 15, 55 ]
python
en
['en', 'en', 'en']
True
AddNewUserHistoryTest.test_add_new_user_history_race
(self)
Sends a message during user creation
Sends a message during user creation
def test_add_new_user_history_race(self) -> None: """Sends a message during user creation""" # Create a user who hasn't had historical messages added realm = get_realm("zulip") stream = Stream.objects.get(realm=realm, name="Denmark") DefaultStream.objects.create(stream=stream, re...
[ "def", "test_add_new_user_history_race", "(", "self", ")", "->", "None", ":", "# Create a user who hasn't had historical messages added", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "stream", "=", "Stream", ".", "objects", ".", "get", "(", "realm", "=", "realm...
[ 238, 4 ]
[ 309, 50 ]
python
en
['fr', 'en', 'en']
True
AddNewUserHistoryTest.test_auto_subbed_to_personals
(self)
Newly created users are auto-subbed to the ability to receive personals.
Newly created users are auto-subbed to the ability to receive personals.
def test_auto_subbed_to_personals(self) -> None: """ Newly created users are auto-subbed to the ability to receive personals. """ test_email = self.nonreg_email("test") self.register(test_email, "test") user_profile = self.nonreg_user("test") old_messages_...
[ "def", "test_auto_subbed_to_personals", "(", "self", ")", "->", "None", ":", "test_email", "=", "self", ".", "nonreg_email", "(", "\"test\"", ")", "self", ".", "register", "(", "test_email", ",", "\"test\"", ")", "user_profile", "=", "self", ".", "nonreg_user"...
[ 311, 4 ]
[ 339, 13 ]
python
en
['en', 'error', 'th']
False
PasswordResetTest.test_ldap_auth_only
(self)
If the email auth backend is not enabled, password reset should do nothing
If the email auth backend is not enabled, password reset should do nothing
def test_ldap_auth_only(self) -> None: """If the email auth backend is not enabled, password reset should do nothing""" email = self.example_email("hamlet") with self.assertLogs(level="INFO") as m: result = self.client_post("/accounts/password/reset/", {"email": email}) s...
[ "def", "test_ldap_auth_only", "(", "self", ")", "->", "None", ":", "email", "=", "self", ".", "example_email", "(", "\"hamlet\"", ")", "with", "self", ".", "assertLogs", "(", "level", "=", "\"INFO\"", ")", "as", "m", ":", "result", "=", "self", ".", "c...
[ 574, 4 ]
[ 595, 40 ]
python
en
['en', 'en', 'en']
True
PasswordResetTest.test_ldap_and_email_auth
(self)
If both email and LDAP auth backends are enabled, limit password reset to users outside the LDAP domain
If both email and LDAP auth backends are enabled, limit password reset to users outside the LDAP domain
def test_ldap_and_email_auth(self) -> None: """If both email and LDAP auth backends are enabled, limit password reset to users outside the LDAP domain""" # If the domain matches, we don't generate an email with self.settings(LDAP_APPEND_DOMAIN="zulip.com"): email = self.examp...
[ "def", "test_ldap_and_email_auth", "(", "self", ")", "->", "None", ":", "# If the domain matches, we don't generate an email", "with", "self", ".", "settings", "(", "LDAP_APPEND_DOMAIN", "=", "\"zulip.com\"", ")", ":", "email", "=", "self", ".", "example_email", "(", ...
[ 604, 4 ]
[ 628, 50 ]
python
en
['en', 'en', 'en']
True
PasswordResetTest.test_redirect_endpoints
(self)
These tests are mostly designed to give us 100% URL coverage in our URL coverage reports. Our mechanism for finding URL coverage doesn't handle redirects, so we just have a few quick tests here.
These tests are mostly designed to give us 100% URL coverage in our URL coverage reports. Our mechanism for finding URL coverage doesn't handle redirects, so we just have a few quick tests here.
def test_redirect_endpoints(self) -> None: """ These tests are mostly designed to give us 100% URL coverage in our URL coverage reports. Our mechanism for finding URL coverage doesn't handle redirects, so we just have a few quick tests here. """ result = self.cli...
[ "def", "test_redirect_endpoints", "(", "self", ")", "->", "None", ":", "result", "=", "self", ".", "client_get", "(", "\"/accounts/password/reset/done/\"", ")", "self", ".", "assert_in_success_response", "(", "[", "\"Check your email\"", "]", ",", "result", ")", "...
[ 630, 4 ]
[ 647, 58 ]
python
en
['en', 'error', 'th']
False
LoginTest.test_register_deactivated
(self)
If you try to register for a deactivated realm, you get a clear error page.
If you try to register for a deactivated realm, you get a clear error page.
def test_register_deactivated(self) -> None: """ If you try to register for a deactivated realm, you get a clear error page. """ realm = get_realm("zulip") realm.deactivated = True realm.save(update_fields=["deactivated"]) result = self.client_post( ...
[ "def", "test_register_deactivated", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "realm", ".", "deactivated", "=", "True", "realm", ".", "save", "(", "update_fields", "=", "[", "\"deactivated\"", "]", ")", "result", ...
[ 787, 4 ]
[ 803, 36 ]
python
en
['en', 'error', 'th']
False
LoginTest.test_register_with_invalid_email
(self)
If you try to register with invalid email, you get an invalid email page
If you try to register with invalid email, you get an invalid email page
def test_register_with_invalid_email(self) -> None: """ If you try to register with invalid email, you get an invalid email page """ invalid_email = "foo\x00bar" result = self.client_post("/accounts/home/", {"email": invalid_email}, subdomain="zulip") self.assert...
[ "def", "test_register_with_invalid_email", "(", "self", ")", "->", "None", ":", "invalid_email", "=", "\"foo\\x00bar\"", "result", "=", "self", ".", "client_post", "(", "\"/accounts/home/\"", ",", "{", "\"email\"", ":", "invalid_email", "}", ",", "subdomain", "=",...
[ 805, 4 ]
[ 814, 66 ]
python
en
['en', 'error', 'th']
False
LoginTest.test_register_deactivated_partway_through
(self)
If you try to register for a deactivated realm, you get a clear error page.
If you try to register for a deactivated realm, you get a clear error page.
def test_register_deactivated_partway_through(self) -> None: """ If you try to register for a deactivated realm, you get a clear error page. """ email = self.nonreg_email("test") result = self.client_post("/accounts/home/", {"email": email}, subdomain="zulip") sel...
[ "def", "test_register_deactivated_partway_through", "(", "self", ")", "->", "None", ":", "email", "=", "self", ".", "nonreg_email", "(", "\"test\"", ")", "result", "=", "self", ".", "client_post", "(", "\"/accounts/home/\"", ",", "{", "\"email\"", ":", "email", ...
[ 816, 4 ]
[ 835, 36 ]
python
en
['en', 'error', 'th']
False
LoginTest.test_login_deactivated_realm
(self)
If you try to log in to a deactivated realm, you get a clear error page.
If you try to log in to a deactivated realm, you get a clear error page.
def test_login_deactivated_realm(self) -> None: """ If you try to log in to a deactivated realm, you get a clear error page. """ realm = get_realm("zulip") realm.deactivated = True realm.save(update_fields=["deactivated"]) result = self.login_with_return(self.exa...
[ "def", "test_login_deactivated_realm", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "realm", ".", "deactivated", "=", "True", "realm", ".", "save", "(", "update_fields", "=", "[", "\"deactivated\"", "]", ")", "result...
[ 837, 4 ]
[ 847, 62 ]
python
en
['en', 'error', 'th']
False