Skip to content

Instantly share code, notes, and snippets.

View klen's full-sized avatar

Kirill Klenov klen

View GitHub Profile
@klen
klen / mixin.py
Created November 14, 2012 18:50
Expand user model in Flask-Foundation
# Somewhere in your app (Ex. foundation/base/yourapp/mixin.py
class NameMixin(object):
name = db.Column(db.String(50))
import os
import threading
import Queue
class WorkerThread(threading.Thread):
""" A worker thread that takes directory names from a queue, finds all
files in them recursively and reports the result.
Input is done by placing directory names (as strings) into the
""" Hello GIL!
"""
from __future__ import print_function
import math
import multiprocessing
import threading
from time import time
from itertools import product
print sum(1 for a, b in product(map(sum, product(range(10), repeat=3)), repeat=2) if a == b)
from itertools import product, groupby
print sum([len(tuple(g)) ** 2 for _, g in groupby(sorted(map(sum, product(range(10), repeat=3))))])
Traceback (most recent call last):
File "pylama/pylint/logilab/astng/scoped_nodes.py", line 284, in getattr
return [self.import_module(name, relative_only=True)]
File "pylama/pylint/logilab/astng/scoped_nodes.py", line 339, in import_module
return MANAGER.astng_from_module_name(absmodname)
File "pylama/pylint/logilab/astng/manager.py", line 133, in astng_from_module_name
return self.astng_from_file(filepath, modname, fallback=False)
File "pylama/pylint/logilab/astng/manager.py", line 104, in astng_from_file
return ASTNGBuilder(self).file_build(filepath, modname)
File "pylama/pylint/logilab/astng/builder.py", line 128, in file_build
""" Interfaces for code checking.
"""
from __future__ import absolute_import, with_statement
import _ast
from os import path as op, environ
from .pep8 import BaseReport, StyleGuide
def pylint(path, **meta):
""" Pylint code checking.
:return list: List of errors.
"""
from sys import version_info
if version_info > (3, 0):
import logging
logging.warn("Pylint don't supported python3 and will be disabled.")
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import Queue
import threading
import sys
import traceback
from pylint.lint import Run
from pylint.utils import UnknownMessage
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import Queue
import threading
import sys
import traceback
from pylint.lint import Run
from pylint.utils import UnknownMessage