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 sys | |
| from functools import wraps | |
| from typing import Any, Callable, Optional, TypeVar | |
| F = TypeVar("F", bound=Callable[..., Any]) | |
| def log_variables(func: F) -> F: | |
| @wraps(func) | |
| def wrapper(*args: Any, **kwargs: Any) -> Any: | |
| def tracer(frame, event, arg) -> Optional[Callable]: |
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 functools import wraps | |
| from typing import Any, Callable, TypeVar | |
| F = TypeVar("F", bound=Callable[..., Any]) | |
| def log_variables(func: F) -> F: | |
| @wraps(func) | |
| def wrapper(*args, **kwargs) -> Any: | |
| if not hasattr(wrapper, "initialized"): |
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 __future__ import annotations | |
| from typing import ClassVar, Type, TypedDict, Unpack, cast | |
| from pydantic import BaseModel, Field, create_model, model_validator | |
| class ColorData(TypedDict): | |
| black: str | |
| red: str |
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 Optional, TypeGuard | |
| import pandas as pd | |
| from pandas import DataFrame | |
| class DataFrameStore: | |
| """ | |
| A class to store and manage a DataFrame, with the ability to save and load it to | |
| and from a file in Feather format. |
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 random | |
| from dataclasses import dataclass | |
| from string import ascii_lowercase | |
| from typing import override | |
| @dataclass | |
| class Question: | |
| prompt: str | |
| answer: str |
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 ast | |
| import astor # `pip install astor` | |
| from black import FileMode, format_str # `pip install black` | |
| class DocstringRemover(ast.NodeTransformer): | |
| def visit(self, node: ast.AST) -> ast.AST: | |
| if isinstance(node, (ast.FunctionDef, ast.ClassDef, ast.Module)): | |
| if ( |
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 collections | |
| import itertools | |
| from collections import abc | |
| from typing import Any, Dict, Iterable, Iterator, Optional, Tuple | |
| _sentinel = object() | |
| def _merge_in( | |
| target: Dict[Any, Any], |
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
| #!/bin/bash | |
| find . -maxdepth 1 -type f -name "*.sh" -exec chmod 755 {} \; |
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
| require "http/client" | |
| require "json" | |
| class Geo | |
| include JSON::Serializable | |
| property lat : String | |
| property lng : String | |
| end | |
| class Address |