dont set default vals for args handled by click

This commit is contained in:
seanbreckenridge 2021-04-05 16:25:21 -07:00
parent 188276eefd
commit 4af2b8e4df

View file

@ -3,7 +3,6 @@ import importlib
import os import os
import sys import sys
import traceback import traceback
from datetime import datetime
from typing import Optional, Sequence, Iterable, List, Type, Any from typing import Optional, Sequence, Iterable, List, Type, Any
from pathlib import Path from pathlib import Path
from subprocess import check_call, run, PIPE, CompletedProcess from subprocess import check_call, run, PIPE, CompletedProcess
@ -359,9 +358,7 @@ def query_hpi_functions(
res = list(select_range( res = list(select_range(
input_src, input_src,
where=None,
order_key=order_key, order_key=order_key,
order_value=None,
order_by_value_type=order_by_value_type, order_by_value_type=order_by_value_type,
unparsed_range=RangeTuple(after=after, before=before, within=within), unparsed_range=RangeTuple(after=after, before=before, within=within),
reverse=reverse, reverse=reverse,
@ -509,8 +506,8 @@ def module_install_cmd(user: bool, module: str) -> None:
help='order by an object attribute or dict key on the individual objects returned by the HPI function') help='order by an object attribute or dict key on the individual objects returned by the HPI function')
@click.option('-t', @click.option('-t',
'--order-type', '--order-type',
default='none', default=None,
type=click.Choice(['datetime', 'int', 'float', 'none']), type=click.Choice(['datetime', 'int', 'float']),
help='order by searching for some type on the iterable') help='order by searching for some type on the iterable')
@click.option('--after', @click.option('--after',
default=None, default=None,
@ -555,18 +552,18 @@ def module_install_cmd(user: bool, module: str) -> None:
def query_cmd( def query_cmd(
function_name: Sequence[str], function_name: Sequence[str],
output: str, output: str,
order_key: Optional[str] = None, order_key: Optional[str],
order_type: Optional[str] = None, order_type: Optional[str],
after: Optional[str] = None, after: Optional[str],
before: Optional[str] = None, before: Optional[str],
within: Optional[str] = None, within: Optional[str],
recent: Optional[str] = None, recent: Optional[str],
reverse: bool = False, reverse: bool,
limit: Optional[int] = None, limit: Optional[int],
drop_unsorted: bool = False, drop_unsorted: bool,
wrap_unsorted: bool = False, wrap_unsorted: bool,
raise_exceptions: bool = False, raise_exceptions: bool,
drop_exceptions: bool = False, drop_exceptions: bool,
) -> None: ) -> None:
''' '''
This allows you to query the results from one or more functions in HPI This allows you to query the results from one or more functions in HPI
@ -595,6 +592,8 @@ def query_cmd(
hpi query --order-type datetime --after '2016-01-01 00:00:00' --before '2019-01-01 00:00:00' my.reddit.comments hpi query --order-type datetime --after '2016-01-01 00:00:00' --before '2019-01-01 00:00:00' my.reddit.comments
''' '''
from datetime import datetime
chosen_order_type: Optional[Type] chosen_order_type: Optional[Type]
if order_type == "datetime": if order_type == "datetime":
chosen_order_type = datetime chosen_order_type = datetime