Skip to content

Commit

Permalink
moved get_input to source module
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollman committed Jan 3, 2018
1 parent e4217a7 commit 453d5d2
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions argschema/argschema_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import marshmallow as mm
from .sources.json_source import JsonSource, JsonSink
from .sources.yaml_source import YamlSource, YamlSink
from .sources.source import NotConfiguredSourceError, MultipleConfiguredSourceError
from .sources.source import NotConfiguredSourceError, MultipleConfiguredSourceError, get_input_from_config


def contains_non_default_schemas(schema, schema_list=[]):
Expand Down Expand Up @@ -108,17 +108,6 @@ def fill_defaults(schema, args):
d[path[-1]] = val
return args


def get_input(Source, config_d):
if config_d is not None:
input_config_d = Source.get_config(Source.ConfigSchema, config_d)
input_source = Source(**input_config_d)
input_data = input_source.get_dict()
return input_data
else:
raise NotConfiguredSourceError('No dictionary provided')


class ArgSchemaParser(object):
"""The main class you should sub-class to write your own argschema module.
Takes input_data, reference to a input_json and the command line inputs and parses out the parameters
Expand Down Expand Up @@ -278,7 +267,7 @@ def __get_input_data_from_config(self, d):
input_data = None
for InputSource in self.default_configurable_sources:
try:
input_data = get_input(InputSource, d)
input_data = get_input_from_config(InputSource, d)
if input_set:
raise MultipleConfiguredSourceError(
"more then one InputSource configuration present in {}".format(d))
Expand Down

0 comments on commit 453d5d2

Please sign in to comment.