Exemplo n.º 1
0
def usage(subject=None):
    "usage and help"

    helps = Election.makehelp()
    helpers = sorted(helps.keys())

    u = '\n%s v%s\n' % (droop.common.droopName, droop.common.droopVersion)
    u += '\nUsage:\n'
    u += '%s options ballotfile\n' % me
    u += '  options:\n'
    u += '    rule name (%s)\n' % ','.join(droop.electionRuleNames())
    u += '    arithmetic class name (%s)\n' % ','.join(
        droop.values.arithmeticNames)
    u += '    profile=reps, to profile the count, running reps repetitions\n'
    u += '    dump, to dump a csv of the election actions\n'
    u += '    rule- or arithmetic-specific options:\n'
    u += '      precision=n: decimal digits of precision (fixed, guarded)\n'
    u += '      guard=n: guard digits (guarded; default to guard=precision)\n'
    u += '      dp=n: display precision (rational)\n'
    u += '      omega=n: meek iteration terminates when surplus < 1/10^omega\n'
    u += '\n'
    u += '  help is available on the following subjects:\n'
    u += '    %s' % ' '.join(helpers)
    helps['usage'] = u

    if not subject:
        return u
    if subject in helps:
        return '\n%s' % helps[subject]
    return 'no help available on %s' % subject
Exemplo n.º 2
0
def usage(subject=None):
    "usage and help"
    
    helps = Election.makehelp()
    helpers = sorted(helps.keys())

    u =  '\n%s v%s\n' % (droop.common.droopName, droop.common.droopVersion)
    u += '\nUsage:\n'
    u += '%s options ballotfile\n' % me
    u += '  options:\n'
    u += '    rule name (%s)\n' % ','.join(droop.electionRuleNames())
    u += '    arithmetic class name (%s)\n' % ','.join(droop.values.arithmeticNames)
    u += '    profile=reps, to profile the count, running reps repetitions\n'
    u += '    dump, to dump a csv of the election actions\n'
    u += '    rule- or arithmetic-specific options:\n'
    u += '      precision=n: decimal digits of precision (fixed, guarded)\n'
    u += '      guard=n: guard digits (guarded; default to guard=precision)\n'
    u += '      dp=n: display precision (rational)\n'
    u += '      omega=n: meek iteration terminates when surplus < 1/10^omega\n'
    u += '\n'
    u += '  help is available on the following subjects:\n'
    u += '    %s' % ' '.join(helpers)
    helps['usage'] = u

    if not subject:
        return u
    if subject in helps:
        return '\n%s' % helps[subject]
    return 'no help available on %s' % subject
Exemplo n.º 3
0
 def testElectionHelps(self):
     "test helps"
     helps = Election.makehelp()
     self.assertTrue(isinstance(helps['rule'], str))
     self.assertTrue(isinstance(helps['arithmetic'], str))
Exemplo n.º 4
0
 def testElectionHelps(self):
     "test helps"
     helps = Election.makehelp()
     self.assertTrue(isinstance(helps['rule'], str))
     self.assertTrue(isinstance(helps['arithmetic'], str))