scripts: Renamed import math alias m -> mt
Mainly to avoid conflicts with match results m, this frees up the single letter variables m for other purposes. Choosing a two letter alias was surprisingly difficult, but mt is nice in that it somewhat matches it (for itertools) and ft (for functools).
This commit is contained in:
+6
-6
@@ -13,7 +13,7 @@ import collections as co
|
||||
import functools as ft
|
||||
import io
|
||||
import itertools as it
|
||||
import math as m
|
||||
import math as mt
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
@@ -257,9 +257,9 @@ def lebesgue_curve(width, height):
|
||||
# we create a truncated Z-curve by simply filtering out the points
|
||||
# that are outside our region
|
||||
curve = []
|
||||
for i in range(2**(2*m.ceil(m.log2(max(width, height))))):
|
||||
for i in range(2**(2*mt.ceil(mt.log2(max(width, height))))):
|
||||
# we just operate on binary strings here because it's easier
|
||||
b = '{:0{}b}'.format(i, 2*m.ceil(m.log2(i+1)/2))
|
||||
b = '{:0{}b}'.format(i, 2*mt.ceil(mt.log2(i+1)/2))
|
||||
x = int(b[1::2], 2) if b[1::2] else 0
|
||||
y = int(b[0::2], 2) if b[0::2] else 0
|
||||
if x < width and y < height:
|
||||
@@ -935,8 +935,8 @@ def main(path='-', *,
|
||||
|
||||
# don't forget we've scaled this for braille/dots!
|
||||
for row in range(
|
||||
m.ceil(bmap.height/4) if braille
|
||||
else m.ceil(bmap.height/2) if dots
|
||||
mt.ceil(bmap.height/4) if braille
|
||||
else mt.ceil(bmap.height/2) if dots
|
||||
else bmap.height):
|
||||
line = bmap.draw(row,
|
||||
read=read,
|
||||
@@ -966,7 +966,7 @@ def main(path='-', *,
|
||||
if wear:
|
||||
mean = (sum(p.wear for p in bmap.pixels)
|
||||
/ max(len(bmap.pixels), 1))
|
||||
stddev = m.sqrt(sum((p.wear - mean)**2 for p in bmap.pixels)
|
||||
stddev = mt.sqrt(sum((p.wear - mean)**2 for p in bmap.pixels)
|
||||
/ max(len(bmap.pixels), 1))
|
||||
worst = max((p.wear for p in bmap.pixels), default=0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user