# Path: xmanager/xm/executables.py
# def name_from_path(path: str) -> str:
#   def __attrs_post_init__(self):
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
# class ModuleName(NamedTuple):
# class CommandList(NamedTuple):
# class Dockerfile(job_blocks.ExecutableSpec):
# class PythonContainer(job_blocks.ExecutableSpec):
# class BinaryDependency(abc.ABC):
# class Container(job_blocks.ExecutableSpec):
# class Binary(job_blocks.ExecutableSpec):
# class BazelContainer(job_blocks.ExecutableSpec):
# class BazelBinary(job_blocks.ExecutableSpec):
# 
# Path: xmanager/xm/job_blocks.py
# class SequentialArgs:
#   class _RegularItem:
#   class _KeywordItem:
# class ExecutableSpec(abc.ABC):
# class Executable(abc.ABC):
# class ExecutorSpec(abc.ABC):
# class Executor(abc.ABC):
# class Packageable:
# class Constraint(abc.ABC):
# class Job:
# class JobGroup:
#   def __init__(self) -> None:
#   def _ingest_regular_item(self, value: Any) -> None:
#   def _ingest_keyword_item(self, name: str, value: Any) -> None:
#   def _merge_from(self, args: 'SequentialArgs') -> None:
#     def import_regular_item(item: SequentialArgs._RegularItem):
#     def import_keyword_item(item: SequentialArgs._KeywordItem):
#   def from_collection(collection: Optional[UserArgs]) -> 'SequentialArgs':
#     def check_for_string(args: str) -> None:
#     def import_sequential_args(args: SequentialArgs) -> None:
#     def import_mapping(collection: Mapping[Any, Any]) -> None:
#     def import_sequence(collection: Sequence[Any]) -> None:
#   def to_list(
#       self,
#       escaper: Callable[[Any], str],
#       kwargs_joiner: Callable[[str, str], str] = utils.trivial_kwargs_joiner
#   ) -> List[str]:
#     def export_regular_item(item: SequentialArgs._RegularItem) -> str:
#     def export_keyword_item(item: SequentialArgs._KeywordItem) -> str:
#   def to_dict(self, kwargs_only: bool = False) -> Dict[str, Any]:
#     def export_regular_item(
#         item: SequentialArgs._RegularItem) -> Tuple[str, Any]:
#     def export_keyword_item(
#         item: SequentialArgs._KeywordItem) -> Tuple[str, Any]:
#   def __eq__(self, other) -> bool:
#   def __repr__(self) -> str:
# def merge_args(*operands: Union[SequentialArgs, UserArgs]) -> SequentialArgs:
#   def name(self) -> str:
#   def Spec(cls) -> ExecutorSpec:  # pylint: disable=invalid-name
#   def __init__(self,
#                *,
#                constraints: Optional[Sequence[Constraint]] = None,
#                **jobs: JobType) -> None:


from typing import Collection, List, Mapping, Optional, Union
from xmanager.xm import executables
from xmanager.xm import job_blocks
import immutabledict
def bazel_container(
    executor_spec: job_blocks.ExecutorSpec,
    label: str,
    bazel_args: Collection[str] = (),
    *,
    args: Optional[job_blocks.UserArgs] = None,
    env_vars: Mapping[str, str] = immutabledict.immutabledict(),
) -> job_blocks.Packageable:
  # pyformat: disable
  """A Bazel target that produces a .tar image.

  Note that for targets based on https://github.com/bazelbuild/rules_docker one
  should append '.tar' to the label to specify a self-contained image.

  Args:
    executor_spec: Where the binary should be launched. Instructs for which
      platform it should be packaged.
    label: The Bazel target to be built.
    bazel_args: Bazel command line arguments.
    args: Command line arguments to pass. This can be dict, list or
      xm.SequentialArgs. Dicts are most convenient for keyword flags.
      {'batch_size': 16} is passed as --batch_size=16. If positional arguments
      are needed one can use a list or xm.SequentialArgs.
    env_vars: Environment variables to be set.

  Returns:
    A packageable object which can be turned into an executable with
    Experiment.package or Experiment.package_async.
  """
  # pyformat: enable

# Path: xmanager/xm/executables.py
# def name_from_path(path: str) -> str:
#   def __attrs_post_init__(self):
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
#   def name(self) -> str:
# class ModuleName(NamedTuple):
# class CommandList(NamedTuple):
# class Dockerfile(job_blocks.ExecutableSpec):
# class PythonContainer(job_blocks.ExecutableSpec):
# class BinaryDependency(abc.ABC):
# class Container(job_blocks.ExecutableSpec):
# class Binary(job_blocks.ExecutableSpec):
# class BazelContainer(job_blocks.ExecutableSpec):
# class BazelBinary(job_blocks.ExecutableSpec):
# 
# Path: xmanager/xm/job_blocks.py
# class SequentialArgs:
#   class _RegularItem:
#   class _KeywordItem:
# class ExecutableSpec(abc.ABC):
# class Executable(abc.ABC):
# class ExecutorSpec(abc.ABC):
# class Executor(abc.ABC):
# class Packageable:
# class Constraint(abc.ABC):
# class Job:
# class JobGroup:
#   def __init__(self) -> None:
#   def _ingest_regular_item(self, value: Any) -> None:
#   def _ingest_keyword_item(self, name: str, value: Any) -> None:
#   def _merge_from(self, args: 'SequentialArgs') -> None:
#     def import_regular_item(item: SequentialArgs._RegularItem):
#     def import_keyword_item(item: SequentialArgs._KeywordItem):
#   def from_collection(collection: Optional[UserArgs]) -> 'SequentialArgs':
#     def check_for_string(args: str) -> None:
#     def import_sequential_args(args: SequentialArgs) -> None:
#     def import_mapping(collection: Mapping[Any, Any]) -> None:
#     def import_sequence(collection: Sequence[Any]) -> None:
#   def to_list(
#       self,
#       escaper: Callable[[Any], str],
#       kwargs_joiner: Callable[[str, str], str] = utils.trivial_kwargs_joiner
#   ) -> List[str]:
#     def export_regular_item(item: SequentialArgs._RegularItem) -> str:
#     def export_keyword_item(item: SequentialArgs._KeywordItem) -> str:
#   def to_dict(self, kwargs_only: bool = False) -> Dict[str, Any]:
#     def export_regular_item(
#         item: SequentialArgs._RegularItem) -> Tuple[str, Any]:
#     def export_keyword_item(
#         item: SequentialArgs._KeywordItem) -> Tuple[str, Any]:
#   def __eq__(self, other) -> bool:
#   def __repr__(self) -> str:
# def merge_args(*operands: Union[SequentialArgs, UserArgs]) -> SequentialArgs:
#   def name(self) -> str:
#   def Spec(cls) -> ExecutorSpec:  # pylint: disable=invalid-name
#   def __init__(self,
#                *,
#                constraints: Optional[Sequence[Constraint]] = None,
#                **jobs: JobType) -> None:


# Path: xmanager/xm/packagables.py
from typing import Collection, List, Mapping, Optional, Union
from xmanager.xm import executables
from xmanager.xm import job_blocks
import immutabledict

def bazel_container(
    executor_spec: job_blocks.ExecutorSpec,
    label: str,
    bazel_args: Collection[str] = (),
    *,
    args: Optional[job_blocks.UserArgs] = None,
    env_vars: Mapping[str, str] = immutabledict.immutabledict(),
) -> job_blocks.Packageable:
  # pyformat: disable
  """A Bazel target that produces a .tar image.

  Note that for targets based on https://github.com/bazelbuild/rules_docker one
  should append '.tar' to the label to specify a self-contained image.

  Args:
    executor_spec: Where the binary should be launched. Instructs for which
      platform it should be packaged.
    label: The Bazel target to be built.
    bazel_args: Bazel command line arguments.
    args: Command line arguments to pass. This can be dict, list or
      xm.SequentialArgs. Dicts are most convenient for keyword flags.
      {'batch_size': 16} is passed as --batch_size=16. If positional arguments
      are needed one can use a list or xm.SequentialArgs.
    env_vars: Environment variables to be set.

  Returns:
    A packageable object which can be turned into an executable with
    Experiment.package or Experiment.package_async.
  """
  # pyformat: enable

  return job_blocks.Packageable(