Skip to content

Commit

Permalink
fixed mypy for bi-ci (#169)
Browse files Browse the repository at this point in the history
* fixed mypy for bi-ci

* fixed mypy for dl-repmanager

* fixed mypy for dl-repmanager .

* fixed mypy for dl-repmanager .

* fixed mypy for dl-repmanager .

* fixed mypy for dl-repmanager ..

* fixed mypy for dl-repmanager ..

* fixed mypy for dl-repmanager ..

* fixed mypy for dl-repmanager ..

* Update cherry_farmer_cli.py

Fixes following PR

* Update cherry_farmer_cli.py

cleanup gh web editor
  • Loading branch information
evilkost authored Dec 15, 2023
1 parent 8862a1e commit c29a4b5
Show file tree
Hide file tree
Showing 24 changed files with 447 additions and 68 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/terrarium_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
matrix:
value:
- bi_ci
# - dl_cli_tools
- dl_gitmanager
- dl_repmanager
name: "🐊[pytest] ${{ matrix.value }}"
steps:
Expand Down Expand Up @@ -50,6 +52,8 @@ jobs:
matrix:
value:
- bi_ci
- dl_cli_tools
- dl_gitmanager
- dl_repmanager
name: "🐊[mypy] ${{ matrix.value }}"
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ ci_artifacts
artifacts
Taskfile.yml
.obsidian
terrarium/dl_repmanager/poetry.lock
8 changes: 7 additions & 1 deletion terrarium/bi_ci/bi_ci/split_pytest_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ def get_package_tests(
package_path: str,
requested_mode: str,
) -> typing.Generator[tuple[str, str], None, None]:
pytest_targets: dict | None = {}
try:
pytest_targets = read_pytest_targets(root_path / package_path / "pyproject.toml")
except FileNotFoundError:
return

if pytest_targets is None:
return

for section in pytest_targets.keys():
spec = pytest_targets.get(section, {})
labels = spec.get("labels", [])
Expand All @@ -72,13 +76,15 @@ def get_default_package_tests(
root_path: pathlib.Path,
package_path: str,
) -> typing.Generator[tuple[str, str], None, None]:
pytest_targets: dict | None = {}
try:
pytest_targets = read_pytest_targets(root_path / package_path / "pyproject.toml")
except FileNotFoundError:
return

if len(pytest_targets) == 0:
if not pytest_targets or len(pytest_targets) == 0:
yield package_path, "__default__"
return

for section, spec in pytest_targets.items():
labels = spec.get("labels", [])
Expand Down
9 changes: 7 additions & 2 deletions terrarium/dl_cli_tools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ readme = "README.md"
[tool.poetry.dependencies]
attrs = ">=22.2.0"
python = ">=3.10, <3.12"
#datalens-constants = {path = "../../lib/dl_constants"}


[tool.poetry.group.pytest.dependencies]

[tool.poetry.group.mypy.dependencies]
mypy = ">= 1.7.0"


[tool.poetry.group.tests.dependencies]
pytest = ">=7.2.2"
Expand All @@ -28,7 +34,6 @@ addopts = "-ra"
testpaths = []



[datalens_ci]
skip_test = true

Expand Down
5 changes: 4 additions & 1 deletion terrarium/dl_gitmanager/dl_gitmanager/cherry_farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ def _make_commit_runtime_state_item(self, commit_obj: Commit) -> CommitRuntimeSt
timestamp=commit_obj.committed_date,
)

message = commit_obj.message
if isinstance(message, bytes):
message = message.decode()
return CommitRuntimeStateItem(
saved_state=commit_saved_state_item,
commit_message=commit_obj.message,
commit_message=message,
)

def iter_diff_commits(
Expand Down
2 changes: 2 additions & 0 deletions terrarium/dl_gitmanager/dl_gitmanager/git_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class GitManager:
path_prefix: Path = attr.ib(kw_only=True, default=Path("."))

def get_root_path(self) -> Path:
if self.git_repo.working_tree_dir is None:
raise RuntimeError("No working tree dir")
return Path(self.git_repo.working_tree_dir)

def get_commit_obj(self, commit_specifier: str) -> Commit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _get_states(self, picked: bool, ignored: bool, new: bool, all: bool) -> set[

if not result:
# no flags means "all"
return self._get_states(new=True)
return self._get_states(new=True, picked=False, ignored=False, all=True)

return result

Expand All @@ -147,9 +147,7 @@ def _print_pick_suggestion(self, suggestion_item: CommitRuntimeStateItem) -> Non
{Style.RESET_ALL}"""
print(text)

def show(
self, src_branch: str, dst_branch: Optional[str], picked: bool, ignored: bool, new: bool, all: bool
) -> None:
def show(self, src_branch: str, dst_branch: str, picked: bool, ignored: bool, new: bool, all: bool) -> None:
states = self._get_states(picked=picked, ignored=ignored, new=new, all=all)
for commit_state_item in self.cherry_farmer.iter_diff_commits(
src_branch=src_branch,
Expand Down Expand Up @@ -192,7 +190,7 @@ def _prompt_mark_commit(self, commit_state_item: CommitRuntimeStateItem) -> tupl
def iter_(
self,
src_branch: str,
dst_branch: Optional[str],
dst_branch: str,
picked: bool,
ignored: bool,
new: bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_parser(cls) -> argparse.ArgumentParser:

return parser

def range_diff_paths(self, base: str, head: Optional[str], absolute: bool, only_added_commits: bool) -> None:
def range_diff_paths(self, base: str, head: str, absolute: bool, only_added_commits: bool) -> None:
diff_name_list = self.git_manager.get_range_diff_paths(
base=base,
head=head,
Expand Down
257 changes: 257 additions & 0 deletions terrarium/dl_gitmanager/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c29a4b5

Please sign in to comment.