Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 76c1760

Browse files
committed
configloader: Move from config/ to configloader/
Signed-off-by: John Andersen <[email protected]>
1 parent feb1eed commit 76c1760

File tree

32 files changed

+72
-24
lines changed

32 files changed

+72
-24
lines changed

.github/workflows/testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
fail-fast: false
4242
max-parallel: 40
4343
matrix:
44-
plugin: [., examples/shouldi, model/tensorflow, model/tensorflow_hub, model/scratch, model/scikit, source/mysql, feature/git, feature/auth, service/http, config/yaml]
44+
plugin: [., examples/shouldi, model/tensorflow, model/tensorflow_hub, model/scratch, model/scikit, source/mysql, feature/git, feature/auth, service/http, configloader/yaml]
4545
python-version: [3.7]
4646

4747
steps:
@@ -85,7 +85,7 @@ jobs:
8585
feature/git=${{ secrets.PYPI_FEATURE_GIT }}
8686
feature/auth=${{ secrets.PYPI_FEATURE_AUTH }}
8787
service/http=${{ secrets.PYPI_SERVICE_HTTP }}
88-
config/yaml=${{ secrets.PYPI_CONFIG_YAML }}
88+
configloader/yaml=${{ secrets.PYPI_CONFIG_YAML }}
8989
EOF
9090
export TWINE_USERNAME=__token__
9191
if [ "x${PLUGIN}" = "x." ]; then

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
existing repo with `git clean` for development service release command.
2626
- Simplified SLR tests for scratch model
2727
- Test tensorflow DNNClassifier documentation exaples in CI
28+
- config directories and files associated with ConfigLoaders have been renamed
29+
to configloader.
2830

2931
## [0.3.4] - 2020-02-28
3032
### Added
File renamed without changes.
File renamed without changes.

config/yaml/dffml_config_yaml/config.py renamed to configloader/yaml/dffml_config_yaml/config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
from dffml.util.entrypoint import entrypoint
88
from dffml.util.cli.arg import Arg
99
from dffml.base import BaseConfig
10-
from dffml.config.config import BaseConfigLoaderContext, BaseConfigLoader
10+
from dffml.configloader.configloader import (
11+
BaseConfigLoaderContext,
12+
BaseConfigLoader,
13+
)
1114

1215

1316
class YamlConfigLoaderContext(BaseConfigLoaderContext):
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Description of what this config does
3+
"""
4+
import yaml
5+
from typing import Dict
6+
7+
from dffml.util.entrypoint import entrypoint
8+
from dffml.util.cli.arg import Arg
9+
from dffml.base import BaseConfig
10+
from dffml.configloader.configloader import (
11+
BaseConfigLoaderContext,
12+
BaseConfigLoader,
13+
)
14+
15+
16+
class YamlConfigLoaderContext(BaseConfigLoaderContext):
17+
async def loadb(self, resource: bytes) -> Dict:
18+
return yaml.safe_load(resource.decode())
19+
20+
async def dumpb(self, resource: Dict) -> bytes:
21+
return yaml.dump(resource, default_flow_style=False).encode()
22+
23+
24+
@entrypoint("yaml")
25+
class YamlConfigLoader(BaseConfigLoader):
26+
CONTEXT = YamlConfigLoaderContext
27+
28+
@classmethod
29+
def args(cls, args, *above) -> Dict[str, Arg]:
30+
return args
31+
32+
@classmethod
33+
def config(cls, config, *above) -> BaseConfig:
34+
return BaseConfig()

0 commit comments

Comments
 (0)