Skip to content

Commit

Permalink
Merge pull request #101 from Weissle/fix/backward-compatibility-py38
Browse files Browse the repository at this point in the history
fix: Backward compatibility with python3.8 and python3.9 (closes #99)
  • Loading branch information
kraanzu authored Mar 15, 2023
2 parents 788f13c + 2f58a01 commit 0d2e648
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dooit/ui/widgets/help_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def convert_to_row(bindings: Dict):


def generate_kb_table(
kb: dict[str, str], topic: str, notes: list[str] = []
kb: Dict[str, str], topic: str, notes: List[str] = []
) -> RenderableType:
"""
Generate Table for modes
Expand Down
10 changes: 5 additions & 5 deletions dooit/ui/widgets/simple_input.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pyperclip
from typing import Any, Literal
from typing import Any, Literal, Optional, List, Tuple
from rich.style import StyleType
from rich.text import Text, TextType
from rich.box import Box
Expand All @@ -20,15 +20,15 @@ class SimpleInput(Widget):

def __init__(
self,
name: str | None = None,
name: Optional[str] = None,
value: Any = "",
title: TextType = "",
title_align: AlignMethod = "center",
border_style: StyleType = "blue",
box: Box | None = None,
box: Optional[Box] = None,
placeholder: Text = Text("", style="dim white"),
password: bool = False,
list: tuple[Literal["blacklist", "whitelist"], list[str]] = ("blacklist", []),
list: Tuple[Literal["blacklist", "whitelist"], List[str]] = ("blacklist", []),
) -> None:
super().__init__(name=name)
self.title = title
Expand Down Expand Up @@ -107,7 +107,7 @@ def _is_allowed(self, text: str) -> bool:

return True

async def _insert_text(self, text: str | None = None) -> None:
async def _insert_text(self, text: Optional[str] = None) -> None:
"""
Inserts text where the cursor is
"""
Expand Down
6 changes: 3 additions & 3 deletions dooit/ui/widgets/sort_options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Type
from typing import Optional, Type, List
from rich.align import Align
from rich.box import HEAVY
from rich.console import RenderableType
Expand All @@ -20,8 +20,8 @@ class SortOptions(Widget):

def __init__(
self,
name: str | None = None,
options: list[str] = [],
name: Optional[str] = None,
options: List[str] = [],
parent_widget: Optional[Widget] = None,
style_unfocused: StyleType = "white",
style_focused: StyleType = "bold reverse green ",
Expand Down
2 changes: 1 addition & 1 deletion dooit/ui/widgets/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TreeList(Widget):

def __init__(
self,
name: str | None = None,
name: Optional[str] = None,
model: Manager = manager,
) -> None:
super().__init__(name=name)
Expand Down
8 changes: 4 additions & 4 deletions dooit/utils/keybinder.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from collections import defaultdict
from typing import DefaultDict, Dict, List, Optional, Union
from dooit.utils.conf_reader import Config

configured_keys = Config().get("keybindings")
from copy import deepcopy
customed_keys = Config().get("keybindings")


class Bind:
Expand Down Expand Up @@ -53,8 +53,8 @@ def __init__(self, func_name: str, params: List[str]) -> None:
"decrease urgency": ["-", "_"],
"exit": "<ctrl+q>",
}

configured_keys = DEFAULTS | configured_keys
configured_keys = deepcopy(DEFAULTS)
configured_keys.update(customed_keys)


class KeyBinder:
Expand Down

0 comments on commit 0d2e648

Please sign in to comment.