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
[tool.mypy] | |
strict = true |
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
[tool.mypy] | |
strict = true |
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 typing import TypeVar, Sequence | |
T = TypeVar("T") | |
def repeat(val: T, times: int) -> list[T]: | |
return [val] * times | |
def get_first_element(items: Sequence[T]) -> T: |
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
""" | |
Based on https://github.com/tough-dev-school/education-backend/blob/master/src/core/services.py | |
""" | |
from abc import ABC, abstractmethod | |
from collections.abc import Callable, Sequence | |
from typing import Any, Generic, TypeVar | |
ReturnType = TypeVar('ReturnType') |
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
const fetchLeetCodeTaskDetails = async (taskId) => { | |
const query = ` | |
query { | |
question(titleSlug: "${taskId}") { | |
questionId | |
title | |
difficulty | |
title | |
titleSlug | |
topicTags { |
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 logging | |
# DEFAULT_LOG_FORMAT = "[%(asctime)s.%(msecs)03d] %(funcName)20s %(module)s:%(lineno)d %(levelname)-8s - %(message)s" | |
DEFAULT_LOG_FORMAT = ( | |
"%(funcName)10s %(module)s:%(lineno)d %(levelname)-8s - %(message)s" | |
) | |
def configure_logging(level: int = logging.INFO) -> None: | |
logging.basicConfig( |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def true_div( | |
number: float, | |
divisor: float, | |
) -> float: | |
return number / divisor | |
def squares(*numbers: int) -> list[int]: | |
print("type of numbers:", type(numbers)) | |
return [n * n for n in numbers] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.