This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Damerau-Levenshtein edit distance implementation | |
# Based on pseudocode from Wikipedia: https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance | |
def damerau_levenshtein_distance(a, b): | |
# "Infinity" -- greater than maximum possible edit distance | |
# Used to prevent transpositions for first characters | |
INF = len(a) + len(b) | |
# Matrix: (M + 2) x (N + 2) | |
matrix = [[INF for n in xrange(len(b) + 2)]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.path | |
import re | |
''' | |
INSTRUCTIONS | |
1. Create a file with the following code | |
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py" | |
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =), | |
as the program cannot handle these convincingly | |
4. Run the converter file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
from PyQt5.QtGui import * | |
from PyQt5.QtWidgets import * | |
from PyQt5 import QtCore | |
from PyQt5.QtCore import Qt | |
var = 0 | |
f = "" | |
choiceStr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time, sys, os | |
class SingleInstanceChecker: | |
def __init__(self, id): | |
if isWin(): | |
ensure_win32api() | |
self.mutexname = id | |
self.lock = win32event.CreateMutex(None, False, self.mutexname) | |
self.running = (win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def print_formatted(_header, _items, padding=10, alignment="^"): | |
""" | |
Function to print header along with list of list in tabular format. | |
:param alignment: ^ -center alignment; < -left alignment; > -right alignment | |
:param _header: header strings for the table | |
:param _items: list of list, representing collection of rows | |
:param padding: padding count |