def _parse_query_params(cls, query_params): ''' Valid query_params are defined by parameters(). However, a user can supply parameters not contained in this list. Therefore, invalid parameters are discarded and a params_dict is populated only with those parameters that are valid. Since format is a special required input parameter for every API function, it is parsed and returned separately. Note that each parameter parses its own arguments. This allows it to set a default when the parameter isn't included in the API call, as well as format the input appropriately (string, float, int, date, etc.). ''' params_dict = dict() _format = FORMATS.json # @UndefinedVariable parameters = cls.parameters() for parameter in parameters: # Path parameters are parsed in _handle_path_fields() if not parameter.is_path(): # query_params is a default_dict(list), so it returns an empty # list if this parameter was not provided - parse_args must # be called on every parameter to set its default value if one # exists. args = parameter.parse_args(query_params[parameter.alias.lower()]) if args: if parameter == ParameterFactory.format(): _format = args[0] else: params_dict[parameter] = args return (params_dict, _format)
def _parse_query_params(cls, query_params): ''' Valid query_params are defined by parameters(). However, a user can supply parameters not contained in this list. Therefore, invalid parameters are discarded and a params_dict is populated only with those parameters that are valid. Since format is a special required input parameter for every API function, it is parsed and returned separately. Note that each parameter parses its own arguments. This allows it to set a default when the parameter isn't included in the API call, as well as format the input appropriately (string, float, int, date, etc.). ''' params_dict = dict() _format = FORMATS.json # @UndefinedVariable parameters = cls.parameters() for parameter in parameters: # Path parameters are parsed in _handle_path_fields() if not parameter.is_path(): # query_params is a default_dict(list), so it returns an empty # list if this parameter was not provided - parse_args must # be called on every parameter to set its default value if one # exists. args = parameter.parse_args( query_params[parameter.alias.lower()]) if args: if parameter == ParameterFactory.format(): _format = args[0] else: params_dict[parameter] = args return (params_dict, _format)
def parameters(cls): parameters = [ ParameterFactory.format(), ParameterFactory.sequence_names(required=True), ParameterFactory.sequences(required=True), ] return parameters
def parameters(cls): parameters = [ ParameterFactory.format(), ParameterFactory.probes(required=True), ParameterFactory.boolean("absorb", "Check for absorbed probes."), ParameterFactory.integer("num", "Minimum number of probes for a target.", default=3, minimum=1), ] return parameters
def parameters(cls): parameters = [ ParameterFactory.format(), ParameterFactory.snpsearch_name(required=True), ParameterFactory.chromosome_num(required=True), ParameterFactory.chromosome_start(required=True), ParameterFactory.chromosome_stop(required=True), ] return parameters
def parameters(cls): parameters = [ ParameterFactory.format(), ] return parameters