generated from datalad/datalad-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e59457
commit 0f3f987
Showing
13 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from .defaults import ImplementationDefaults as ImplementationDefaults, get_defaults as get_defaults | ||
from .git import DataladBranchConfig as DataladBranchConfig, GitConfig as GitConfig, GlobalGitConfig as GlobalGitConfig, LocalGitConfig as LocalGitConfig, SystemGitConfig as SystemGitConfig, WorktreeGitConfig as WorktreeGitConfig | ||
from .gitenv import GitEnvironment as GitEnvironment | ||
from .item import ConfigItem as ConfigItem | ||
from .manager import ConfigManager as ConfigManager, get_manager as get_manager | ||
from datasalad.settings import UnsetValue as UnsetValue | ||
|
||
__all__ = ['ConfigItem', 'ConfigManager', 'GitConfig', 'SystemGitConfig', 'GlobalGitConfig', 'LocalGitConfig', 'DataladBranchConfig', 'WorktreeGitConfig', 'GitEnvironment', 'ImplementationDefaults', 'UnsetValue', 'get_defaults', 'get_manager'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from datasalad.settings import Defaults | ||
|
||
class ImplementationDefaults(Defaults): ... | ||
|
||
def get_defaults() -> ImplementationDefaults: ... | ||
def register_defaults_gitcfg(defaults: ImplementationDefaults) -> None: ... | ||
def anything2bool(val): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import abc | ||
from _typeshed import Incomplete | ||
from collections.abc import Hashable | ||
from datalad_core.config.item import ConfigItem as ConfigItem | ||
from datalad_core.consts import DATALAD_BRANCH_CONFIG_RELPATH as DATALAD_BRANCH_CONFIG_RELPATH | ||
from datalad_core.runners import CommandError as CommandError, call_git as call_git, call_git_oneline as call_git_oneline, iter_git_subproc as iter_git_subproc | ||
from datasalad.settings import CachingSource, Setting as Setting | ||
from os import PathLike | ||
|
||
lgr: Incomplete | ||
|
||
class GitConfig(CachingSource, metaclass=abc.ABCMeta): | ||
def __init__(self) -> None: ... | ||
def __contains__(self, key: Hashable) -> bool: ... | ||
|
||
class SystemGitConfig(GitConfig): ... | ||
class GlobalGitConfig(GitConfig): ... | ||
|
||
class LocalGitConfig(GitConfig): | ||
def __init__(self, path: PathLike) -> None: ... | ||
|
||
class WorktreeGitConfig(GitConfig): | ||
def __init__(self, path: PathLike) -> None: ... | ||
|
||
class DataladBranchConfig(LocalGitConfig): | ||
def __init__(self, path: PathLike) -> None: ... | ||
@property | ||
def is_writable(self): ... | ||
|
||
cfg_k_regex: Incomplete | ||
cfg_kv_regex: Incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from collections.abc import Generator, Hashable | ||
from datalad_core.config.item import ConfigItem as ConfigItem | ||
from datalad_core.config.utils import get_gitconfig_items_from_env as get_gitconfig_items_from_env, set_gitconfig_items_in_env as set_gitconfig_items_in_env | ||
from datasalad.settings import Setting as Setting, WritableMultivalueSource | ||
|
||
class GitEnvironment(WritableMultivalueSource): | ||
item_type = ConfigItem | ||
def overrides(self, overrides: dict[Hashable, Setting | tuple[Setting, ...]]) -> Generator[None]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from datasalad.settings import Setting | ||
|
||
class ConfigItem(Setting): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from collections.abc import Generator, Hashable | ||
from datalad_core.config.defaults import ImplementationDefaults as ImplementationDefaults, get_defaults as get_defaults | ||
from datalad_core.config.git import GlobalGitConfig as GlobalGitConfig, SystemGitConfig as SystemGitConfig | ||
from datalad_core.config.gitenv import GitEnvironment as GitEnvironment | ||
from datalad_core.config.item import ConfigItem as ConfigItem | ||
from datasalad.settings import Setting as Setting, Settings, Source as Source | ||
from typing import Any | ||
|
||
class ConfigManager(Settings): | ||
def __init__(self, defaults: ImplementationDefaults, sources: dict[str, Source] | None = None) -> None: ... | ||
def overrides(self, overrides: dict[Hashable, Setting | tuple[Setting, ...]]) -> Generator[ConfigManager]: ... | ||
def get(self, key: Hashable, default: Any = None) -> Setting: ... | ||
def get_from_protected_sources(self, key: Hashable, default: Any = None) -> Setting: ... | ||
def declare_source_protected(self, key: str): ... | ||
|
||
def get_manager() -> ConfigManager: ... |
Empty file.
4 changes: 4 additions & 0 deletions
4
resources/type_stubs/datalad_core/config/tests/test_defaults.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from ..defaults import anything2bool as anything2bool, get_defaults as get_defaults | ||
|
||
def test_implementationdefaults() -> None: ... | ||
def test_anything2bool() -> None: ... |
12 changes: 12 additions & 0 deletions
12
resources/type_stubs/datalad_core/config/tests/test_git.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from ..git import DataladBranchConfig as DataladBranchConfig, GlobalGitConfig as GlobalGitConfig, LocalGitConfig as LocalGitConfig | ||
from ..item import ConfigItem as ConfigItem | ||
from datalad_core.consts import DATALAD_BRANCH_CONFIG_RELPATH as DATALAD_BRANCH_CONFIG_RELPATH | ||
from datalad_core.runners import call_git_oneline as call_git_oneline | ||
|
||
def test_global_git_config() -> None: ... | ||
def test_global_git_config_pure(cfgman) -> None: ... | ||
def test_local_git_config_norepo(tmp_path) -> None: ... | ||
def test_local_git_config(gitrepo) -> None: ... | ||
def test_datalad_branch_config(gitrepo) -> None: ... | ||
def test_datalad_branch_shorthand(gitrepo) -> None: ... | ||
def test_gitcfg_rec_to_keyvalue() -> None: ... |
5 changes: 5 additions & 0 deletions
5
resources/type_stubs/datalad_core/config/tests/test_gitenv.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from ..gitenv import GitEnvironment as GitEnvironment | ||
from datalad_core.runners import call_git_lines as call_git_lines, call_git_oneline as call_git_oneline | ||
|
||
def test_gitenv_singlevalue() -> None: ... | ||
def test_gitenv_multivalue() -> None: ... |
9 changes: 9 additions & 0 deletions
9
resources/type_stubs/datalad_core/config/tests/test_manager.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from datalad_core.config import ConfigItem as ConfigItem, UnsetValue as UnsetValue, get_manager as get_manager | ||
from datalad_core.repo import Repo as Repo, Worktree as Worktree | ||
from datalad_core.tests.fixtures import magic_marker as magic_marker | ||
|
||
def test_manager_setup() -> None: ... | ||
def test_manager_overrides() -> None: ... | ||
def test_manager_fordataset(gitrepo) -> None: ... | ||
def test_manager_forbaredataset(baregitrepo) -> None: ... | ||
def test_manager_protected_query(gitrepo) -> None: ... |
6 changes: 6 additions & 0 deletions
6
resources/type_stubs/datalad_core/config/tests/test_utils.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .. import utils as utils | ||
from ..utils import get_gitconfig_items_from_env as get_gitconfig_items_from_env, set_gitconfig_items_in_env as set_gitconfig_items_in_env | ||
|
||
def test_get_gitconfig_items_from_env(monkeypatch) -> None: ... | ||
def test_set_gitconfig_items_in_env(monkeypatch) -> None: ... | ||
def test_get_set_gitconfig_env_roundtrip(monkeypatch) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from collections.abc import Mapping | ||
|
||
def get_gitconfig_items_from_env() -> dict[str, str | tuple[str, ...]]: ... | ||
def set_gitconfig_items_in_env(items: Mapping[str, str | tuple[str, ...]]): ... |