Download pool/shard008/Python/0071397_platform.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard008/Python/0071397_platform.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard008/Python/0071397_platform.py
-
curl -L -o 0071397_platform.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard008/Python/0071397_platform.py
1.14 kB
| # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). | |
| # Licensed under the Apache License, Version 2.0 (see LICENSE). | |
| from enum import Enum | |
| from typing import Callable, List | |
| from pants.engine.rules import rule | |
| from pants.util.memo import memoized_classproperty | |
| from pants.util.osutil import get_normalized_os_name | |
| class Platform(Enum): | |
| darwin = "darwin" | |
| linux = "linux" | |
| # TODO: try to turn all of these accesses into v2 dependency injections! | |
| def current(cls) -> "Platform": | |
| return Platform(get_normalized_os_name()) | |
| class PlatformConstraint(Enum): | |
| darwin = "darwin" | |
| linux = "linux" | |
| none = "none" | |
| def local_platform(cls) -> "PlatformConstraint": | |
| return PlatformConstraint(Platform.current.value) | |
| # TODO We will want to allow users to specify the execution platform for rules, | |
| # which means replacing this singleton rule with a RootRule populated by an option. | |
| def materialize_platform() -> Platform: | |
| return Platform.current | |
| def create_platform_rules() -> List[Callable]: | |
| return [materialize_platform] | |