Repository: microsoft/electionguard-python

Issue:
types.py module has naming conflict creating a "MappingProxyType"
## ImportError: cannot import name 'MappingProxyType' from 'types' 

**This error is returned when running the command  `python election.py` or `python manifest.py`**

The error is probably due to python not recognizing the `types.py` file in the directory `electionguard-python-main/src/electionguard` where the rest of the files are also present e.g. `election.py` and `manifest.py`


Discussion:
soham4abc: @keithrfung  please do review!

Patch:
diff --git a/src/electionguard/auxiliary.py b/src/electionguard/auxiliary.py
index f39ecab..b39cec5 100644
--- a/src/electionguard/auxiliary.py
+++ b/src/electionguard/auxiliary.py
@@ -1,6 +1,6 @@
 from typing import Callable, Optional, NamedTuple
 
-from .types import GUARDIAN_ID
+from .type import GUARDIAN_ID
 
 MESSAGE = str
 AUXILIARY_PUBLIC_KEY = str
diff --git a/src/electionguard/ballot_box.py b/src/electionguard/ballot_box.py
index 95de086..a74b545 100644
--- a/src/electionguard/ballot_box.py
+++ b/src/electionguard/ballot_box.py
@@ -12,7 +12,7 @@ from .data_store import DataStore
 from .election import CiphertextElectionContext
 from .logs import log_warning
 from .manifest import InternalManifest
-from .types import BALLOT_ID
+from .type import BALLOT_ID
 
 
 @dataclass
diff --git a/src/electionguard/decrypt_with_shares.py b/src/electionguard/decrypt_with_shares.py
index eb2b806..adfb779 100644
--- a/src/electionguard/decrypt_with_shares.py
+++ b/src/electionguard/decrypt_with_shares.py
@@ -15,7 +15,7 @@ from .tally import (
     PlaintextTallySelection,
 )
 from .logs import log_warning
-from .types import CONTEST_ID, GUARDIAN_ID, SELECTION_ID
+from .type import CONTEST_ID, GUARDIAN_ID, SELECTION_ID
 
 AVAILABLE_GUARDIAN_ID = GUARDIAN_ID
 MISSING_GUARDIAN_ID = GUARDIAN_ID
diff --git a/src/electionguard/decryption.py b/src/electionguard/decryption.py
index b8e64be..87d1bcc 100644
--- a/src/electionguard/decryption.py
+++ b/src/electionguard/decryption.py
@@ -37,7 +37,7 @@ from .rsa import rsa_decrypt
 from .scheduler import Scheduler
 from .tally import CiphertextTally
 
-from .types import CONTEST_ID, GUARDIAN_ID, SELECTION_ID
+from .type import CONTEST_ID, GUARDIAN_ID, SELECTION_ID
 
 GUARDIAN_PUBLIC_KEY = ElementModP
 ELECTION_PUBLIC_KEY = ElementModP
diff --git a/src/electionguard/decryption_mediator.py b/src/electionguard/decryption_mediator.py
index d90cb4c..a5b73e6 100644
--- a/src/electionguard/decryption_mediator.py
+++ b/src/electionguard/decryption_mediator.py
@@ -16,7 +16,7 @@ from .tally import (
     CiphertextTally,
     PlaintextTally,
 )
-from .types import BALLOT_ID, GUARDIAN_ID, MEDIATOR_ID
+from .type import BALLOT_ID, GUARDIAN_ID, MEDIATOR_ID
 
 
 class DecryptionMediator:
diff --git a/src/electionguard/decryption_share.py b/src/electionguard/decryption_share.py
index 55831d3..69cacc4 100644
--- a/src/electionguard/decryption_share.py
+++ b/src/electionguard/decryption_share.py
@@ -9,7 +9,7 @@ from .group import ElementModP, ElementModQ
 
 from .logs import log_warning
 
-from .types import CONTEST_ID, GUARDIAN_ID, SELECTION_ID
+from .type import CONTEST_ID, GUARDIAN_ID, SELECTION_ID
 
 ELECTION_PUBLIC_KEY = ElementModP
 
diff --git a/src/electionguard/guardian.py b/src/electionguard/guardian.py
index 4ab01ad..e1fc78f 100644
--- a/src/electionguard/guardian.py
+++ b/src/electionguard/guardian.py
@@ -43,7 +43,7 @@ from .rsa import rsa_encrypt, rsa_decrypt
 from .serializable import Serializable
 from .schnorr import SchnorrProof
 from .tally import CiphertextTally
-from .types import BALLOT_ID, GUARDIAN_ID
+from .type import BALLOT_ID, GUARDIAN_ID
 
 
 @dataclass
diff --git a/src/electionguard/key_ceremony.py b/src/electionguard/key_ceremony.py
index 9583ea6..ea35d0c 100644
--- a/src/electionguard/key_ceremony.py
+++ b/src/electionguard/key_ceremony.py
@@ -22,7 +22,7 @@ from .group import hex_to_q, ElementModP, ElementModQ
 from .hash import hash_elems
 from .rsa import rsa_keypair, rsa_decrypt, rsa_encrypt
 from .schnorr import SchnorrProof
-from .types import GUARDIAN_ID
+from .type import GUARDIAN_ID
 from .utils import get_optional
 
 ELECTION_PUBLIC_KEY = ElementModP
diff --git a/src/electionguard/key_ceremony_mediator.py b/src/electionguard/key_ceremony_mediator.py
index 342dd1b..49765b0 100644
--- a/src/electionguard/key_ceremony_mediator.py
+++ b/src/electionguard/key_ceremony_mediator.py
@@ -11,7 +11,7 @@ from .key_ceremony import (
     combine_election_public_keys,
     verify_election_partial_key_challenge,
 )
-from .types import GUARDIAN_ID, MEDIATOR_ID
+from .type import GUARDIAN_ID, MEDIATOR_ID
 
 
 class GuardianPair(NamedTuple):
diff --git a/src/electionguard/tally.py b/src/electionguard/tally.py
index 5d40c54..d5eea21 100644
--- a/src/electionguard/tally.py
+++ b/src/electionguard/tally.py
@@ -19,7 +19,7 @@ from .group import ElementModQ, ONE_MOD_P, ElementModP
 from .logs import log_warning
 from .manifest import InternalManifest
 from .scheduler import Scheduler
-from .types import BALLOT_ID, CONTEST_ID, SELECTION_ID
+from .type import BALLOT_ID, CONTEST_ID, SELECTION_ID
 
 
 @dataclass


Test patch:
diff --git a/src/electionguard/types.py b/src/electionguard/type.py
similarity index 100%
rename from src/electionguard/types.py
rename to src/electionguard/type.py
diff --git a/tests/integration/test_end_to_end_election.py b/tests/integration/test_end_to_end_election.py
index ffdf3b1..9587196 100644
--- a/tests/integration/test_end_to_end_election.py
+++ b/tests/integration/test_end_to_end_election.py
@@ -6,7 +6,7 @@ from shutil import rmtree
 from unittest import TestCase
 
 from random import randint
-from electionguard.types import BALLOT_ID
+from electionguard.type import BALLOT_ID
 
 from electionguard.utils import get_optional
 
diff --git a/tests/integration/test_functional_key_ceremony.py b/tests/integration/test_functional_key_ceremony.py
index 11ad766..fb6c396 100644
--- a/tests/integration/test_functional_key_ceremony.py
+++ b/tests/integration/test_functional_key_ceremony.py
@@ -15,7 +15,7 @@ from electionguard.key_ceremony import (
     verify_election_partial_key_backup,
     verify_election_partial_key_challenge,
 )
-from electionguard.types import GUARDIAN_ID
+from electionguard.type import GUARDIAN_ID
 from electionguardtest.identity_encrypt import identity_auxiliary_encrypt
 
 
diff --git a/tests/unit/test_decrypt_with_shares.py b/tests/unit/test_decrypt_with_shares.py
index 62a2555..40609f3 100644
--- a/tests/unit/test_decrypt_with_shares.py
+++ b/tests/unit/test_decrypt_with_shares.py
@@ -26,7 +26,7 @@ from electionguard.guardian import Guardian
 from electionguard.key_ceremony import CeremonyDetails
 from electionguard.key_ceremony_mediator import KeyCeremonyMediator
 from electionguard.tally import tally_ballots
-from electionguard.types import GUARDIAN_ID
+from electionguard.type import GUARDIAN_ID
 from electionguard.utils import get_optional
 
 import electionguardtest.ballot_factory as BallotFactory
diff --git a/tests/unit/test_decryption.py b/tests/unit/test_decryption.py
index f2cbbe6..5259815 100644
--- a/tests/unit/test_decryption.py
+++ b/tests/unit/test_decryption.py
@@ -37,7 +37,7 @@ from electionguard.guardian import Guardian
 from electionguard.key_ceremony import CeremonyDetails, ElectionKeyPair
 from electionguard.key_ceremony_mediator import KeyCeremonyMediator
 from electionguard.tally import tally_ballots
-from electionguard.types import BALLOT_ID, GUARDIAN_ID
+from electionguard.type import BALLOT_ID, GUARDIAN_ID
 from electionguard.utils import get_optional
 
 import electionguardtest.ballot_factory as BallotFactory