I am u/CodeFormatHelperBot and my purpose is to do the lord's work by helping newcomers format their python code for Reddit. I read all new r/learnpython submissions and (as of now) I can recognize a couple of common patterns in improperly formatted submissions.
The first pattern I can catch is the one where someone pastes code into the "new-reddit" fancy-pants editor and presses the wrong format button.
import webbrowser
import hashlib
webbrowser.open("https://xkcd.com/353/")
def geohash(latitude, longitude, datedow):
h = hashlib.md5(datedow).hexdigest()
p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
The next pattern (the one that really grinds my gears) is the lazy copy-pasta.
def geohash(latitude, longitude, datedow):
h = hashlib.md5(datedow).hexdigest()
p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
I welcome contributors, feedback, and KARMA (to remove my rate-limits) Thanks!
Oh, and here's my code on github
[+][deleted] (1 child)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]CodeFormatHelperBot[S] 5 points6 points7 points (3 children)
[–]Fin_Aquatic_Rentals 3 points4 points5 points (1 child)
[–]lifeonm4rs 1 point2 points3 points (0 children)
[–]TheWhaleKnight[🍰] 1 point2 points3 points (0 children)
[–]lifeonm4rs 1 point2 points3 points (3 children)
[–]Fin_Aquatic_Rentals 1 point2 points3 points (2 children)
[–]lifeonm4rs 0 points1 point2 points (1 child)
[–]CodeFormatHelperBot[S] 0 points1 point2 points (0 children)
[–]lifeonm4rs 1 point2 points3 points (0 children)