Skip to content

Instantly share code, notes, and snippets.

View sallyruthstruik's full-sized avatar

Stanislav Kaledin sallyruthstruik

  • Tallinn, Estonia
View GitHub Profile
@sallyruthstruik
sallyruthstruik / main.py
Created September 6, 2019 13:37
Get total coverage percent from Golang coverage output
"""
Скрипт парсит coverage output юнит тестов Mad и собирает единую метрику покрытия
"""
import itertools
import typing
from argparse import ArgumentParser
import sys
import re
Есть таблица следующего вида:
CREATE TABLE track_downloads (
download_id BIGINT(20) NOT NULL AUTO_INCREMENT,
track_id INT NOT NULL,
user_id BIGINT(20) NOT NULL,
download_time TIMESTAMP NOT NULL DEFAULT 0,
PRIMARY KEY (download_id)
);
document_message {
url: "https://mmg.whatsapp.net/d/f/AjY52l7JBH1hemAIIwgke3RIzbfkeyfazcMuE_tXH-Tl.enc"
mimeType: "application/pdf"
title: "AlfaFuture \320\261\320\270\320\273\320\265\321\202"
file_sha256: "\006N\307z5D\362\234\260\215\265D\210\252\233JS\211\007;\023\320_\2027$\250fw\263\307\312"
file_length: 309189
page_count: 1
media_key: "k%z\231\222\241K\335\350v\246Y\234Ru\030\373@9\373\270\303\222\2513\313_\303*\035zi"
jpeg_thumbnail: "\377\330\377\340\000\020JFIF\000\001\001\000\000H\000H\000\000\377\341\000XExi
import abc
class Abstract(object):
@abc.abstractmethod
def abstract():
pass
class TrueAbstract(object):
__metaclass__ = abc.ABCMeta
import abc
class Abstract(object):
@abc.abstractmethod
def abstract():
pass
class TrueAbstract(object):
__metaclass__ = abc.ABCMeta
logging.getLogger("root").info("%s", obj)
logging.getLogger("root").info("%s"%obj)
logging.getLogger("root").info("{}".format(obj))
Предположим вы парсите сайт кинопоиска и получаете набор фильмов:
cinema = {
title: <string>
rate: <integer>
description: <string>
}
Считайте title уникальным для простоты.
title неизменный, rate и description могут меняться
users
{
name: {
first: <string>
middle: <string>
last: <string>
}
email: <string>
watched_movies: [ #просмотренные фильмы
{
from __future__ import division
import webdav.client as wc
import time
options = {
'webdav_hostname': "https://webdav.yandex.ru",
'webdav_login': "s.kaledin@coin32.com",
'webdav_password': "*******"
}
Test Cases for knapsack problem
Output is total value of solution
Data format:
[knapsack size] [count items]
[item1 value] [item1 weight]
...
[item-n value] [item-n weight]
Case 1
Output: 13