mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
tools/check-templates: Use __init__ in Record.
Initialize Record by using __init__ instead of setting attributes in validate. This is needed because mypy complains when we set new attributes outside __init__.
This commit is contained in:
@@ -17,13 +17,16 @@ except ImportError as e:
|
||||
sys.exit(1)
|
||||
|
||||
class Record(object):
|
||||
pass
|
||||
def __init__(self, func):
|
||||
self.depth = 0
|
||||
self.i = 0
|
||||
self.line = 1
|
||||
self.col = 1
|
||||
self.matcher = func
|
||||
|
||||
def validate(fn, check_indent=True):
|
||||
text = open(fn).read()
|
||||
|
||||
state = Record()
|
||||
|
||||
def NoStartTag(end_tag):
|
||||
raise Exception('''
|
||||
No start tag
|
||||
@@ -60,11 +63,7 @@ def validate(fn, check_indent=True):
|
||||
state.depth -= 1
|
||||
state.matcher = f
|
||||
|
||||
state.depth = 0
|
||||
state.i = 0
|
||||
state.line = 1
|
||||
state.col = 1
|
||||
state.matcher = NoStartTag
|
||||
state = Record(NoStartTag)
|
||||
|
||||
def advance(n):
|
||||
for _ in range(n):
|
||||
|
||||
@@ -59,7 +59,6 @@ api/integrations/twitter/twitter-search-bot
|
||||
bots/check-mirroring
|
||||
bots/gcal-bot
|
||||
bots/githook-post-receive
|
||||
tools/check-templates
|
||||
tools/compile-handlebars-templates
|
||||
tools/deprecated/inject-messages/inject-messages
|
||||
tools/deprecated/review
|
||||
|
||||
Reference in New Issue
Block a user