This file contains 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
# only consider base case | |
from enum import Enum, auto | |
import unittest | |
import re | |
from typing import List, Union | |
class Status(Enum): | |
Normol = auto() | |
Number = auto() |
This file contains 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
# only consider base case | |
from enum import Enum, auto | |
import re | |
from typing import List, Union | |
class Status(Enum): | |
Normol = auto() | |
Number = auto() |
This file contains 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
""" | |
learned from https://www.sitepen.com/blog/unlocking-the-power-of-parser-combinators-a-beginners-guide | |
author: asuka minato | |
""" | |
from __future__ import annotations | |
import string as S | |
from dataclasses import dataclass, field | |
from typing import Callable, Dict, Iterable |
This file contains 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 | |
try: | |
import tomllib | |
except ImportError as e: | |
print(e, "require python 3.11, exit", file=sys.stderr) | |
exit() | |
from pathlib import Path | |
from typing import Any, Dict, List |
This file contains 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 dataclasses import dataclass | |
from typing import Callable, List | |
from operator import attrgetter, add, sub, mul, truediv | |
def adder(a: Connector, b: Connector, c: Connector): | |
return TernaryConstraint(a, b, c, add, sub, sub) |
This file contains 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
num2str = { | |
k: v.split("\n")[1:] | |
for k, v in { | |
1: """ | |
| | |
|""", | |
2: """ | |
_ | |
_| |
This file contains 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 typing import Any, Optional, Sequence | |
@dataclass | |
class Mat: | |
row: int | |
col: int | |
data: Optional[Sequence[Sequence[Any]]] = None |
This file contains 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
class _cout: | |
def __lshift__(self, x): | |
print(x, end="") | |
return self | |
class _cin: | |
def __rshift__(self, x): | |
globals()[x] = input() | |
return self |
This file contains 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
''' | |
cut token, then use ast to traverse. | |
paiza | |
S007: データヒストグラム | |
''' | |
from collections import defaultdict | |
from dataclasses import dataclass | |
from functools import reduce |
This file contains 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
#!/usr/bin/env python3 | |
# use pillow https://pillow.readthedocs.io/en/latest/reference/ImageGrab.html to copy a place of screen, get pillow object | |
# use tesseract to transform a picture into text | |
# use TextBlob to translate text | |
# use google translate to translate text | |
from time import sleep | |
from typing import Tuple |
NewerOlder