Skip to content

Commit 5e50cdd

Browse files
authored
Merge pull request #1132 from AlisherShalenov/master
Create info_alisher_shalenov.py
2 parents a6a8552 + 300b3de commit 5e50cdd

5 files changed

Lines changed: 55 additions & 0 deletions

File tree

‎Week01/info_alisher_shalenov.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
student_id = "220316077"
2+
full_name = "Alisher Shalenov"

‎Week02/types_alisher_shalenov.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int = 10
2+
my_float = 3.14
3+
my_bool = True
4+
my_complex = 2 + 5j

‎Week03/pyramid_alisher_shalenov.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def calculate_pyramid_height(blocks): # asd
2+
height = 0
3+
layer = 1
4+
5+
while blocks >= layer:
6+
blocks -= layer
7+
height += 1
8+
layer += 1
9+
10+
return height
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import time
2+
import tracemalloc
3+
4+
def performance(fn):
5+
if not hasattr(performance, "counter"):
6+
performance.counter = 0
7+
performance.total_time = 0
8+
performance.total_mem = 0
9+
10+
def wrapper(*args, **kwargs):
11+
performance.counter += 1
12+
13+
tracemalloc.start()
14+
start_time = time.time()
15+
16+
result = fn(*args, **kwargs)
17+
18+
end_time = time.time()
19+
current, peak = tracemalloc.get_traced_memory()
20+
tracemalloc.stop()
21+
22+
performance.total_time += (end_time - start_time)
23+
performance.total_mem += peak
24+
25+
return result
26+
27+
return wrapper

‎Week05/awaitme_alisher_shalenov.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import asyncio
2+
3+
def awaitme(fn):
4+
async def wrapper(*args, **kwargs):
5+
res = fn(*args, **kwargs)
6+
7+
if asyncio.iscoroutine(res):
8+
res = await res
9+
10+
return res
11+
12+
return wrapper

0 commit comments

Comments
 (0)