Skip to content

Commit

Permalink
airbyte-ci: correct type annotation, deterministic transform_strs_to_…
Browse files Browse the repository at this point in the history
…paths behaviour
  • Loading branch information
postamar committed Nov 27, 2023
1 parent 5d2161e commit 54307a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions airbyte-ci/connectors/pipelines/pipelines/cli/airbyte_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import sys
from pathlib import Path
from typing import List, Optional
from typing import Optional, Set

import asyncclick as click
import docker
Expand Down Expand Up @@ -141,7 +141,7 @@ def set_working_directory_to_root() -> None:
os.chdir(working_dir)


async def get_modified_files(git_branch: str, git_revision: str, diffed_branch: str, is_local: bool, ci_context: CIContext) -> List[str]:
async def get_modified_files(git_branch: str, git_revision: str, diffed_branch: str, is_local: bool, ci_context: CIContext) -> Set[str]:
"""Get the list of modified files in the current git branch.
If the current branch is master, it will return the list of modified files in the head commit.
The head commit on master should be the merge commit of the latest merged pull request as we squash commits on merge.
Expand Down
10 changes: 5 additions & 5 deletions airbyte-ci/connectors/pipelines/pipelines/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import unicodedata
from io import TextIOWrapper
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Set, Tuple

import anyio
import asyncer
Expand Down Expand Up @@ -308,16 +308,16 @@ def sh_dash_c(lines: List[str]) -> List[str]:
return ["sh", "-c", " && ".join(["set -o xtrace"] + lines)]


def transform_strs_to_paths(str_paths: List[str]) -> List[Path]:
"""Transform a list of string paths to a list of Path objects.
def transform_strs_to_paths(str_paths: Set[str]) -> List[Path]:
"""Transform a list of string paths to an ordered list of Path objects.
Args:
str_paths (List[str]): A list of string paths.
str_paths (Set[str]): A set of string paths.
Returns:
List[Path]: A list of Path objects.
"""
return [Path(str_path) for str_path in str_paths]
return sorted([Path(str_path) for str_path in str_paths])


def fail_if_missing_docker_hub_creds(ctx: click.Context):
Expand Down

0 comments on commit 54307a1

Please sign in to comment.