Skip to content

Commit

Permalink
Added type hints to some python files
Browse files Browse the repository at this point in the history
  • Loading branch information
Penguin98kStudio committed Jan 23, 2022
1 parent a915cbf commit a43e2cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Python Stuff/Testing/testunpack.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
str_or_num = str | float | int

list1, list2 = [3, 2, 5], [2, 4, 1]
list1, list2 = map(
list, (zip(*sorted(zip(list1, list2, strict=True), reverse=True)))
)
print(list1, list2)


class Point:
def __init__(self, x, y, z=None):
def __init__(self, x: str_or_num, y: str_or_num):
self.x = float(x) if isinstance(x, str) else x
self.y = float(y) if isinstance(y, str) else y
self.xy = (self.x, self.y)

def __getitem__(self, key):
def __getitem__(self, key: int):
if key == 0:
return self.x
elif key == 1:
Expand Down
2 changes: 1 addition & 1 deletion Python Stuff/dectobin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def decimaltobinary(number):
def decimaltobinary(number: int):
half = number
power = 1
ans = 0
Expand Down
3 changes: 1 addition & 2 deletions Python Stuff/idk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
def find(number):
dec = 3
def find(number: int):
valueset = [(int("1" * x) % number) for x in range(1, number + 1)]
try:
print("1" * (valueset.index(0) + 1))
Expand Down
2 changes: 2 additions & 0 deletions SublimeUserPlugins/MoveTabBack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
class MoveTabBackCommand(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
if not view:
return
group_index, view_index = self.window.get_view_index(view)
self.window.set_view_index(view, group_index, view_index - 1)

0 comments on commit a43e2cf

Please sign in to comment.