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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fssp="http://www.fssprus.ru/namespace/incoming/2019/1" targetNamespace="http://www.fssprus.ru/namespace/incoming/2019/1" elementFormDefault="qualified" attributeFormDefault="unqualified"> | |
<xs:simpleType name="DAccountType"> | |
<xs:annotation> | |
<xs:documentation>номер счета в кредитной организации</xs:documentation> | |
</xs:annotation> | |
<xs:restriction base="xs:string"> | |
<xs:maxLength value="20"/> | |
</xs:restriction> | |
</xs:simpleType> |
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
/* | |
Note: I have db.MapperFunc(FromCamelCaseToUnderScore) | |
This will make nested json like this | |
{ | |
"likes": [ | |
{ | |
"chat_id": 155636374, | |
"created": "2018-08-04T10:52:36.360217Z", |
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 | |
from typing import Any, Dict, Optional, Sequence, Tuple, List | |
import simplejson as json | |
from psycopg2 import IntegrityError | |
from django.core.serializers.json import DjangoJSONEncoder | |
from django.db import connection | |
from django.db.utils import ProgrammingError |
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 functools | |
__all__ = ("memoize", ) | |
MEMOIZE_CACHE = {} | |
class _memoize(object): |
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
const gulp = require('gulp'); | |
const stylus = require('gulp-stylus'); | |
const sourcemaps = require('gulp-sourcemaps'); | |
const seq = require('gulp-sequence'); | |
const postcss = require('gulp-postcss'); | |
const autoprefixer = require('autoprefixer'); | |
const del = require('del'); | |
gulp.task('clean', (clb) => { | |
return del(['./dist/**/*'], clb); |
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
""" | |
peewee-async.manager.execute(Model.select()) loads everything into memory. Avoid that with this iterator | |
Usage:: | |
q = Item.select() | |
async for item in IterSelect(manager_instance, q): | |
print(item.id) | |
DISCLAIMERS: Untested and seems slow |
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
# Suppose table like this | |
# | |
# item | |
# ---- | |
# like_count INTEGER | |
# snippet JSONB | |
# | |
# You want 'like_count' key in snippet also | |
# and now there is a time to increment |
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
""" | |
Some kind of Nano-ORM. Just playing along | |
""" | |
import asyncio | |
from collections import OrderedDict | |
import logging | |
import re | |
from motor import motor_asyncio |
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
#!/usr/bin/env python | |
""" | |
Colour logs, printing colour escape codes and some ASCII. | |
You need to ``pip install colorlog`` to run this. | |
""" | |
import logging | |
from logging.config import dictConfig |
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
#!/usr/bin/env python | |
""" | |
Test parallel scripts running with asyncio executors. | |
Requires at least Python 3.4 to run. | |
""" | |
import asyncio | |
import os |
NewerOlder