ATTR_ACCESS:
Testing with 10000 repeats, result is average of 10 tests:
>>> NewEnum.foo # 0.6069349023270748 ms
<NewEnum.foo: 1>
>>> OldEnum.foo # 4.5089948174334005 ms
<OldEnum.foo: 1>
This file contains hidden or 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
ATTR_ACCESS: | |
Testing with 1000000 repeats: | |
>>> Qrator.FOO # 0.04096488799999998 seconds | |
<Qrator.FOO: FOO> | |
>>> BuiltinPatched.FOO # 0.038564896999999654 seconds | |
<BuiltinPatched.FOO: 'FOO'> |
This file contains hidden or 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 unittest | |
def find_longest_unique_substring(string: str) -> int: | |
""" | |
Returns length of the longest substring of unique characters | |
""" | |
max_length = 0 | |
current_substr_chars = set() | |
start_index = leading_index = 0 |
This file contains hidden or 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
from dataclasses import dataclass | |
from enum import Enum | |
from timeit import timeit | |
from typing import NamedTuple | |
from pydantic import BaseModel | |
from pydantic.dataclasses import dataclass as pydantic_dataclass | |
class Model(BaseModel): |
This file contains hidden or 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
print("Initializing variables") | |
import requests | |
from settings import token | |
import time | |
tlgrm_url = "https://api.telegram.org/bot{}/".format(token) | |
cryptonator_url = "https://api.cryptonator.com/api/ticker/" | |
greeting = 'Привет, я умею показывать текущий курс криптовалют. Отзываюсь на команды /btc и /eth' | |
offset = 0 |
NewerOlder