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
def ruzne_ctverce(): | |
for delka_strany in 2, 5, 7: | |
ctverec(delka_strany, symbol='O') | |
def ctverec(n, symbol='X'): | |
for cislo_radku in range(n): | |
for cislo_sloupce in range(n): | |
if ( |
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 aiohttp import web | |
from aiohttp_graphql import GraphQLView | |
from graphql.execution.executors.asyncio import AsyncioExecutor | |
from graphql import ( | |
graphql, | |
GraphQLSchema, | |
GraphQLObjectType, | |
GraphQLField, | |
GraphQLNonNull, | |
GraphQLString, |
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 asyncio | |
from contextlib import contextmanager, asynccontextmanager, AsyncExitStack | |
@contextmanager | |
def stuff(name): | |
print('Opening', name) | |
yield | |
print(f'Closing {name}') |
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
https://docs.google.com/presentation/d/1YUT0WPmqJt1tn4MaqWqVctzslT4wuCNHiaok0Ii665o/edit?usp=sharing |
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 alpine | |
RUN apk add py3-flask py3-gunicorn | |
COPY hello.py . | |
EXPOSE 8000 | |
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "hello:app"] |
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 yaml | |
def yaml_dump(obj): | |
return yaml.dump(obj, width=120, default_flow_style=False, Dumper=_CustomDumper) | |
class _CustomDumper (yaml.SafeDumper): | |
pass | |
def _str_representer(dumper, data): | |
style = '|' if '\n' in data else 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
# my_app/container.py | |
from .clients import ShopifyClient | |
from .model import Model, connect_db | |
from .util import System | |
factories = { | |
'system': lambda cx: System(), # obsahuje wrapper okolo datetime a tak, pro snadnější mockování v testech | |
'model': lambda cx: Model(db=connect_db(cx['conf'].db), system=cx['system']), | |
'shopify_client': lambda cx: ShopifyClient(cx['conf'].shopify), |
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
x = 11 | |
def f(): | |
x = 22 | |
print('uvnitr f:', x) | |
print(x) | |
f() | |
print(x) | |
# Výstup programu: | |
# |
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
importy.png: importy.dot | |
dot -Tpng importy.dot > importy.png |
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 | |
import boto3 | |
from datetime import datetime | |
import logging | |
import socket | |
from time import time, sleep | |
logger = logging.getLogger(__name__) |