Remove inheritance from object.

This commit is contained in:
rht
2017-11-05 11:57:15 +01:00
committed by showell
parent 8990b1046d
commit e3eebf3be0
6 changed files with 19 additions and 19 deletions

View File

@@ -101,7 +101,7 @@ class Confirmation(models.Model):
def __str__(self) -> Text:
return '<Confirmation: %s>' % (self.content_object,)
class ConfirmationType(object):
class ConfirmationType:
def __init__(self, url_name: str,
validity_in_days: int=settings.CONFIRMATION_LINK_DEFAULT_VALIDITY_DAYS) -> None:
self.url_name = url_name

View File

@@ -2,7 +2,7 @@ from typing import Callable, List, Tuple, Union
####### Helpers
class Token(object):
class Token:
def __init__(self, s, line, col):
# type: (str, int, int) -> None
self.s = s
@@ -350,7 +350,7 @@ def handle_postfluff(post_fluff, indent=False, space_after_first_line=False):
#### Begin CSS classes here
class CssSectionList(object):
class CssSectionList:
def __init__(self, tokens, sections):
# type: (List[Token], List[Union['CssNestedSection', 'CssSection']]) -> None
self.tokens = tokens
@@ -361,7 +361,7 @@ class CssSectionList(object):
res = ''.join(section.text() for section in self.sections)
return res
class CssNestedSection(object):
class CssNestedSection:
def __init__(self, tokens, selector_list, section_list, pre_fluff, post_fluff):
# type: (List[Token], 'CssSelectorList', CssSectionList, str, str) -> None
self.tokens = tokens
@@ -388,7 +388,7 @@ class CssNestedSection(object):
res += self.post_fluff
return res
class CssSection(object):
class CssSection:
def __init__(self, tokens, selector_list, declaration_block, pre_fluff, post_fluff):
# type: (List[Token], 'CssSelectorList', 'CssDeclarationBlock', str, str) -> None
self.tokens = tokens
@@ -407,7 +407,7 @@ class CssSection(object):
res += handle_postfluff(self.post_fluff, space_after_first_line=True)
return res
class CssSelectorList(object):
class CssSelectorList:
def __init__(self, tokens, selectors):
# type: (List[Token], List['CssSelector']) -> None
self.tokens = tokens
@@ -417,7 +417,7 @@ class CssSelectorList(object):
# type: () -> str
return ',\n'.join(sel.text() for sel in self.selectors)
class CssSelector(object):
class CssSelector:
def __init__(self, tokens, pre_fluff, post_fluff, levels):
# type: (List[Token],str, str, List[Token]) -> None
self.tokens = tokens
@@ -430,7 +430,7 @@ class CssSelector(object):
res = ' '.join(level.s for level in self.levels)
return res
class CssDeclarationBlock(object):
class CssDeclarationBlock:
def __init__(self, tokens, declarations):
# type: (List[Token], List['CssDeclaration']) -> None
self.tokens = tokens
@@ -444,7 +444,7 @@ class CssDeclarationBlock(object):
res += '}'
return res
class CssDeclaration(object):
class CssDeclaration:
def __init__(self, tokens, pre_fluff, post_fluff, css_property, css_value, semicolon):
# type: (List[Token], str, str, str, 'CssValue', bool) -> None
self.tokens = tokens
@@ -471,7 +471,7 @@ class CssDeclaration(object):
res += handle_postfluff(self.post_fluff, True, True)
return res
class CssValue(object):
class CssValue:
def __init__(self, tokens, value, pre_fluff, post_fluff):
# type: (List[Token], Token, str, str) -> None
self.value = value
@@ -498,7 +498,7 @@ def ws(c):
def tokenize(text):
# type: (str) -> List[Token]
class State(object):
class State:
def __init__(self):
# type: () -> None
self.i = 0

View File

@@ -6,7 +6,7 @@ from typing import Callable, DefaultDict, Iterator, List, Optional, Set, Tuple
Edge = Tuple[str, str]
EdgeSet = Set[Edge]
class Graph(object):
class Graph:
def __init__(self, tuples):
# type: (EdgeSet) -> None
self.children = defaultdict(list) # type: DefaultDict[str, List[str]]

View File

@@ -14,7 +14,7 @@ class HtmlBranchesException(Exception):
pass
class HtmlTreeBranch(object):
class HtmlTreeBranch:
"""
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
@@ -59,7 +59,7 @@ class HtmlTreeBranch(object):
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!
# type: (Token, Optional[Node]) -> None
self.token = token
@@ -67,7 +67,7 @@ class Node(object):
self.parent = None # type: Optional[Node]
class TagInfo(object):
class TagInfo:
def __init__(self, tag, classes, ids, token):
# type: (str, List[str], List[str], Token) -> None
self.tag = tag

View File

@@ -13,7 +13,7 @@ def show_all_branches(fns):
print(branch.text())
print('---')
class Grepper(object):
class Grepper:
'''
A Grepper object is optimized to do repeated
searches of words that can be found in our

View File

@@ -15,14 +15,14 @@ class TokenizationException(Exception):
self.message = message
self.line_content = line_content
class TokenizerState(object):
class TokenizerState:
def __init__(self):
# type: () -> None
self.i = 0
self.line = 1
self.col = 1
class Token(object):
class Token:
def __init__(self, kind, s, tag, line, col, line_span):
# type: (str, str, str, int, int, int) -> None
self.kind = kind
@@ -183,7 +183,7 @@ def validate(fn=None, text=None, check_indent=True):
tokens = tokenize(text)
class State(object):
class State:
def __init__(self, func):
# type: (Callable[[Token], None]) -> None
self.depth = 0