mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 05:28:13 +02:00
fixed typing of parameters for server version of
python
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Literal, Optional, Union
|
||||||
import json, argparse, os, uuid
|
import json, argparse, os, uuid
|
||||||
from utils import prompt_yes_no
|
from utils import prompt_yes_no
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ class Dataset:
|
|||||||
to_dump = Dataset(entries=entries_to_dump)
|
to_dump = Dataset(entries=entries_to_dump)
|
||||||
print(f"{len(entries_to_dump)} entries...", end=" ", flush=True)
|
print(f"{len(entries_to_dump)} entries...", end=" ", flush=True)
|
||||||
|
|
||||||
def transform_entry(entry: DatasetEntry | Dataset | Any) -> dict | list:
|
def transform_entry(entry: Union[DatasetEntry, Dataset, Any]) -> Union[dict, list]:
|
||||||
if not isinstance(entry, (DatasetEntry, Dataset)):
|
if not isinstance(entry, (DatasetEntry, Dataset)):
|
||||||
return entry.__dict__
|
return entry.__dict__
|
||||||
|
|
||||||
|
3
utils.py
3
utils.py
@ -1,5 +1,6 @@
|
|||||||
import os, sys, logging, subprocess
|
import os, sys, logging, subprocess
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from typing import Optional
|
||||||
from github.Commit import Commit
|
from github.Commit import Commit
|
||||||
from github.PaginatedList import PaginatedList
|
from github.PaginatedList import PaginatedList
|
||||||
from github.PullRequestComment import PullRequestComment
|
from github.PullRequestComment import PullRequestComment
|
||||||
@ -166,7 +167,7 @@ def run_git_cmd(cmd: list[str], repo_path: str) -> subprocess.CompletedProcess:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def prompt_yes_no(prompt: str, *, default: bool | None = None) -> bool:
|
def prompt_yes_no(prompt: str, *, default: Optional[bool] = None) -> bool:
|
||||||
choices = "y/n"
|
choices = "y/n"
|
||||||
if default is not None:
|
if default is not None:
|
||||||
choices = "Y/n" if default else "y/N"
|
choices = "Y/n" if default else "y/N"
|
||||||
|
Reference in New Issue
Block a user