Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded enigma machine emulator #2345
Conversation
TravisBuddy
commented
Aug 21, 2020
Hey @TrapinchO, TravisCI finished with status TravisBuddy Request Identifier: 3e824c80-e3d4-11ea-ae1e-a7d25f4a9615 |
TravisBuddy
commented
Aug 21, 2020
Hey @TrapinchO, TravisCI finished with status TravisBuddy Request Identifier: 99fa2c30-e3d5-11ea-ae1e-a7d25f4a9615 |
TravisBuddy
commented
Aug 21, 2020
Hey @TrapinchO, TravisCI finished with status TravisBuddy Request Identifier: d2718430-e3d7-11ea-ae1e-a7d25f4a9615 |
TravisBuddy
commented
Aug 21, 2020
Travis tests have failedHey @TrapinchO, TravisBuddy Request Identifier: 4d0d14a0-e3da-11ea-ae1e-a7d25f4a9615 |
I see no log |
TravisBuddy
commented
Aug 21, 2020
Travis tests have failedHey @TrapinchO, TravisBuddy Request Identifier: 64aeec30-e3e6-11ea-ae1e-a7d25f4a9615 |
TravisBuddy
commented
Aug 21, 2020
Travis tests have failedHey @TrapinchO, TravisBuddy Request Identifier: bf3232b0-e3e7-11ea-ae1e-a7d25f4a9615 |
TravisBuddy
commented
Aug 21, 2020
Travis tests have failedHey @TrapinchO, TravisBuddy Request Identifier: 3e5bf340-e3e9-11ea-ae1e-a7d25f4a9615 |
TravisBuddy
commented
Aug 21, 2020
Hey @TrapinchO, TravisCI finished with status TravisBuddy Request Identifier: a4a28c30-e3ea-11ea-ae1e-a7d25f4a9615 |
raise TypeError('PLugboard setting isn\'t type string (' | ||
+ str(type(pbl)) + ')') |
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 21, 2020
•
Member
raise TypeError('PLugboard setting isn\'t type string (' | |
+ str(type(pbl)) + ')') | |
raise TypeError(f"Plugboard setting isn't type string ({type(pbl)})") |
TravisBuddy
commented
Aug 22, 2020
Hey @TrapinchO, TravisCI finished with status TravisBuddy Request Identifier: 825b4720-e453-11ea-ae1e-a7d25f4a9615 |
{'P': 'O', 'O': 'P', 'L': 'A', 'A': 'L', 'N': 'D', 'D': 'N'} | ||
Pairs can be separated by spaces | ||
:param pbl: string containing plugboard setting for the Enigma machine |
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 22, 2020
Member
pbl
is a cyptic variable name? Why force your reader to guess what it means? Why not use a more self-documenting variable name like pegboard
?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 22, 2020
Member
With all these names, the reader will always ask... What does pb stand for?
This comment has been minimized.
This comment has been minimized.
Pairs can be separated by spaces | ||
:param pbl: string containing plugboard setting for the Enigma machine | ||
:return: dictionary of |
This comment has been minimized.
This comment has been minimized.
tmppbl = set() | ||
for i in pbl: | ||
if i not in abc: | ||
raise Exception('Not in list of symbols') | ||
elif i in tmppbl: | ||
raise Exception(f'Duplicate symbol ({i})') | ||
else: | ||
tmppbl.add(i) | ||
del tmppbl |
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 22, 2020
Member
tmppbl = set() | |
for i in pbl: | |
if i not in abc: | |
raise Exception('Not in list of symbols') | |
elif i in tmppbl: | |
raise Exception(f'Duplicate symbol ({i})') | |
else: | |
tmppbl.add(i) | |
del tmppbl | |
if not all(char in abc for char in pbl): | |
raise ValueError(f'Not characeters are in {abc}') | |
if len(set(pbl)) != len(pbl): | |
<your code goes here> |
This comment has been minimized.
This comment has been minimized.
TrapinchO
Aug 22, 2020
•
Author
Contributor
How would you tell the user which symbol is invalid/duplicate?
Improved the invalid symbol exception
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 26, 2020
•
Member
bad_symbols = [key for key, value in collections.Counter(pbl) if key not in abc or value > 1]
if bad_symbols:
raise ValueError(<your code here>)
This comment has been minimized.
This comment has been minimized.
Thanks!! |
TrapinchO commentedAug 21, 2020
•
edited
Added Enigma machine file to 'ciphers' section
Describe your change:
Added emulator of the enigma machine from WWII into 'ciphers' folder.
PS: Couldn't open the 'automated testing on Travis CI' in CONTRIBUTING.md. It says
Checklist:
Fixes: #{$ISSUE_NO}
.