Rename base WIG/UIG classes
This commit is contained in:
parent
81dbadb8ae
commit
8307ebf86c
@ -42,11 +42,11 @@ onmessage = function(evt) {
|
|||||||
// Create counter
|
// Create counter
|
||||||
let counter;
|
let counter;
|
||||||
if (evt.data.transfers === 'uig') {
|
if (evt.data.transfers === 'uig') {
|
||||||
counter = py.pyRCV2.method.base_stv.BaseUIGSTVCounter(election, evt.data.options);
|
counter = py.pyRCV2.method.base_stv.UIGSTVCounter(election, evt.data.options);
|
||||||
} else if (evt.data.transfers === 'wright') {
|
} else if (evt.data.transfers === 'wright') {
|
||||||
counter = py.pyRCV2.method.wright.WrightSTVCounter(election, evt.data.options);
|
counter = py.pyRCV2.method.wright.WrightSTVCounter(election, evt.data.options);
|
||||||
} else {
|
} else {
|
||||||
counter = py.pyRCV2.method.base_stv.BaseWIGSTVCounter(election, evt.data.options);
|
counter = py.pyRCV2.method.base_stv.WIGSTVCounter(election, evt.data.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.data.options['ties'] === 'backwards_random') {
|
if (evt.data.options['ties'] === 'backwards_random') {
|
||||||
|
@ -18,7 +18,7 @@ import pyRCV2.blt
|
|||||||
import pyRCV2.model
|
import pyRCV2.model
|
||||||
import pyRCV2.numbers
|
import pyRCV2.numbers
|
||||||
|
|
||||||
from pyRCV2.method.base_stv import BaseUIGSTVCounter, BaseWIGSTVCounter
|
from pyRCV2.method.base_stv import UIGSTVCounter, WIGSTVCounter
|
||||||
from pyRCV2.method.wright import WrightSTVCounter
|
from pyRCV2.method.wright import WrightSTVCounter
|
||||||
from pyRCV2.ties import TiesBackwards, TiesPrompt, TiesRandom
|
from pyRCV2.ties import TiesBackwards, TiesPrompt, TiesRandom
|
||||||
|
|
||||||
@ -80,11 +80,11 @@ def main(args):
|
|||||||
|
|
||||||
# Create counter
|
# Create counter
|
||||||
if args.method == 'uig':
|
if args.method == 'uig':
|
||||||
counter = BaseUIGSTVCounter(election, vars(args))
|
counter = UIGSTVCounter(election, vars(args))
|
||||||
elif args.method == 'wright':
|
elif args.method == 'wright':
|
||||||
counter = WrightSTVCounter(election, vars(args))
|
counter = WrightSTVCounter(election, vars(args))
|
||||||
else:
|
else:
|
||||||
counter = BaseWIGSTVCounter(election, vars(args))
|
counter = WIGSTVCounter(election, vars(args))
|
||||||
|
|
||||||
if args.ties is None:
|
if args.ties is None:
|
||||||
args.ties = ['backwards', 'random']
|
args.ties = ['backwards', 'random']
|
||||||
|
@ -425,7 +425,7 @@ class BaseSTVCounter:
|
|||||||
|
|
||||||
raise Exception('Unable to resolve tie')
|
raise Exception('Unable to resolve tie')
|
||||||
|
|
||||||
class BaseWIGSTVCounter(BaseSTVCounter):
|
class WIGSTVCounter(BaseSTVCounter):
|
||||||
"""
|
"""
|
||||||
Basic weighted inclusive Gregory STV counter
|
Basic weighted inclusive Gregory STV counter
|
||||||
"""
|
"""
|
||||||
@ -458,7 +458,7 @@ class BaseWIGSTVCounter(BaseSTVCounter):
|
|||||||
self.exhausted.ballots.append((ballot, ballot_value))
|
self.exhausted.ballots.append((ballot, ballot_value))
|
||||||
__pragma__('noopov')
|
__pragma__('noopov')
|
||||||
|
|
||||||
class BaseUIGSTVCounter(BaseSTVCounter):
|
class UIGSTVCounter(BaseSTVCounter):
|
||||||
"""
|
"""
|
||||||
Basic unweighted inclusive Gregory STV counter
|
Basic unweighted inclusive Gregory STV counter
|
||||||
"""
|
"""
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyRCV2.method.base_stv import BaseWIGSTVCounter
|
from pyRCV2.method.base_stv import WIGSTVCounter
|
||||||
from pyRCV2.model import CandidateState, CountCard
|
from pyRCV2.model import CandidateState, CountCard
|
||||||
from pyRCV2.safedict import SafeDict
|
from pyRCV2.safedict import SafeDict
|
||||||
|
|
||||||
class WrightSTVCounter(BaseWIGSTVCounter):
|
class WrightSTVCounter(WIGSTVCounter):
|
||||||
"""
|
"""
|
||||||
Wright STV implementation
|
Wright STV implementation
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user