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 Any, Union, Callable | |
SENTINEL = object() | |
def typed_property( | |
name: str, | |
default: Any = SENTINEL, | |
default_factory: Union[Callable, SENTINEL] = SENTINEL | |
): |
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 logging import getLogger, config | |
from colorama import Fore, Back, Style | |
log = getLogger(__name__) | |
config.dictConfig( | |
{ | |
"version": 1, | |
"disable_existing_loggers": False, |
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 python:slim | |
COPY wheelhouse/* wheelhouse/ | |
RUN pip install wheelhouse/* |
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
src/dlls | |
venv | |
.idea | |
*.egg-info | |
poetry.lock | |
dist |
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 ubuntu:18.04 | |
RUN apt-get update | |
RUN apt-get install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget curl | |
RUN wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz | |
RUN tar -xf Python-3.9.4.tgz | |
RUN cd Python-3.9.4 && ./configure && make install | |
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - | |
ENV PATH "$PATH:/root/.poetry/bin" |
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.config | |
logging.config.dictConfig( | |
{ | |
"version": 1, | |
"disable_existing_loggers": False, | |
"formatters": { | |
"oneline": { | |
"format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s" | |
}, |
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 | |
def annotate_properties(_cls=None): | |
def wrap(cls): | |
properties = [(x, getattr(cls, x)) for x in dir(cls) if type(getattr(cls, x)) == property] | |
for name, property_ in properties: | |
cls.__annotations__[name] = property_.fget.__annotations__["return"] | |
return cls |
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 socket | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
s.connect(('0.0.0.0', 5000)) | |
s.send(b'Hello, world\r\n') | |
print(f"Received {s.recv(1024)}") |
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.config | |
workstation_IP = "?" | |
logging.config.dictConfig( | |
{ | |
"version": 1, | |
"disable_existing_loggers": False, | |
"formatters": { | |
"fluent_fmt": { |
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 setuptools import setup | |
setup( | |
name="my_package", | |
version="0.1.0", | |
packages=["my_package"], | |
install_requires=[], | |
) |