Skip to content

Instantly share code, notes, and snippets.

View schettino72's full-sized avatar

eduardo naufel schettino schettino72

View GitHub Profile
@schettino72
schettino72 / obsolete.py
Created March 24, 2013 04:44
doit - example of how to detect obsolote targets in tasks
DOIT_CONFIG = {'verbosity': 2}
def targets_diff(task, values):
"""to be used as uptodate check - check if targets changed
it also save the 'tdiff' to be used by other actions
"""
now_list = task.targets
@schettino72
schettino72 / mp3cut
Last active December 19, 2015 17:38
#! /usr/bin/env python
"""cut begin and end from mp3, to get rid of annoying intro from podcast
"""
import os
import sys
from subprocess import check_output as cmd
CUT_START = '01:22'
@schettino72
schettino72 / dodo.py
Created September 22, 2013 18:29
doit.initial_workdir example
### README
# Sample to test doit.initial_workdir
# First create a folder named 'sub1'.
# Invoking doit from the root folder will execute both tasks 'base' and 'sub1'.
# Invoking 'doit -k' from path 'sub1' will execute only task 'sub1'
##################
import os
import doit
@schettino72
schettino72 / dodo.py
Created September 27, 2013 16:03
doit progress bar demo
from pyterm import Term
from sample_bar import ProgressBar
from doit.reporter import ConsoleReporter
class ProgressReporter(ConsoleReporter):
"""use some colors in the report"""
def __init__(self, outstream, options):
ConsoleReporter.__init__(self, outstream, options)
self.term = Term()
@schettino72
schettino72 / test_sa_orm_list_clear.py
Created November 6, 2013 10:02
test sqlachemy support for list.clear() in orm.collections
# python 3.3
from sqlalchemy import Table, Column, Integer, String, Text, ForeignKey
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, relationship, attributes
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_base()
Session = sessionmaker(bind=engine)
date type content
2008-04-14 release 0.1.0
2009-04-16 release 0.2.0
2009-08-30 release 0.3.0
2009-10-05 release 0.4.0
2009-11-30 release 0.5.0
2009-12-03 release 0.5.1
2010-01-25 release 0.6.0
2010-04-08 release 0.7.0
2010-05-16 release 0.8.0
import glob
from doit.loader import create_after
@create_after(executed='early')
def task_build():
for inf in glob.glob('*.in'):
yield {
@schettino72
schettino72 / doit-dryrun-design.md
Last active August 29, 2015 14:14
doit dry-run design

doit DRY-RUN

note use-case result columns:

  • expected: expected by schettion72 :)
  • doit: as given by Oliver branch
@schettino72
schettino72 / cli.py
Created March 2, 2022 15:45
pydoit / click proof of concept integration
#! /usr/bin/env python3
import sys
import inspect
from doit.cmd_base import ModuleTaskLoader
from doit.doit_cmd import DoitMain
import click