Skip to content

Commit

Permalink
Merge pull request #6 from mgrunberg/remove-warnings
Browse files Browse the repository at this point in the history
remove warnings
  • Loading branch information
mgrunberg authored May 30, 2024
2 parents 7c9ba7c + a5afdbb commit 3f256b3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@

# build files
/build/

# cache files
/windowgram/__pycache__/
11 changes: 4 additions & 7 deletions windowgram/windowgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ def Edge_PanesAlongSub(self, axis, edge):
elif edge[0] == w: panes.append( windowgram_chars[y][w-1] )
else: panes += [ windowgram_chars[y][edge[0]-1], windowgram_chars[y][edge[0]] ]
else: # if axis == "h":
if edge[0] is not 0: panes += [ windowgram_chars[edge[0]-1][x] for x in range(edge[1], edge[2]) ]
if edge[0] != 0: panes += [ windowgram_chars[edge[0]-1][x] for x in range(edge[1], edge[2]) ]
if edge[0] is not h: panes += [ windowgram_chars[edge[0] ][x] for x in range(edge[1], edge[2]) ]
return "".join( set( panes ) )

Expand Down Expand Up @@ -2065,10 +2065,10 @@ def argument_processor(hint, edge, used, unused, getsc): # -> error, res_hint, r
ignore = "*@:" # The "@" is for when the parameters hint and edge are combined
# Reduce edge and resolve hint
swapped = ""
res_hint = resolve_vhtblr( hint ) if hint is not "" else ""
res_hint = resolve_vhtblr( hint ) if hint != "" else ""
res_edge = thruvalid_panes( edge, ignore )
if not res_hint or not res_edge:
swapped_hint = resolve_vhtblr( edge ) if edge is not "" else ""
swapped_hint = resolve_vhtblr( edge ) if edge != "" else ""
swapped_edge = thruvalid_panes( hint, ignore )
if swapped_hint and res_edge:
res_hint, res_edge = swapped_hint, swapped_edge
Expand Down Expand Up @@ -2871,7 +2871,7 @@ def drag(count, edgeruns, wg, res_scalegroups_masks):
for wgm0s, wgm0x, wgm1s, wgm1x in res_scalegroups_masks:
# Scale this scalegroup
def modifier(which, val, size, inv):
return ( val + ( -size if ( ( inv == "-" ) ^ ( which is not 0 ) ) else size ) ) if val else 0
return ( val + ( -size if ( ( inv == "-" ) ^ ( which != 0 ) ) else size ) ) if val else 0
sw0, sh0 = wgm0s.Analyze_WidthHeight()
sw1, sh1 = wgm1s.Analyze_WidthHeight()
if res_direction == "h" and sw0: sw0 = modifier(0, sw0, count, inverse)
Expand Down Expand Up @@ -3298,6 +3298,3 @@ def cmd_flip(fpp_PRIVATE):
##

# TODO



49 changes: 23 additions & 26 deletions windowgram/windowgram_test.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def assertFlexSequence(self, commands, pattern, noticesok=False):
for ix, (command, windowgram) in enumerate( zip( commands, windowgramgroup_list ) ):
errors = flex_processor( wg, command, noticesok )
self.assertTrue( not errors, errors )
self.assertTrue( wg.Export_String() == windowgram,
self.assertTrue( wg.Export_String() == windowgram,
"The resulting windowgram for sequence #" + str(ix+1) + " does not match: \n\n" + wg.Export_String() )
wlist.append( wg.Export_String() )
pattern_produced = WindowgramGroup_Convert.List_To_Pattern( \
Expand Down Expand Up @@ -634,22 +634,22 @@ def test_EdgeCore_WindowgramEdge(self):
""" )
status, axis, minimal, optimal = edgecore( wg, "5", "right" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "v" )
self.assertTrue( axis == "v" )
self.assertTrue( minimal == [ [6, 1, 3] ] )
self.assertTrue( optimal == [ [6, 1, 3] ] )
status, axis, minimal, optimal = edgecore( wg, "0", "left" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "v" )
self.assertTrue( axis == "v" )
self.assertTrue( minimal == [ [0, 0, 1] ] )
self.assertTrue( optimal == [ [0, 0, 1] ] )
status, axis, minimal, optimal = edgecore( wg, "8", "bottom" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "h" )
self.assertTrue( axis == "h" )
self.assertTrue( minimal == [ [6, 3, 6] ] )
self.assertTrue( optimal == [ [6, 3, 6] ] )
status, axis, minimal, optimal = edgecore( wg, "1", "top" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "h" )
self.assertTrue( axis == "h" )
self.assertTrue( minimal == [ [0, 1, 3] ] )
self.assertTrue( optimal == [ [0, 1, 3] ] )

Expand All @@ -676,7 +676,7 @@ def test_EdgeCore_Examples(self):
""" )
status, axis, minimal, optimal = edgecore( wg, "12" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "v" )
self.assertTrue( axis == "v" )
self.assertTrue( minimal == [ [3, 1, 2] ] )
self.assertTrue( optimal == [ [3, 1, 2] ] )
wg = Windowgram( """
Expand All @@ -689,7 +689,7 @@ def test_EdgeCore_Examples(self):
""" )
status, axis, minimal, optimal = edgecore( wg, "12" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "v" )
self.assertTrue( axis == "v" )
self.assertTrue( minimal == [ [3, 2, 3] ] )
self.assertTrue( optimal == [ [3, 0, 5] ] )
wg = Windowgram( """
Expand All @@ -702,19 +702,19 @@ def test_EdgeCore_Examples(self):
""" )
status, axis, minimal, optimal = edgecore( wg, "12" )
self.assertTrue( status is EdgeStatus.Valid )
self.assertTrue( axis is "v" )
self.assertTrue( axis == "v" )
self.assertTrue( minimal == [ [3, 2, 3] ] )
self.assertTrue( optimal == [ [3, 1, 4] ] )

## Smudge Core

def test_SmudgeCore_Basic(self):
wg_i = Windowgram( """
12345
abcde
fghij
ABCDE
FGHIJ
12345
abcde
fghij
ABCDE
FGHIJ
""" )
group_o = """
2345 11345 1234 12355
Expand All @@ -723,23 +723,23 @@ def test_SmudgeCore_Basic(self):
BCDE AACDE ABCD ABCEE
GHIJ FFHIJ FGHI FGHJJ
abcde 12345 12345 12345
fghij 12345 abcde abcde
ABCDE fghij fghij fghij
FGHIJ ABCDE ABCDE FGHIJ
FGHIJ FGHIJ
abcde 12345 12345 12345
fghij 12345 abcde abcde
ABCDE fghij fghij fghij
FGHIJ ABCDE ABCDE FGHIJ
FGHIJ FGHIJ
345 12345 123 12555
cde abcde abc abeee
hij fffij fgh fgjjj
CDE AAADE ABC ABCDE
HIJ FFFIJ FGH FGHIJ
fghij 12345 12345 12345
ABCDE ab345 abcde abcde
FGHIJ fg345 fghij FGHij
ABCDE FGHDE
FGHIJ FGHIJ
fghij 12345 12345 12345
ABCDE ab345 abcde abcde
FGHIJ fg345 fghij FGHij
ABCDE FGHDE
FGHIJ FGHIJ
"""
wg_o_list = WindowgramGroup_Convert.Pattern_To_List( group_o )
wg_x_list = [
Expand Down Expand Up @@ -2198,6 +2198,3 @@ def test_ReadmeDemonstration2(self): # Created in flex using "new unittest Readm
zzzzzzzzzzzzzbbbbbbbbddddddddllllllll zzzzzzzzzzzzzbbbbbbbbbbddddddddddllllllllll
zzzzzzzzzzzzzbbbbbbbbddddddddllllllll zzzzzzzzzzzzzbbbbbbbbbbddddddddddllllllllll
""" )



0 comments on commit 3f256b3

Please sign in to comment.