0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
from time import sleep
from datetime import datetime
def _sum(num1, num2):
start_time = datetime.now()
sleep(num1)
end_time = datetime.now()
total_passed = end_time - start_time
return num2 + total_passed.seconds
Функция сложения с хитрым, очень эффективным алгоритмом.
F_C_TL,
16 Сентября 2023
0
- 1
https://github.com/yuki-iptv/yuki-iptv/blob/master/usr/lib/yuki-iptv/yuki_iptv/epg_txt.py
gazovaya_eblya,
29 Июля 2023
0
- 1
During handling of the above exception, another exception occurred
А бывает "Исключение возникло при обработке исключения, которое возникло при попытке обработать исключение"?
3_dar,
27 Июня 2023
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
@dataclass(slots=True)
class Govno:
govno_index: int
def patch(self, indices_dict: Dict[int, int]) -> None:
new_index = indices_dict[self.govno_index]
self.govno_index = new_index
@dataclass(slots=True)
class Mocha:
mocha_index: int
def patch(self, indices_dict: Dict[int, int]) -> None:
new_index = indices_dict[self.govno_index]
self.govno_index = new_index
Метод «patch» был скопипащен из класса «Govno» в класс «Mocha». Тайпчекер никаких ошибок не показывал; все типы были выведены корректно.
А в рантайме всё упало, что и неудивительно!
ISO,
13 Июня 2023
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
from miditk.smf import MidiSequence
from miditk.common import constants
from sys import argv
import datetime
sequence = MidiSequence.fromfile(argv[1])
dt0 = datetime.datetime(1,1,1)
tail = ''
for time, group in sequence.events_by_time():
ms = datetime.timedelta(milliseconds=time)
pretty_time = (dt0+ms).strftime('%M:%S.%f')[:-4]
for ev in group:
if ev.meta_type == constants.TEXT:
text = ev.data.decode('windows-1251')
if text and (text[0] == '@' or text[0] == '/' or text[0] == '\\'):
if tail: # выводим отложенный текст
if tail[0] == '\\': # отбиваем абзац
print(f'[{pt}]')
if tail[0] == '@': # шапка, убираем префиксы типа @T, @L
print(f'[{pt}]{tail[2:]}')
else:
print(f'[{pt}]{tail[1:]}')
pt = pretty_time
tail = text
else: # откладываем текст на потом
tail = tail + text
Наговнякал на коленках конь-вертер текстов песен из .KAR (.midi со словами в событиях типа 1 = TEXT) в .LRC, чтобы готовые тексты можно было использовать с проигрывателями mp3- или flac-файлов.
Зависит от https://pypi.org/project/miditk-smf/
ropuJIJIa,
12 Апреля 2023
−1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
def get_decrease_fan_speed_delta(fan_speed: float, delta: float, turn_off: bool):
# if the fan is already running slower than minimum speed
if fan_speed < MIN_FAN_SPEED:
# we ignore the turn_off argument and always set the fan off
return -fan_speed
# if fan would be running slower than minimum speed after decreasing it by delta:
if (fan_speed - delta) < MIN_FAN_SPEED:
if turn_off:
return -fan_speed # turn the fan off
else:
return -fan_speed + MIN_FAN_SPEED # make it run at minimum speed
return -delta
def get_increase_fan_speed_delta(fan_speed, delta):
new_fan_speed = fan_speed + delta
# if fan would be running faster than maximum speed
if new_fan_speed > 100:
return 100 - fan_speed # cap it at 100%
elif new_fan_speed < MIN_FAN_SPEED:
return MIN_FAN_SPEED - fan_speed # jump to minimum fan speed
return delta
def compute_fan_speed_delta(temp: float, temp_delta: float, fan_speed: float):
if temp >= HOT:
return get_increase_fan_speed_delta(fan_speed, 100.0)
if temp <= COLD:
# if temperature is decreasing, we slowly decrease the fan speed
if temp_delta < 0.0:
return get_decrease_fan_speed_delta(fan_speed, FAN_DELTA, turn_off=True)
# if temperature is constant or increasing we don't change fan speed
# until it rises above COLD
return 0.0
# if temperature is decreasing we decrease fan speed slowly
if temp_delta < 0.0:
return get_decrease_fan_speed_delta(fan_speed, FAN_DELTA, turn_off=False)
# if temperature is increasing we increase fan speed slowly
if temp_delta > 0.0:
return get_increase_fan_speed_delta(fan_speed, FAN_DELTA)
# if temperature is not changing, don't change the fan speed
return 0.0
GAMER,
30 Марта 2023
0
- 1
https://gitlab.com/muzena/iptv/-/blob/master/usr/lib/astronciaiptv/astroncia_iptv.py
тут каждая строчка - это говнокод
ACTPE9I,
27 Марта 2023
0
- 1
AttributeError: type object 'datetime.datetime' has no attribute 'from_timestamp'. Did you mean: 'fromtimestamp'?
ISO,
19 Марта 2023
−9
правда
sashastepuronegro,
04 Марта 2023
−8
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
print('1 часть тут, 2 в описании')
import re
q = int(input())
b = input()
v = 0
flag = True
if v == 0:
c = len(re.findall('q', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('w', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('e', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('r', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('t', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('y', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('u', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('i', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('o', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('p', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('a', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('s', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('d', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('f', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('g', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('h', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('j', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('k', b))
if c > 1:
print("NO")
flag = False
quit
else:
v = 3
c = len(re.findall('l', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('m', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('n', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('b', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('v', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('c', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('x', b))
if c > 1:
flag = False
quit()
print("NO")
else:
v = 3
c = len(re.findall('z', b))
if c > 1:
flag = False
print("NO")
quit()
else:
v = 3
if flag == True:
print("YES")
sashastepuronegro,
04 Марта 2023