Пример #1
0
def test_various():
    a = 'a'
    args = argparse.Namespace(a='def_test', unittesting='')
    x = cm_utils.query_default(a, args)
    assert x == 'def_test'
    args = argparse.Namespace(a='def_test', unittesting='none')
    x = cm_utils.query_default(a, args)
    assert x is None
    args = argparse.Namespace(a='def_test', unittesting='false')
    x = cm_utils.query_default(a, args)
    assert not x
    args = argparse.Namespace(a='def_test', unittesting='true')
    x = cm_utils.query_default(a, args)
    assert x
    args = argparse.Namespace(a='def_test', unittesting='unittest')
    x = cm_utils.query_default(a, args)
    assert x == 'unittest'
    spk = cm_utils.make_part_key(None, None)
    assert spk == cm_utils.system_wide_key
    a, b, c = cm_utils.split_part_key('a:b:c')
    assert c == 'c'
    is_active = cm_utils.is_active(None, None, None)
    assert is_active
    t_tst = cm_utils.get_astropytime('now')
    out = cm_utils.get_stopdate(t_tst)
    assert out == t_tst
    d = cm_utils.get_time_for_display(None)
    assert d == 'None'
    c = cm_utils.put_keys_in_order(['1:A:Z', '2:B:X'], 'RPN')
    assert c[0] == '1:A:Z'
Пример #2
0
def query_args(args):
    """
    Gets information from user
    """
    if args.hpn is None:
        args.hpn = input('HERA part number:  ')
    if args.syspn is None:
        args.syspn = input('System part number:  ')
    args.date = cm_utils.query_default('date', args)
    args.time = cm_utils.query_default('time', args)
    args.date2 = cm_utils.query_default('date2', args)
    args.time2 = cm_utils.query_default('time2', args)
    return args
Пример #3
0
def query_args(args):
    """
    Gets information from user
    """
    if args.hpn is None:
        args.hpn = input('HERA part number:  ')
    args.rev = cm_utils.query_default('rev', args)
    if args.comment is None:
        args.comment = input('Comment:  ')
    if args.reference is None:
        args.reference = input('reference:  ')
    args.date = cm_utils.query_default('date', args)
    return args
Пример #4
0
def query_geo_information(args):
    """
    Gets geo_location information from user
    """
    if args.easting is None:
        args.easting = float(input('Easting:  '))
    if args.northing is None:
        args.northing = float(input('Northing:  '))
    if args.elevation is None:
        args.elevation = float(input('Elevation:  '))
    if args.sernum is None:
        args.sernum = input('Serial number:  ')
    args.datum = cm_utils.query_default('datum', args)
    args.tile = cm_utils.query_default('tile', args)
    if args.station_type_name is None:
        args.station_type_name = input('Station type name: ')
    args.date = cm_utils.query_default('date', args)
    return args
Пример #5
0
def query_args(args):
    """
    Gets information from user
    """
    if args.part is None:
        args.part = input("Part number:  ")
    if args.rev is None:
        args.rev = input("Revision:  ")
    if args.date == 'now':
        args.date = cm_utils.query_default('date', args)
    return args
Пример #6
0
def query_args(args):
    """
    Gets information from user
    """
    if args.hpn is None:
        args.hpn = input('HERA part number:  ')
    if args.rev is None:
        args.rev = input('HERA part revision:  ')
    if args.hptype is None:
        args.hptype = input('HERA part type:  ')
    if args.mfg is None:
        args.mfg = input('Manufacturers number for part:  ')
    args.date = cm_utils.query_default('date', args)
    return args
Пример #7
0
def query_args(args):
    """
    Gets information from user
    """
    if args.uppart is None:
        args.uppart = input('Upstream part number:  ')
    if args.uprev is None:
        args.uprev = input('Upstream part revision:  ')
    if args.upport is None:
        args.upport = input('Upstream output port:  ')
    if args.dnpart is None:
        args.dnpart = input('Downstream part number:  ')
    if args.dnrev is None:
        args.dnrev = input('Downstream part revision:  ')
    if args.dnport is None:
        args.dnport = input('Downstream input port:  ')
    if args.date == 'now':  # note that 'now' is the current default.
        args.date = cm_utils.query_default('date', args)
    return args
Пример #8
0
def query_args(args):
    """
    Gets information from user
    """
    if args.uppart is None:
        args.uppart = input("Upstream part number:  ")
    if args.uprev is None:
        args.uprev = input("Upstream part revision:  ")
    if args.upport is None:
        args.upport = input("Upstream output port:  ")
    if args.dnpart is None:
        args.dnpart = input("Downstream part number:  ")
    if args.dnrev is None:
        args.dnrev = input("Downstream part revision:  ")
    if args.dnport is None:
        args.dnport = input("Downstream input port:  ")
    if args.date == 'now':
        args.date = cm_utils.query_default('date', args)
    return args