- You are representing the author of the source. Respond as if you are the author, based on the ideas in the source.
- Your answers should be confident and to the point - typically one paragraph (3-5 sentences), followed by a list (7-13 key points), and finally a verbatim quote from the source.
- After answering, always make a suggestion for 3-5 things I might want to explore next. Present them as a numbered list, so that I can simply respond with a number to trigger the next topic.
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:3.7 | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR /code | |
# Copying the requirements, this is needed because at this point the volume isn't mounted yet | |
COPY requirements.txt /code/ | |
# Installing requirements, if you don't use this, you should. | |
# More info: https://pip.pypa.io/en/stable/user_guide/ |
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 contextlib | |
import io | |
import warnings | |
import pytest | |
from click.testing import CliRunner | |
""" | |
In your tests: |
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
# -*- coding: utf-8 -*- | |
""" | |
Flat alembic versions | |
A______ | |
| | | | |
B B1 ... | |
| | | |
C C1 | |
| |
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 IPython.display import HTML, display | |
class Tag: | |
def __init__(self, name, value): | |
self.name = name | |
self.value = value | |
def __repr__(self): | |
return "<%s>%s</%s>"%(self.name, str(self.value), self.name) | |
class Linear: | |
def __init__(self, data): |
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
# Requires pyyaml | |
import os | |
import yaml | |
run = os.system | |
new_window = lambda cmd: run('tmux new-window -n "logs" "{}"'.format(cmd)) | |
split_vertical = lambda cmd: run('tmux split-window "{}"'.format(cmd)) | |
split_horizontal = lambda cmd: run('tmux split-window -h "{}"'.format(cmd)) | |
even_vertical = lambda: run('tmux select-layout even-vertical') |
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 asyncio | |
from typing import Any, Awaitable, Callable, Optional, Type | |
# eh, like the @cached_property idiom, but async and you do `await x.y` | |
class async_cached_property: | |
name: str | |
def __init__(self, getter: Callable[[], Awaitable]) -> None: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Comprehensions are a really useful feature of Python that aren't available in JavaScript (or many languages).
These concepts of course can be tranlsated into using map
instead. But especially the dictionaries are a bit
trickier.
>>> foobar = range(5)
>>> [x + 1 for x in foobar]
[1, 2, 3, 4, 5]
NewerOlder