Skip to content

Commit 28eb7ba

Browse files
branchvabn
authored andcommitted
chore: convert type comments to annotations
1 parent 4df57ba commit 28eb7ba

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

cleo/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def find_similar_names(name: str, names: List[str]) -> List[str]:
9494
]
9595

9696

97-
def format_time(secs): # type: (float) -> str
97+
def format_time(secs: float) -> str:
9898
for fmt in _TIME_FORMATS:
9999
if secs > fmt[0]:
100100
continue

cleo/commands/command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self) -> None:
4040
super().__init__()
4141

4242
@property
43-
def io(self): # type: () -> IO
43+
def io(self) -> IO:
4444
return self._io
4545

4646
def configure(self) -> None:
@@ -104,7 +104,7 @@ def call(self, name: str, args: Optional[str] = None) -> int:
104104

105105
return self.application._run_command(command, self._io.with_input(input))
106106

107-
def call_silent(self, name, args=None): # type: (str, Optional[str]) -> int
107+
def call_silent(self, name: str, args: Optional[str] = None) -> int:
108108
"""
109109
Call another command silently.
110110
"""

cleo/commands/completions_command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class CompletionsCommand(Command):
101101
script. Consult your shells documentation for how to add such directives.
102102
"""
103103

104-
def handle(self): # type: () -> int
104+
def handle(self) -> int:
105105
shell = self.argument("shell")
106106
if not shell:
107107
shell = self.get_shell_type()
@@ -117,10 +117,10 @@ def handle(self): # type: () -> int
117117

118118
return 0
119119

120-
def render(self, shell): # type: (str) -> str
120+
def render(self, shell: str) -> str:
121121
return getattr(self, f"render_{shell}")()
122122

123-
def render_bash(self): # type: () -> str
123+
def render_bash(self) -> str:
124124
template = TEMPLATES["bash"]
125125

126126
script_name = self._io.input.script_name

cleo/io/inputs/token_parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class TokenParser:
88
"""
99

1010
def __init__(self) -> None:
11-
self._string = "" # type: str
12-
self._cursor = 0 # type: int
13-
self._current = None # type: Optional[str]
14-
self._next_ = None # type: Optional[str]
11+
self._string: str = ""
12+
self._cursor: int = 0
13+
self._current: Optional[str] = None
14+
self._next_: Optional[str] = None
1515

1616
def parse(self, string: str) -> List[str]:
1717
self._string = string

cleo/io/outputs/section_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ def clear(self, lines: Optional[int] = None) -> None:
5555
self._pop_stream_content_until_current_section(lines), new_line=False
5656
)
5757

58-
def overwrite(self, message): # type: (str) -> None
58+
def overwrite(self, message: str) -> None:
5959
self.clear()
6060
self.write_line(message)
6161

62-
def add_content(self, content): # type: (str) -> None
62+
def add_content(self, content: str) -> None:
6363
for line_content in content.split("\n"):
6464
self._lines += (
6565
math.ceil(

cleo/testers/application_tester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def application(self) -> Application:
2323
return self._application
2424

2525
@property
26-
def io(self): # type: () -> BufferedIO
26+
def io(self) -> BufferedIO:
2727
return self._io
2828

2929
@property
30-
def status_code(self): # type: () -> int
30+
def status_code(self) -> int:
3131
return self._status_code
3232

3333
def execute(

cleo/testers/command_tester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def io(self) -> BufferedIO:
2828
return self._io
2929

3030
@property
31-
def status_code(self): # type: () -> int
31+
def status_code(self) -> int:
3232
return self._status_code
3333

3434
def execute(

0 commit comments

Comments
 (0)