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
#Типы данных, основные конструкции | |
Q: Как получить список всех атрибутов объекта | |
A: dir(obj) | |
Q: Как получить список всех публичных атрибутов объекта | |
A: [x for x in dir(obj) if x[0] != '_'] | |
Q: Как получить список методов объекта | |
A: [x for x in dir(obj) if callable(getattr(obj,x)] |
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-repo.sls | |
my-repo: | |
pkgrepo.managed: | |
- humanname: #... | |
- name: #... | |
- baseurl: #... | |
- gpgkey: #... | |
#my-cool-pkg.sls | |
include: |
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
addrs { | |
{% for host, ip in salt['mine.get']('minion-*', 'network.ip_addrs') %} | |
{{ ip.0 }}, | |
{% endfor %} | |
} |
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
Setting up mysql user: | |
mysql_user.present: | |
- name: {{ 'db' + grains['id'] + 'user' }} | |
- host: localhost | |
- password: {{ grains['id'] + 'other_things' }} |
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 time | |
import signal | |
import multiprocessing | |
from kombu.pidbox import Node, Mailbox | |
from kombu.clocks import LamportClock | |
from kombu.exceptions import InconsistencyError | |
from kombu import Connection, Exchange, Producer | |
def do_reply(reply, exchange, routing_key, ticket, channel, clock): |
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
ansible-playbook -i inventory -c local play.yml | |
PLAY [api] ********************************************************************* | |
TASK [setup] ******************************************************************* | |
Thursday 07 July 2016 11:10:52 +0600 (0:00:00.050) 0:00:00.050 ********* | |
ok: [localhost] | |
TASK [debug] ******************************************************************* | |
Thursday 07 July 2016 11:10:53 +0600 (0:00:01.559) 0:00:01.609 ********* |
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
[defaults] | |
hash_behaviour=merge | |
roles_path=../common/roles:./roles | |
host_key_checking=False | |
pipelining=True |
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 | |
import pytest | |
@pytest.hookimpl(hookwrapper=True) | |
def pytest_fixture_setup(fixturedef, request): | |
outcome = yield | |
coro = outcome.result | |
if asyncio.iscoroutine(coro): | |
event_loop = request.getfixturevalue('event_loop') | |
result = event_loop.run_until_complete(coro) |
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 _pytest.compat import is_generator | |
async def foo(): | |
await foo() | |
async def bar(): | |
pass | |
print(is_generator(foo)) |