-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
269 additions
and
67 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,117 @@ | ||
# Example Pthon fie | ||
def main(): | ||
print("Hello, Wolrd!") | ||
# Impurt statements with misspellings | ||
|
||
# Globul constants | ||
MAXSIZ = 100 | ||
NUMBR = 42 | ||
|
||
class JSONLD: | ||
def jsonld(self): | ||
return self.bad_spelin() | ||
|
||
def bad_spelin(self): | ||
return "Spelling is hard" | ||
# Klass definition with misspellings | ||
class UserAccaunt: | ||
def __init__(selff, usrrname, ballance, intrest_rate): | ||
selff.usrrname = usrrname | ||
selff.ballance = ballance | ||
selff.intrest_rate = intrest_rate | ||
|
||
def calculayt_intrest(selff): | ||
return selff.ballance * selff.intrest_rate | ||
|
||
multi_line_string = """This is a multi-line string | ||
that spans multiple linest | ||
and is enclosed in triple quotes""" | ||
|
||
# Enumm-like dictionary | ||
Colrs = {"REDD": 1, "BLUU": 2, "GREAN": 3, "YELOW": 4} | ||
|
||
if __name__ == "__main__": | ||
main() | ||
# Globul variables | ||
globalCountr = 0 | ||
mesage = "Helllo Wolrd!" | ||
|
||
|
||
# Funktion definitions | ||
def memry_allocaton(siz): | ||
try: | ||
return [None] * siz | ||
except MemoryError: | ||
return None | ||
|
||
|
||
def calculatr(numbr1: int, numbr2, operashun): | ||
resalt = 0 | ||
|
||
if operashun == "+": | ||
resalt = numbr1 + numbr2 | ||
elif operashun == "-": | ||
resalt = numbr1 - numbr2 | ||
elif operashun == "*": | ||
resalt = numbr1 * numbr2 | ||
elif operashun == "/": | ||
if numbr2 != 0: | ||
resalt = numbr1 / numbr2 | ||
else: | ||
print("Cannott divid by ziro!") | ||
return -1 | ||
|
||
return resalt | ||
|
||
|
||
# Dekorator with misspellings | ||
def debugg_dekorator(funkshun): | ||
def wrappr(*args, **kwargs): | ||
print(f"Callin {funkshun.__name__}") | ||
return funkshun(*args, **kwargs) | ||
|
||
return wrappr | ||
|
||
|
||
# Main funktion | ||
@debugg_dekorator | ||
def mainee(): | ||
# Listt comprehension with misspellings | ||
numbrs = [x for x in range(MAXSIZ)] | ||
|
||
# Dictionry comprehension | ||
squres = {x: x * x for x in range(10)} | ||
|
||
# Structur-like usage | ||
usrr1 = UserAccaunt(usrrname="JohnDoee", ballance=1000, intrest_rate=2.5) | ||
|
||
# Condishunals and loops | ||
resalt = calculatr(10, 5, "+") | ||
if resalt == 15: | ||
print("Currect anser!\n youu best") | ||
else: | ||
print("Rong anser!") | ||
|
||
# Whiel loop with misspellings | ||
countr = 0 | ||
while countr < 5: | ||
print(f"Iterashun {countr}") | ||
countr += 1 | ||
|
||
# Multi-line string | ||
multiline_txt = """This is a verry long string | ||
that continuez on multiple linez | ||
with lots of speling misstakes""" | ||
|
||
# Generatr expression | ||
evenn_numbrs = (x for x in range(10) if x % 2 == 0) | ||
|
||
# Exeption handling | ||
try: | ||
raise ValueError("Somthing went rong!") | ||
except ValueError as errr: | ||
print(f"Caught an errr: {errr}") | ||
finally: | ||
print("Cleening upp") | ||
|
||
|
||
# Lambda funkshun | ||
quikMath = lambda x: x * NUMBR | ||
|
||
|
||
# Claas inheritance | ||
class AdvancedAccaunt(UserAccaunt): | ||
def __init__(selff, usrrname, ballance, intrest_rate, creditt_limit): | ||
super().__init__(usrrname, ballance, intrest_rate) | ||
selff.creditt_limit = creditt_limit | ||
|
||
|
||
if __name__ == "__maine__": | ||
mainee() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
I'm bd at Splellin | ||
nothing |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function getLanguageFromFileName(fileName: string): string { | ||
// Extract the extension from the filename | ||
const extension = fileName.split('.').pop()?.toLowerCase() || ''; | ||
|
||
// Map of file extensions to language IDs | ||
const extensionToLanguage: { [key: string]: string } = { | ||
// Programming Languages | ||
'ts': 'typescript', | ||
'js': 'javascript', | ||
'py': 'python', | ||
'java': 'java', | ||
'cpp': 'cpp', | ||
'c': 'c', | ||
'cs': 'csharp', | ||
'rb': 'ruby', | ||
'php': 'php', | ||
'go': 'go', | ||
'rs': 'rust', | ||
'swift': 'swift', | ||
'kt': 'kotlin', | ||
|
||
// Web Technologies | ||
'html': 'html', | ||
'htm': 'html', | ||
'css': 'css', | ||
'scss': 'scss', | ||
'sass': 'sass', | ||
'jsx': 'javascriptreact', | ||
'tsx': 'typescriptreact', | ||
'vue': 'vue', | ||
|
||
// Data Formats | ||
'json': 'json', | ||
'xml': 'xml', | ||
'yaml': 'yaml', | ||
'yml': 'yaml', | ||
'md': 'markdown', | ||
|
||
// Shell Scripts | ||
'sh': 'shell', | ||
'bash': 'shell', | ||
'ps1': 'powershell', | ||
|
||
// Other | ||
'sql': 'sql', | ||
'dockerfile': 'dockerfile', | ||
'txt': 'plaintext' | ||
}; | ||
|
||
// Return the language ID if found, otherwise return 'plaintext' | ||
return extensionToLanguage[extension] || 'plaintext'; | ||
} | ||
|
||
export {getLanguageFromFileName} |