Exemple #1
0
 def test_is_range(self):
     self.assertTrue(Range.is_range(''))
     self.assertTrue(Range.is_range('10'))
     self.assertTrue(Range.is_range('10,12'))
     self.assertFalse(Range.is_range('10,12,fred'))
     self.assertTrue(Range.is_range('10,12,fred', 'fred'))
Exemple #2
0
    action='store_true',
    help='If true, don\'t ask for confirmation on large commands.',
)

# Read the arguments from the command line.
ARGS = _parser.parse_args()
ARGS.NONE = NONE

Log.VERBOSE = ARGS.verbose

# Now remove any items that look like ledger numbers from the command line.
_command = ARGS.command
_parts = (ARGS.command, ARGS.ledgers) = ([], [])

for c in _command:
    _parts[Range.is_range(c, *LedgerNumber.LEDGERS)].append(c)

ARGS.command = ARGS.command or ['print' if ARGS.ledgers else 'info']

ARGS.cache = File.normalize(ARGS.cache)

if not ARGS.ledgers:
    if ARGS.condition:
        Log.warn('--condition needs a range of ledgers')
    if ARGS.display:
        Log.warn('--display needs a range of ledgers')

ARGS.condition = Function(ARGS.condition or 'all_ledgers',
                          'ripple.ledger.conditions')
ARGS.display = Function(ARGS.display or 'ledger_number',
                        'ripple.ledger.displays')
Exemple #3
0
 def test_is_range(self):
     self.assertTrue(Range.is_range(''))
     self.assertTrue(Range.is_range('10'))
     self.assertTrue(Range.is_range('10,12'))
     self.assertFalse(Range.is_range('10,12,fred'))
     self.assertTrue(Range.is_range('10,12,fred', 'fred'))
Exemple #4
0
    action='store_true',
    help='If true, don\'t ask for confirmation on large commands.',
)

# Read the arguments from the command line.
ARGS = _parser.parse_args()
ARGS.NONE = NONE

Log.VERBOSE = ARGS.verbose

# Now remove any items that look like ledger numbers from the command line.
_command = ARGS.command
_parts = (ARGS.command, ARGS.ledgers) = ([], [])

for c in _command:
    _parts[Range.is_range(c, *LedgerNumber.LEDGERS)].append(c)

ARGS.command = ARGS.command or ['print' if ARGS.ledgers else 'info']

ARGS.cache = File.normalize(ARGS.cache)

if not ARGS.ledgers:
    if ARGS.condition:
        Log.warn('--condition needs a range of ledgers')
    if ARGS.display:
        Log.warn('--display needs a range of ledgers')

ARGS.condition = Function(
    ARGS.condition or 'all_ledgers', 'ripple.ledger.conditions')
ARGS.display = Function(
    ARGS.display or 'ledger_number', 'ripple.ledger.displays')