constants
ruff_sync.constants ¶
Constants used across ruff-sync.
__all__
module-attribute
¶
__all__ = [
"DEFAULT_BRANCH",
"DEFAULT_EXCLUDE",
"DEFAULT_PATH",
"MISSING",
"MissingType",
"OutputFormat",
"resolve_defaults",
]
MissingType ¶
Bases: Enum
Used to represent a missing value sentinel.
This can be used to properly type fields that use the MissingType.SENTINEL as a default.
Example
from ruff_sync.constants import MissingType, MISSING def foo(bar: int | None | MissingType = MISSING) -> None: ... if bar is MissingType.SENTINEL: ... print("bar is missing") ... else: ... print(f"bar is {bar}")
Source code in src/ruff_sync/constants.py
OutputFormat ¶
Bases: str, Enum
Output formats for the CLI.
Source code in src/ruff_sync/constants.py
resolve_defaults ¶
Resolve MISSING sentinel values to their effective defaults.
This is the single source of truth for MISSING → default resolution across
both cli.main and core._merge_multiple_upstreams, keeping the two
layers in sync without introducing a circular dependency between them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch
|
str | MissingType
|
The resolved branch value or |
required |
path
|
str | MissingType
|
The resolved path value or |
required |
exclude
|
Iterable[str] | MissingType
|
The resolved exclude iterable or |
required |
Returns:
| Type | Description |
|---|---|
str
|
A |
str | None
|
|
Iterable[str]
|
it directly to :func: |
tuple[str, str | None, Iterable[str]]
|
func: |