Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
Added some return types
Browse files Browse the repository at this point in the history
I just realised that I earlier commited to main instead of dev, uhh
  • Loading branch information
tygoee committed Mar 5, 2024
1 parent 1d72710 commit 14beb8d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Empty file added src/gui/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion src/install/loadingbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def update(self, amount: int) -> None:
self.idx += amount
self.refresh()

def set_desc(self, description: str):
def set_desc(self, description: str) -> None:
"Set the description"

# Cut off the description if it's longer than the terminal width
Expand Down
2 changes: 1 addition & 1 deletion src/install/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _prepare_media(self, media_type: str, media_list: MediaList) -> None:
print(f" {media['slug']} ({parse.unquote(media['name'])})")


def download_file(url: str, fname: str, bar: loadingbar[int]):
def download_file(url: str, fname: str, bar: loadingbar[int]) -> None:
try:
# Download and write the file
with request.urlopen(url) as resp, open(fname, 'wb') as media_file:
Expand Down
7 changes: 5 additions & 2 deletions src/install/modloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ def install_libraries(self) -> None:
rules = library.get('rules', [])

self.libraries[library['name']] = library['downloads']['artifact']
self.libraries[library['name']].update(rules[-1] if rules else {})

# A bug in the type checker, it worked earlier
self.libraries[library['name']].update(
rules[-1] if rules else {}) # type: ignore

# Define the total size
total_size = sum([library['size']
Expand Down Expand Up @@ -398,7 +401,7 @@ def inst_modloader(
side: Side,
install_path: str,
launcher_path: str
):
) -> None:
"""
Installs the modloader. Used internally by media.py
Expand Down
6 changes: 3 additions & 3 deletions src/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __new__(cls) -> _Args:
return _Args(**vars(cls.parser.parse_args()))

@classmethod
def _cli(cls, args: _Args):
def _cli(cls, args: _Args) -> None:
"""Ask questions and execute `install()` with the answers"""

_T = TypeVar("_T")
Expand Down Expand Up @@ -159,7 +159,7 @@ def ask_yes(arg: bool, question: str) -> bool:
install(**answers)

@classmethod
def execute(cls, args: _Args):
def execute(cls, args: _Args) -> None:
if args.s not in ('client', 'server') and args.s is not None:
raise TypeError(
"side has to be either 'client', 'server' or None.")
Expand Down Expand Up @@ -189,7 +189,7 @@ def execute(cls, args: _Args):
)


def main():
def main() -> None:
# Get the command-line arguments
args = parse()

Expand Down

0 comments on commit 14beb8d

Please sign in to comment.