mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
Remove inheritance from object.
This commit is contained in:
@@ -101,7 +101,7 @@ class Confirmation(models.Model):
|
|||||||
def __str__(self) -> Text:
|
def __str__(self) -> Text:
|
||||||
return '<Confirmation: %s>' % (self.content_object,)
|
return '<Confirmation: %s>' % (self.content_object,)
|
||||||
|
|
||||||
class ConfirmationType(object):
|
class ConfirmationType:
|
||||||
def __init__(self, url_name: str,
|
def __init__(self, url_name: str,
|
||||||
validity_in_days: int=settings.CONFIRMATION_LINK_DEFAULT_VALIDITY_DAYS) -> None:
|
validity_in_days: int=settings.CONFIRMATION_LINK_DEFAULT_VALIDITY_DAYS) -> None:
|
||||||
self.url_name = url_name
|
self.url_name = url_name
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from typing import Callable, List, Tuple, Union
|
|||||||
|
|
||||||
####### Helpers
|
####### Helpers
|
||||||
|
|
||||||
class Token(object):
|
class Token:
|
||||||
def __init__(self, s, line, col):
|
def __init__(self, s, line, col):
|
||||||
# type: (str, int, int) -> None
|
# type: (str, int, int) -> None
|
||||||
self.s = s
|
self.s = s
|
||||||
@@ -350,7 +350,7 @@ def handle_postfluff(post_fluff, indent=False, space_after_first_line=False):
|
|||||||
|
|
||||||
#### Begin CSS classes here
|
#### Begin CSS classes here
|
||||||
|
|
||||||
class CssSectionList(object):
|
class CssSectionList:
|
||||||
def __init__(self, tokens, sections):
|
def __init__(self, tokens, sections):
|
||||||
# type: (List[Token], List[Union['CssNestedSection', 'CssSection']]) -> None
|
# type: (List[Token], List[Union['CssNestedSection', 'CssSection']]) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -361,7 +361,7 @@ class CssSectionList(object):
|
|||||||
res = ''.join(section.text() for section in self.sections)
|
res = ''.join(section.text() for section in self.sections)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class CssNestedSection(object):
|
class CssNestedSection:
|
||||||
def __init__(self, tokens, selector_list, section_list, pre_fluff, post_fluff):
|
def __init__(self, tokens, selector_list, section_list, pre_fluff, post_fluff):
|
||||||
# type: (List[Token], 'CssSelectorList', CssSectionList, str, str) -> None
|
# type: (List[Token], 'CssSelectorList', CssSectionList, str, str) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -388,7 +388,7 @@ class CssNestedSection(object):
|
|||||||
res += self.post_fluff
|
res += self.post_fluff
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class CssSection(object):
|
class CssSection:
|
||||||
def __init__(self, tokens, selector_list, declaration_block, pre_fluff, post_fluff):
|
def __init__(self, tokens, selector_list, declaration_block, pre_fluff, post_fluff):
|
||||||
# type: (List[Token], 'CssSelectorList', 'CssDeclarationBlock', str, str) -> None
|
# type: (List[Token], 'CssSelectorList', 'CssDeclarationBlock', str, str) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -407,7 +407,7 @@ class CssSection(object):
|
|||||||
res += handle_postfluff(self.post_fluff, space_after_first_line=True)
|
res += handle_postfluff(self.post_fluff, space_after_first_line=True)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class CssSelectorList(object):
|
class CssSelectorList:
|
||||||
def __init__(self, tokens, selectors):
|
def __init__(self, tokens, selectors):
|
||||||
# type: (List[Token], List['CssSelector']) -> None
|
# type: (List[Token], List['CssSelector']) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -417,7 +417,7 @@ class CssSelectorList(object):
|
|||||||
# type: () -> str
|
# type: () -> str
|
||||||
return ',\n'.join(sel.text() for sel in self.selectors)
|
return ',\n'.join(sel.text() for sel in self.selectors)
|
||||||
|
|
||||||
class CssSelector(object):
|
class CssSelector:
|
||||||
def __init__(self, tokens, pre_fluff, post_fluff, levels):
|
def __init__(self, tokens, pre_fluff, post_fluff, levels):
|
||||||
# type: (List[Token],str, str, List[Token]) -> None
|
# type: (List[Token],str, str, List[Token]) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -430,7 +430,7 @@ class CssSelector(object):
|
|||||||
res = ' '.join(level.s for level in self.levels)
|
res = ' '.join(level.s for level in self.levels)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class CssDeclarationBlock(object):
|
class CssDeclarationBlock:
|
||||||
def __init__(self, tokens, declarations):
|
def __init__(self, tokens, declarations):
|
||||||
# type: (List[Token], List['CssDeclaration']) -> None
|
# type: (List[Token], List['CssDeclaration']) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -444,7 +444,7 @@ class CssDeclarationBlock(object):
|
|||||||
res += '}'
|
res += '}'
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class CssDeclaration(object):
|
class CssDeclaration:
|
||||||
def __init__(self, tokens, pre_fluff, post_fluff, css_property, css_value, semicolon):
|
def __init__(self, tokens, pre_fluff, post_fluff, css_property, css_value, semicolon):
|
||||||
# type: (List[Token], str, str, str, 'CssValue', bool) -> None
|
# type: (List[Token], str, str, str, 'CssValue', bool) -> None
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
@@ -471,7 +471,7 @@ class CssDeclaration(object):
|
|||||||
res += handle_postfluff(self.post_fluff, True, True)
|
res += handle_postfluff(self.post_fluff, True, True)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class CssValue(object):
|
class CssValue:
|
||||||
def __init__(self, tokens, value, pre_fluff, post_fluff):
|
def __init__(self, tokens, value, pre_fluff, post_fluff):
|
||||||
# type: (List[Token], Token, str, str) -> None
|
# type: (List[Token], Token, str, str) -> None
|
||||||
self.value = value
|
self.value = value
|
||||||
@@ -498,7 +498,7 @@ def ws(c):
|
|||||||
def tokenize(text):
|
def tokenize(text):
|
||||||
# type: (str) -> List[Token]
|
# type: (str) -> List[Token]
|
||||||
|
|
||||||
class State(object):
|
class State:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.i = 0
|
self.i = 0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from typing import Callable, DefaultDict, Iterator, List, Optional, Set, Tuple
|
|||||||
Edge = Tuple[str, str]
|
Edge = Tuple[str, str]
|
||||||
EdgeSet = Set[Edge]
|
EdgeSet = Set[Edge]
|
||||||
|
|
||||||
class Graph(object):
|
class Graph:
|
||||||
def __init__(self, tuples):
|
def __init__(self, tuples):
|
||||||
# type: (EdgeSet) -> None
|
# type: (EdgeSet) -> None
|
||||||
self.children = defaultdict(list) # type: DefaultDict[str, List[str]]
|
self.children = defaultdict(list) # type: DefaultDict[str, List[str]]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class HtmlBranchesException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HtmlTreeBranch(object):
|
class HtmlTreeBranch:
|
||||||
"""
|
"""
|
||||||
For <p><div id='yo'>bla<span class='bar'></span></div></p>, store a
|
For <p><div id='yo'>bla<span class='bar'></span></div></p>, store a
|
||||||
representation of the tags all the way down to the leaf, which would
|
representation of the tags all the way down to the leaf, which would
|
||||||
@@ -59,7 +59,7 @@ class HtmlTreeBranch(object):
|
|||||||
return ' '.join(t.text() for t in self.tags)
|
return ' '.join(t.text() for t in self.tags)
|
||||||
|
|
||||||
|
|
||||||
class Node(object):
|
class Node:
|
||||||
def __init__(self, token, parent): # FIXME parent parameter is not used!
|
def __init__(self, token, parent): # FIXME parent parameter is not used!
|
||||||
# type: (Token, Optional[Node]) -> None
|
# type: (Token, Optional[Node]) -> None
|
||||||
self.token = token
|
self.token = token
|
||||||
@@ -67,7 +67,7 @@ class Node(object):
|
|||||||
self.parent = None # type: Optional[Node]
|
self.parent = None # type: Optional[Node]
|
||||||
|
|
||||||
|
|
||||||
class TagInfo(object):
|
class TagInfo:
|
||||||
def __init__(self, tag, classes, ids, token):
|
def __init__(self, tag, classes, ids, token):
|
||||||
# type: (str, List[str], List[str], Token) -> None
|
# type: (str, List[str], List[str], Token) -> None
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def show_all_branches(fns):
|
|||||||
print(branch.text())
|
print(branch.text())
|
||||||
print('---')
|
print('---')
|
||||||
|
|
||||||
class Grepper(object):
|
class Grepper:
|
||||||
'''
|
'''
|
||||||
A Grepper object is optimized to do repeated
|
A Grepper object is optimized to do repeated
|
||||||
searches of words that can be found in our
|
searches of words that can be found in our
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ class TokenizationException(Exception):
|
|||||||
self.message = message
|
self.message = message
|
||||||
self.line_content = line_content
|
self.line_content = line_content
|
||||||
|
|
||||||
class TokenizerState(object):
|
class TokenizerState:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.i = 0
|
self.i = 0
|
||||||
self.line = 1
|
self.line = 1
|
||||||
self.col = 1
|
self.col = 1
|
||||||
|
|
||||||
class Token(object):
|
class Token:
|
||||||
def __init__(self, kind, s, tag, line, col, line_span):
|
def __init__(self, kind, s, tag, line, col, line_span):
|
||||||
# type: (str, str, str, int, int, int) -> None
|
# type: (str, str, str, int, int, int) -> None
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
@@ -183,7 +183,7 @@ def validate(fn=None, text=None, check_indent=True):
|
|||||||
|
|
||||||
tokens = tokenize(text)
|
tokens = tokenize(text)
|
||||||
|
|
||||||
class State(object):
|
class State:
|
||||||
def __init__(self, func):
|
def __init__(self, func):
|
||||||
# type: (Callable[[Token], None]) -> None
|
# type: (Callable[[Token], None]) -> None
|
||||||
self.depth = 0
|
self.depth = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user