Skip to content

Commit ee19644

Browse files
committed
Fix flake8 analysis warnings
1 parent 60a7484 commit ee19644

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

slip39/gui/main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@
3737
SE_SEED_FRAME = 'Seed Extra Randomness'
3838
SS_SEED_FRAME = 'Seed Secret & SLIP-39 Recovery Groups'
3939

40+
4041
def theme_color( thing, theme=None ):
4142
"""Get the currency configured PySimpleGUI Theme color for thing == eg. "TEXT", "BACKGROUND.
4243
"""
4344
if theme is None:
4445
theme = sg.CURRENT_LOOK_AND_FEEL
4546
return sg.LOOK_AND_FEEL_TABLE[theme][thing]
4647

48+
4749
# Try to pick a font; Use something like this to see what's available (ya, this sucks):
48-
#
50+
#
4951
# from tkinter import Tk, font
5052
# root = Tk()
5153
# font_tuple = font.families()
@@ -286,8 +288,8 @@ def groups_layout(
286288
default=True, **B_kwds ),
287289
sg.Radio( "Hex", "SE", key='-SE-HEX-', visible=LO_PRO, **B_kwds ),
288290
sg.Radio( "Die rolls, ... (SHA-512)", "SE", key='-SE-SHA-', visible=LO_REC, **B_kwds ),
289-
sg.Checkbox( 'Ignore Bad Entropy', key='-SE-SIGS-C-', visible=LO_REC or LO_PRO,
290-
disabled=False, **T_hue( B_kwds, 3/20 )),
291+
sg.Checkbox( 'Ignore Bad Entropy', key='-SE-SIGS-C-', visible=LO_REC or LO_PRO,
292+
disabled=False, **T_hue( B_kwds, 3/20 )),
291293
],
292294
[
293295
sg.Frame( 'Entropy', [
@@ -600,11 +602,11 @@ def update_seed_data( event, window, values ):
600602
as_entropy = 'BIP-SEED' not in update_seed_data.src
601603
if as_entropy:
602604
if pswd:
603-
log.warning( f"BIP-39 Seed Passphrase (decrypt) ignored; using Seed Phrase Entropy, not decrypted Seed!" )
605+
log.warning( "BIP-39 Seed Passphrase (decrypt) ignored; using Seed Phrase Entropy, not decrypted Seed!" )
604606
passphrase = b""
605607
else:
606608
if pswd.strip() != pswd:
607-
log.warning( f"BIP-39 Seed Passphrase (decrypt) contains leading/trailing whitespace; are you certain this is correct?" )
609+
log.warning( "BIP-39 Seed Passphrase (decrypt) contains leading/trailing whitespace; are you certain this is correct?" )
608610
passphrase = pswd.encode( 'UTF-8' )
609611
seed = recover_bip39(
610612
mnemonic = data.strip(),

slip39/layout/components.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@ def layout_card(
222222
)
223223

224224
# Rotate the card group, watermark, etc. so its angle is from the lower-left to the upper-right.
225-
#
225+
#
226226
# b
227227
# +--------------+
228228
# | .
229229
# a | .
230230
# | β . c
231231
# + 90-β
232-
#
232+
#
233233
# tan(β) = b / a, so
234234
# β = arctan(b / a)
235235
#

slip39/layout/pdf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ def __init__( self, *args, font_dir=None, **kwds ):
6767
self.font_dir = font_dir if font_dir is not None else Path( __file__ ).resolve().parent / "font"
6868
return super().__init__( *args, **kwds )
6969

70-
7170
def set_font( self, family=None, style="", size=0 ):
7271
# Deduce a set of lists of features synonyms, and expected fontkey
7372
feature_suffixes = dict(
7473
B = ( 'bold', ),
75-
I = ( 'italic', 'oblique' ), # Typical aliases seen
74+
I = ( 'italic', 'oblique' ), # Typical aliases seen
7675
U = (), # Ignored for font loading purposes
7776
)
7877

slip39/recovery/entropy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ def shannon_entropy(
11841184
}
11851185
}
11861186

1187+
11871188
def scan_entropy(
11881189
entropy: bytes,
11891190
strides: Optional[Union[int,Tuple[int,int]]] = None, # If only a specific stride/s makes sense, eg. for ASCII symbols

slip39/recovery_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ def kwargs_signal_limits( kwargs ):
718718

719719

720720
def compute_entropy_limits( compute_entropy, bits, overlap, stride, threshold, setpoint, cycles, checks, symbols=None ):
721-
avg_over = (4096, 8192, 16384) #(1024, 2048, 4096, 8192, 16384)
721+
avg_over = (4096, 8192, 16384)
722722
rejects = deque( maxlen=16384 )
723723
rejected = setpoint
724724
try:
@@ -1023,7 +1023,7 @@ def eval_rng( rng, count, bits=256 ):
10231023

10241024

10251025
if __name__ == "__main__":
1026-
import cProfile
1026+
#import cProfile
10271027
#cProfile.run( 'test_signal_limits( detailed=True ); test_shannon_limits( detailed=True )' )
10281028
#cProfile.run( 'test_shannon_limits( detailed=True )' )
10291029
#test_shannon_limits( detailed=True )

0 commit comments

Comments
 (0)