- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Fix: fixed start sploit for linters #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/back_refactor
Are you sure you want to change the base?
Conversation
|  | ||
|  | ||
| def highlight(text, style=None): | ||
| def highlight(text: str, style: Optional[List[Style]] = None) -> str: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше сделать Optional[List[Style]] -> list[Style] | None, мы используем новый стандарт питона, поэтому так будет красивее, правильно и меньше импортов
| from math import ceil | ||
| from urllib.parse import urljoin | ||
| from urllib.request import Request, urlopen | ||
| from typing import List, Optional, Any, Tuple, Dict, Iterator, Set, IO, Mapping | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Из импортов нужно 100% убрать List(list), Optional(| None), Tuple(tuple), Dict(dict). Возможно убрать Set(можно заменить на set наверно)
| import subprocess | ||
| import time | ||
| import threading | ||
| from re import Pattern | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше убрать, до этого импортировали уже re, снизу лучше писать re.Pattern тогда
|  | ||
|  | ||
| def check_script_source(source, interpreter): | ||
| def check_script_source(source: str, interpreter: Optional[str]) -> List[str]: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional и List
| raise APIException(conn.read()) | ||
|  | ||
| return json.loads(conn.read().decode()) | ||
| return json.loads(conn.read().decode()) # type: ignore[no-any-return] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше через isinstance проверить что мы получили dict и дальше с ним работать, если не dict то кидать ошибку, а type: ignore убрать
|  | ||
|  | ||
| def post_flags(args, flags): | ||
| def post_flags(args: argparse.Namespace, flags: List[Dict[str, str]]) -> None: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List и Dict
| self._lock = threading.RLock() | ||
| def __init__(self) -> None: | ||
| self._flags_seen: Set[str] = set() | ||
| self._queue: List[Dict[str, str]] = [] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List, Dict и Set
| self._lock: threading.RLock = threading.RLock() | ||
|  | ||
| def add(self, flags, team_name): | ||
| def add(self, flags: Set[str], team_name: str) -> None: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set
| self._queue.append({"flag": item, "team": team_name}) | ||
|  | ||
| def pick_flags(self): | ||
| def pick_flags(self) -> List[Dict[str, str]]: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List и Dict
|  | ||
|  | ||
| def display_sploit_output(team_name, output_lines): | ||
| def display_sploit_output(team_name: str, output_lines: List[str]) -> None: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List
| stream: IO[bytes], | ||
| args: argparse.Namespace, | ||
| team_name: str, | ||
| flag_format: Pattern[str], | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re.Pattern
| self.instances = {} | ||
| def __init__(self) -> None: | ||
| self._counter: int = 0 | ||
| self.instances: Dict[int, subprocess.Popen[bytes]] = {} | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dict
| team_name: str, | ||
| team_addr: Optional[str], | ||
| attack_no: int, | ||
| flag_format: Pattern[str], | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional, Pattern и Tuple
| config: Optional[Dict[str, Any]] = None | ||
| flag_format: Optional[re.Pattern[str]] = None | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional и Dict
|  | ||
| def show_time_limit_info(args, config, max_runtime, attack_no): | ||
| def show_time_limit_info( | ||
| args: argparse.Namespace, config: Dict[str, Any], max_runtime: float, attack_no: int | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dict
| team_addr: Optional[str], | ||
| attack_no: int, | ||
| max_runtime: float, | ||
| flag_format: Pattern[str], | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional и Pattern
| args: argparse.Namespace, teams: Dict[str, str], attack_no: int | ||
| ) -> Mapping[str, Optional[str]]: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dict, Optional
No description provided.