mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 11:03:54 +00:00
python: Convert assignment type annotations to Python 3.6 style.
Commit split by tabbott; this has changes to scripts/, tools/, and
puppet/.
scripts/lib/hash_reqs.py, scripts/lib/setup_venv.py,
scripts/lib/zulip_tools.py, and tools/lib/provision.py are excluded so
tools/provision still gives the right error message on Ubuntu 16.04
with Python 3.5.
Generated by com2ann, with whitespace fixes and various manual fixes
for runtime issues:
-shebang_rules: List[Rule] = [
+shebang_rules: List["Rule"] = [
-trailing_whitespace_rule: Rule = {
+trailing_whitespace_rule: "Rule" = {
-whitespace_rules: List[Rule] = [
+whitespace_rules: List["Rule"] = [
-comma_whitespace_rule: List[Rule] = [
+comma_whitespace_rule: List["Rule"] = [
-prose_style_rules: List[Rule] = [
+prose_style_rules: List["Rule"] = [
-html_rules: List[Rule] = whitespace_rules + prose_style_rules + [
+html_rules: List["Rule"] = whitespace_rules + prose_style_rules + [
- target_port: int = None
+ target_port: int
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
ad07814fa4
commit
f8339f019d
@@ -17,23 +17,24 @@ def pretty_print_html(html: str, num_spaces: int = 4) -> str:
|
||||
# We will keep a stack of "start" tags so that we know
|
||||
# when HTML ranges end. Note that some start tags won't
|
||||
# be blocks from an indentation standpoint.
|
||||
stack = [] # type: List[Dict[str, Any]]
|
||||
stack: List[Dict[str, Any]] = []
|
||||
|
||||
# Seed our stack with a pseudo entry to make depth calculations
|
||||
# easier.
|
||||
info = dict(
|
||||
info: Dict[str, Any] = dict(
|
||||
block=False,
|
||||
depth=-1,
|
||||
line=-1,
|
||||
token_kind='html_start',
|
||||
tag='html',
|
||||
extra_indent=0,
|
||||
ignore_lines=[]) # type: Dict[str, Any]
|
||||
ignore_lines=[],
|
||||
)
|
||||
stack.append(info)
|
||||
|
||||
# Our main job is to figure out offsets that we use to nudge lines
|
||||
# over by.
|
||||
offsets = {} # type: Dict[int, int]
|
||||
offsets: Dict[int, int] = {}
|
||||
|
||||
# Loop through our start/end tokens, and calculate offsets. As
|
||||
# we proceed, we will push/pop info dictionaries on/off a stack.
|
||||
|
||||
Reference in New Issue
Block a user