Skip to content

Commit

Permalink
Merge dd620ed into a14fb43
Browse files Browse the repository at this point in the history
  • Loading branch information
ncilfone committed May 16, 2022
2 parents a14fb43 + dd620ed commit 346355c
Show file tree
Hide file tree
Showing 16 changed files with 938 additions and 86 deletions.
2 changes: 2 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ FMR LLC (https://www.fidelity.com/).

This product relies on the following works (and the dependencies thereof), installed separately:
- attrs | https://github.com/python-attrs/attrs | MIT License
- cryptography | https://github.com/pyca/cryptography | Apache License 2.0 + BSD License
- GitPython | https://github.com/gitpython-developers/GitPython | BSD 3-Clause License
- pytomlpp | https://github.com/bobfang1992/pytomlpp | MIT License
- PyYAML | https://github.com/yaml/pyyaml | MIT License
- setuptools | https://github.com/pypa/setuptools | MIT License


Optional extensions rely on the following works (and the dependencies thereof), installed separately:
Expand Down
2 changes: 2 additions & 0 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
attrs~=21.4
cryptography~=37.0
GitPython~=3.1
pytomlpp~=1.0
pyYAML~=5.4
setuptools~=59.6
6 changes: 4 additions & 2 deletions spock/addons/tune/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

"""Handles the tuner payload backend"""

from typing import Optional

from spock.backend.payload import BasePayload
from spock.backend.utils import get_attr_fields
from spock.backend.utils import _T, get_attr_fields


class TunerPayload(BasePayload):
Expand All @@ -20,7 +22,7 @@ class TunerPayload(BasePayload):
"""

def __init__(self, s3_config=None):
def __init__(self, s3_config: Optional[_T] = None):
"""Init for TunerPayload
Args:
Expand Down
20 changes: 17 additions & 3 deletions spock/backend/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import argparse
from abc import ABC, abstractmethod
from enum import EnumMeta
from typing import Dict, List
from typing import ByteString, Dict, List

import attr

Expand All @@ -34,22 +34,36 @@ class BaseBuilder(ABC): # pylint: disable=too-few-public-methods
_module_name: module name to register in the spock module space
save_path: list of path(s) to save the configs to
_lazy: attempts to lazily find @spock decorated classes registered within sys.modules["spock"].backend.config
_salt: salt use for crypto purposes
_key: key used for crypto purposes
"""

def __init__(
self, *args, max_indent: int = 4, module_name: str, lazy: bool, **kwargs
self,
*args,
max_indent: int = 4,
module_name: str,
lazy: bool,
salt: str,
key: ByteString,
**kwargs,
):
"""Init call for BaseBuilder
Args:
*args: iterable of @spock decorated classes
max_indent: max indent for pretty print of help
module_name: module name to register in the spock module space
lazy: lazily find @spock decorated classes
salt: cryptographic salt
key: cryptographic key
**kwargs: keyword args
"""
self._input_classes = args
self._lazy = lazy
self._salt = salt
self._key = key
self._graph = Graph(input_classes=self.input_classes, lazy=self._lazy)
# Make sure the input classes are updated -- lazy evaluation
self._input_classes = self._graph.nodes
Expand Down Expand Up @@ -144,7 +158,7 @@ def resolve_spock_space_kwargs(self, graph: Graph, dict_args: Dict) -> Dict:
for spock_cls in graph.roots:
# Initial call to the RegisterSpockCls generate function (which will handle recursing if needed)
spock_instance, special_keys = RegisterSpockCls.recurse_generate(
spock_cls, builder_space
spock_cls, builder_space, self._salt, self._key
)
builder_space.spock_space[spock_cls.__name__] = spock_instance

Expand Down

0 comments on commit 346355c

Please sign in to comment.