code
stringlengths
9
256k
<s> """<STR_LIT>""" <EOL> from BinomialCRROption import BinomialCRROption <EOL> import pythoncom <EOL> class BinomialCRRCOMServer : <EOL> _public_methods_ = [ '<STR_LIT>' ] <EOL> _reg_progid_ = "<STR_LIT>" <EOL> _reg_clsid_ = pythoncom . CreateGuid ( ) <EOL> def pricer ( self , S0 , K , r , T , N , sigma , <EOL> is_cal...
<s> from django import template <EOL> from django . conf import settings <EOL> register = template . Library ( ) <EOL> @ register . inclusion_tag ( '<STR_LIT>' ) <EOL> def render_honeypot_field ( field_name = None ) : <EOL> """<STR_LIT>""" <EOL> if not field_name : <EOL> field_name = settings . HONEYPOT_FIELD_NAME <EOL...
<s> __version__ = '<STR_LIT>' <EOL> import time <EOL> import datetime <EOL> import signal <EOL> import argparse <EOL> from pymongo import Connection <EOL> from termcolor import colored <EOL> quit = False <EOL> def watch ( host , dbname , refresh , slowms = <NUM_LIT:0> ) : <EOL> global quit <EOL> db = getattr ( Connecti...
<s> import ccsitemaps <EOL> from omblog . models import Post <EOL> class PostSiteMap ( ccsitemaps . SiteMap ) : <EOL> model = Post <EOL> @ staticmethod <EOL> def last_mod ( ) : <EOL> try : <EOL> last_mod = Post . objects . published ( ) . order_by ( '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> return last_mod . created <EOL> ex...
<s> from keras . models import * <EOL> from keras . layers . core import * <EOL> from keras . layers . recurrent import * <EOL> from data_init import * <EOL> from model_util import * <EOL> import os . path <EOL> import random <EOL> from datetime import datetime <EOL> print "<STR_LIT>" <EOL> target_str = "<STR_LIT>" <EO...
<s> import numpy as np <EOL> import math <EOL> import random <EOL> def generate_random_Ugoal_HARD ( N , ** kwargs ) : <EOL> Ugoal = np . eye ( <NUM_LIT:2> ) <EOL> seq_angle = <NUM_LIT> * math . pi * np . random . rand ( <NUM_LIT:1> , N ) <EOL> help2 = np . random . randint ( <NUM_LIT:3> , size = ( <NUM_LIT:1> , N ) ) <...
<s> import argparse <EOL> import copy <EOL> import inspect <EOL> import logging <EOL> import math <EOL> import os <EOL> import socket <EOL> import sys <EOL> import time <EOL> import uuid <EOL> from datetime import datetime <EOL> from opentuner import resultsdb <EOL> from opentuner . search . driver import SearchDriver ...
<s> import argparse <EOL> import collections <EOL> import nltk . corpus <EOL> from nltk . corpus . util import LazyCorpusLoader <EOL> from nltk_trainer import basestring , load_corpus_reader , simplify_wsj_tag <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' , <EOL> formatter_class = argparse . RawT...
<s> import argparse , collections , functools , itertools , math , operator , os . path , re , string , sys <EOL> import nltk . data <EOL> import nltk_trainer . classification . args <EOL> from nltk . classify import DecisionTreeClassifier , MaxentClassifier , NaiveBayesClassifier <EOL> from nltk . classify . util impo...
<s> try : <EOL> from . errormarker import ErrorMarker <EOL> from . util import delayed <EOL> except ( ValueError ) : <EOL> from errormarker import ErrorMarker <EOL> from util import delayed <EOL> class ErrorReporter ( object ) : <EOL> def __init__ ( self , window , error_report , settings ) : <EOL> self . _marker = Err...
<s> import logging <EOL> from fabulous . logs import * <EOL> from fabulous . gotham import * <EOL> from fabulous . color import * <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> def luv ( ) : <EOL> msg = "<STR_LIT>" <EOL> while True : <EOL> for n in range ( len ( msg ) ) + list ( reversed ( range ( len ( msg )...
<s> """<STR_LIT>""" <EOL> import unittest <EOL> from test_app import app <EOL> from flask . testing import FlaskClient <EOL> from flask . ext . fillin import FormWrapper <EOL> class fillinTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . app = app <EOL> self . app . testing = True <EOL> self . clie...
<s> import sys , os <EOL> sys . path . insert ( <EOL> <NUM_LIT:0> , os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:..>' ) ) ) <EOL> sys . path . append ( os . path . abspath ( '<STR_LIT>' ) ) <EOL> extensions = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> templates_path = [ '<STR_LIT>' ] <...
<s> import os <EOL> import unittest <EOL> from PIL import Image <EOL> FILES_PATH = '<STR_LIT>' <EOL> IMAGE_PATH = os . path . join ( FILES_PATH , '<STR_LIT>' ) <EOL> IMAGE_FILENAME = '<STR_LIT>' <EOL> WM_PNG_FILENAME = '<STR_LIT>' <EOL> WM_JPG_FILENAME = '<STR_LIT>' <EOL> BUILD_FOLDER = os . path . join ( FILES_PATH , ...
<s> import arcrest . admin <EOL> arcrest . admin . cmdline . importcache ( ) </s>
<s> import sys <EOL> from six . moves import reload_module <EOL> from mock import Mock <EOL> import ubersmith <EOL> def it_sets_default_request_handler ( monkeypatch ) : <EOL> set_handler_mock = Mock ( ) <EOL> monkeypatch . setattr ( ubersmith , '<STR_LIT>' , <EOL> set_handler_mock ) <EOL> ubersmith . init ( '<STR_LIT>...
<s> from blog import app <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( debug = True ) </s>
<s> """<STR_LIT>""" <EOL> NULL = b'<STR_LIT:\x00>' <EOL> def input_prompt ( prompt ) : <EOL> """<STR_LIT>""" <EOL> return input ( prompt ) <EOL> def decode ( byte_data ) : <EOL> """<STR_LIT>""" <EOL> if byte_data is None : <EOL> return None <EOL> return byte_data . decode ( ) <EOL> def encode ( char_data ) : <EOL> """<...
<s> try : <EOL> from configparser import RawConfigParser <EOL> except ImportError : <EOL> from ConfigParser import RawConfigParser <EOL> import logging <EOL> import os <EOL> import re <EOL> import socket <EOL> import threading <EOL> from stomp . backward import * <EOL> log = logging . getLogger ( '<STR_LIT>' ) <EOL> co...
<s> """<STR_LIT>""" <EOL> class Mic : <EOL> prev = None <EOL> def __init__ ( self , speaker , passive_stt_engine , active_stt_engine ) : <EOL> return <EOL> def passiveListen ( self , PERSONA ) : <EOL> return True , "<STR_LIT>" <EOL> def activeListenToAllOptions ( self , THRESHOLD = None , LISTEN = True , <EOL> MUSIC = ...
<s> import numpy as np <EOL> import scipy . signal <EOL> def sigmoid ( x ) : <EOL> return <NUM_LIT:1> / ( <NUM_LIT:1> + np . exp ( - x ) ) <EOL> def cnn_convolve ( patch_dim , num_features , images , W , b , zca_white , patch_mean ) : <EOL> """<STR_LIT>""" <EOL> num_images = images . shape [ <NUM_LIT:3> ] <EOL> image_d...
<s> """<STR_LIT>""" <EOL> import httplib <EOL> import base64 <EOL> import json <EOL> import decimal <EOL> import urlparse <EOL> import errno <EOL> USER_AGENT = "<STR_LIT>" <EOL> HTTP_TIMEOUT = <NUM_LIT:30> <EOL> class JSONRPCException ( Exception ) : <EOL> def __init__ ( self , rpcError ) : <EOL> Exception . __init__ (...
<s> import logging <EOL> log = logging . getLogger ( __name__ ) <EOL> import io <EOL> import struct <EOL> from uuid import UUID <EOL> from record import Record <EOL> from error import * <EOL> class BluetoothConfigRecord ( Record ) : <EOL> def __init__ ( self , record = None ) : <EOL> Record . __init__ ( self , '<STR_LI...
<s> from setuptools import setup <EOL> setup ( name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> license = '<STR_LIT>' , <EOL> keywords = "<STR_LIT>" , <EOL> author_email = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> scripts = [ '<STR_LIT>' , '<STR...
<s> """<STR_LIT>""" <EOL> import hashlib <EOL> import json <EOL> import os <EOL> from functools import wraps <EOL> import six . moves . http_client as httplib <EOL> import httplib2 <EOL> try : <EOL> from flask import Blueprint <EOL> from flask import _app_ctx_stack <EOL> from flask import current_app <EOL> from flask i...
<s> from pyasn1 . type import tag , namedtype , namedval , univ , constraint <EOL> from pyasn1_modules . rfc2459 import * <EOL> from pyasn1_modules import rfc2251 <EOL> class KeyEncryptionAlgorithms ( AlgorithmIdentifier ) : pass <EOL> class PrivateKeyAlgorithms ( AlgorithmIdentifier ) : pass <EOL> class EncryptedData ...
<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import , unicode_literals <EOL> import environ <EOL> ROOT_DIR = environ . Path ( __file__ ) - <NUM_LIT:3> <EOL> APPS_DIR = ROOT_DIR . path ( '<STR_LIT>' ) <EOL> env = environ . Env ( ) <EOL> DJANGO_APPS = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT...
<s> from __future__ import unicode_literals <EOL> from django . conf . urls import url <EOL> from django . views . generic import TemplateView <EOL> from . import views <EOL> urlpatterns = [ <EOL> url ( r'<STR_LIT>' , views . ProjectListView . as_view ( ) , name = "<STR_LIT:list>" ) , <EOL> url ( r'<STR_LIT>' , views ....
<s> from future . standard_library import install_aliases <EOL> install_aliases ( ) <EOL> """<STR_LIT>""" <EOL> import itertools <EOL> import sys <EOL> from past . builtins import basestring <EOL> from . utils import termsize <EOL> class FakedResult ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , items ,...
<s> import sys <EOL> from authority . sites import site , get_check , get_choices_for , register , unregister <EOL> LOADING = False <EOL> def autodiscover ( ) : <EOL> """<STR_LIT>""" <EOL> global LOADING <EOL> if LOADING : <EOL> return <EOL> LOADING = True <EOL> import imp <EOL> from django . conf import settings <EOL>...
<s> import os <EOL> from setuptools import setup , find_packages <EOL> def read ( fname ) : <EOL> return open ( os . path . join ( os . path . dirname ( __file__ ) , fname ) ) . read ( ) <EOL> setup ( <EOL> name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> description = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL...
<s> from datetime import datetime , date , time <EOL> from decimal import Decimal <EOL> import hashlib <EOL> from operator import itemgetter <EOL> from django import forms , VERSION <EOL> from django . conf . urls import url <EOL> from django . contrib import admin , messages <EOL> from django . contrib . admin import ...
<s> from django . test import TestCase <EOL> from constance import settings <EOL> from tests . storage import StorageTestsMixin <EOL> class TestDatabase ( StorageTestsMixin , TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestDatabase , self ) . setUp ( ) <EOL> self . old_backend = settings . BACKEND <EOL> setti...
<s> from django . conf import settings <EOL> from django . core . exceptions import ImproperlyConfigured , DisallowedHost <EOL> from django . core . urlresolvers import NoReverseMatch , set_urlconf , get_urlconf <EOL> from . resolvers import get_host_patterns , get_host <EOL> class HostsBaseMiddleware ( object ) : <EOL...
<s> from mongonaut . sites import MongoAdmin <EOL> from articles . models import Post , User , NewUser <EOL> class PostAdmin ( MongoAdmin ) : <EOL> def has_view_permission ( self , request ) : <EOL> return True <EOL> def has_edit_permission ( self , request ) : <EOL> return True <EOL> def has_add_permission ( self , re...
<s> from django import template <EOL> from django . core . urlresolvers import reverse <EOL> from django . utils . safestring import mark_safe <EOL> from bson . objectid import ObjectId <EOL> from mongoengine import Document <EOL> from mongoengine . fields import URLField <EOL> register = template . Library ( ) <EOL> @...
<s> from __future__ import unicode_literals <EOL> import os <EOL> import collections <EOL> import shlex <EOL> from django . conf import settings as _settings <EOL> try : <EOL> from django . core . signals import setting_changed <EOL> except ImportError : <EOL> from django . test . signals import setting_changed <EOL> f...
<s> import os <EOL> from django . conf import settings <EOL> from django . utils import six <EOL> try : <EOL> from django . test import override_settings <EOL> except ImportError : <EOL> from django . test . utils import override_settings <EOL> def _ ( path ) : <EOL> return path . replace ( '<STR_LIT:/>' , os . sep ) ....
<s> import re <EOL> from os import path <EOL> from setuptools import setup , find_packages <EOL> def read ( * parts ) : <EOL> return open ( path . join ( path . dirname ( __file__ ) , * parts ) ) . read ( ) <EOL> def find_version ( * file_paths ) : <EOL> version_file = read ( * file_paths ) <EOL> version_match = re . s...
<s> """<STR_LIT>""" <EOL> from cgi import parse_header <EOL> from datetime import datetime <EOL> from difflib import get_close_matches <EOL> from email import message_from_string <EOL> from copy import copy <EOL> import re <EOL> try : <EOL> set <EOL> except NameError : <EOL> from sets import Set as set <EOL> import tim...
<s> import os <EOL> import nose <EOL> import django <EOL> NAME = os . path . basename ( os . path . dirname ( __file__ ) ) <EOL> ROOT = os . path . abspath ( os . path . dirname ( __file__ ) ) <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> os . environ [ '<STR_LIT>' ] = os . pathsep . join ( [ ROOT , <EOL> os ....
<s> from django . core . management import call_command <EOL> from celery import shared_task <EOL> @ shared_task <EOL> def syncldap ( ) : <EOL> """<STR_LIT>""" <EOL> call_command ( '<STR_LIT>' ) </s>
<s> import logging <EOL> from django . conf import settings <EOL> from django . contrib import messages <EOL> from django . contrib . auth import login <EOL> from django . http import HttpResponse <EOL> from django . utils . translation import ugettext as _ <EOL> from django . views . generic import FormView <EOL> from...
<s> from south . utils import datetime_utils as datetime <EOL> from south . db import db <EOL> from south . v2 import SchemaMigration <EOL> from django . db import models <EOL> class Migration ( SchemaMigration ) : <EOL> def forwards ( self , orm ) : <EOL> orm . RemoteStorage . objects . all ( ) . delete ( ) <EOL> db ....
<s> from __future__ import print_function <EOL> import textwrap <EOL> try : <EOL> import cPickle as pickle <EOL> except ImportError : <EOL> import pickle <EOL> import re <EOL> from vbox import Voicebox <EOL> class Writer ( object ) : <EOL> voicebox = Voicebox ( ) <EOL> cursor = "<STR_LIT:|>" <EOL> def write ( self , vb...
<s> import unittest <EOL> from webfinger import finger , WebFingerClient , WebFingerResponse <EOL> class TestHostParsing ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . client = WebFingerClient ( ) <EOL> def test_parsing ( self ) : <EOL> host = self . client . _parse_host ( '<STR_LIT>' ) <EOL> self . ...
<s> """<STR_LIT>""" <EOL> from django . template import Context , Template <EOL> from analytical . templatetags import analytical <EOL> from analytical . tests . utils import TagTestCase <EOL> class AnalyticsTagTestCase ( TagTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> super ( AnalyticsTagTestCas...
<s> import sys , os , datetime <EOL> sys . path . append ( os . path . abspath ( '<STR_LIT>' ) ) <EOL> extensions = [ ] <EOL> templates_path = [ '<STR_LIT>' ] <EOL> source_suffix = '<STR_LIT>' <EOL> master_doc = '<STR_LIT:index>' <EOL> project = u'<STR_LIT>' <EOL> copyright = u'<STR_LIT>' % datetime . datetime . now ( ...
<s> """<STR_LIT>""" <EOL> import random <EOL> from fms import agents <EOL> from fms . utils import BUY , SELL <EOL> from fms . utils . exceptions import MissingParameter <EOL> class ZigFastTrader ( agents . Agent ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , params , offset = <NUM_LIT:0> ) : <EOL> agents . Agen...
<s> import sublime , sublime_plugin , webbrowser <EOL> from . src . bootstrap import * <EOL> from . src import completions , events , utils <EOL> class CfmlEventListener ( sublime_plugin . EventListener ) : <EOL> def on_load_async ( self , view ) : <EOL> events . trigger ( '<STR_LIT>' , view ) <EOL> def on_close ( self...
<s> event_listeners = { } <EOL> def subscribe ( event_name , callback ) : <EOL> if event_name not in event_listeners : <EOL> event_listeners [ event_name ] = [ ] <EOL> event_listeners [ event_name ] . append ( callback ) <EOL> def trigger ( event_name , * event_args ) : <EOL> if event_name in event_listeners : <EOL> fo...
<s> import sublime , json , urllib <EOL> from . . import utils <EOL> from . . inline_documentation import Documentation <EOL> CFDOCS_PARAM_TEMPLATE = '<STR_LIT>' <EOL> CFDOCS_BASE_URL = "<STR_LIT>" <EOL> CFDOCS_STYLES = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>...
<s> from extractors import get_extractor </s>
<s> """<STR_LIT>""" <EOL> from email import MIMEBase <EOL> from email import MIMEMultipart <EOL> from email import MIMEText <EOL> import mimetypes <EOL> import types <EOL> from google . appengine . api import api_base_pb <EOL> from google . appengine . api import apiproxy_stub_map <EOL> from google . appengine . api im...
<s> """<STR_LIT>""" <EOL> import sys <EOL> from google . net . proto import ProtocolBuffer <EOL> from google . appengine import runtime <EOL> from google . appengine . runtime import apiproxy_errors <EOL> from google3 . apphosting . runtime import _apphosting_runtime___python__apiproxy <EOL> OK = <NUM_LIT:0> <EOL> RPC_...
<s> import csv <EOL> import json <EOL> import os <EOL> import StringIO <EOL> import tempfile <EOL> import unittest <EOL> import parquet <EOL> class TestFileFormat ( unittest . TestCase ) : <EOL> def test_header_magic_bytes ( self ) : <EOL> with tempfile . NamedTemporaryFile ( ) as t : <EOL> t . write ( "<STR_LIT>" ) <E...
<s> from math import log <EOL> from exceptions import MelopyGenericError , MelopyValueError <EOL> def key_to_frequency ( key ) : <EOL> """<STR_LIT>""" <EOL> return <NUM_LIT> * <NUM_LIT:2> ** ( ( key - <NUM_LIT> ) / <NUM_LIT> ) <EOL> def key_to_note ( key , octaves = True ) : <EOL> """<STR_LIT>""" <EOL> notes = [ '<STR_...
<s> from twisted . internet import defer <EOL> def got_results ( res ) : <EOL> print '<STR_LIT>' , res <EOL> print '<STR_LIT>' <EOL> d1 = defer . Deferred ( ) <EOL> d2 = defer . Deferred ( ) <EOL> d = defer . DeferredList ( [ d1 , d2 ] ) <EOL> print '<STR_LIT>' <EOL> d . addCallback ( got_results ) <EOL> print '<STR_LI...
<s> from twisted . internet . defer import Deferred <EOL> def got_poem ( res ) : <EOL> print '<STR_LIT>' <EOL> print res <EOL> def poem_failed ( err ) : <EOL> print '<STR_LIT>' <EOL> d = Deferred ( ) <EOL> d . addCallbacks ( got_poem , poem_failed ) <EOL> d . callback ( '<STR_LIT>' ) <EOL> print "<STR_LIT>" </s>
<s> import os , json , sublime <EOL> def get_rc_paths ( cwd ) : <EOL> result = [ ] <EOL> subs = cwd . split ( os . sep ) <EOL> fullPath = "<STR_LIT>" <EOL> for value in subs : <EOL> fullPath += value + os . sep <EOL> result . append ( fullPath + '<STR_LIT>' ) <EOL> return result <EOL> def filter_existing_files ( paths ...
<s> """<STR_LIT>""" <EOL> from fisica import Fisica , FWorld , FPoly , FBlob <EOL> world = None <EOL> xPos = <NUM_LIT:0> <EOL> circleCount = <NUM_LIT:20> <EOL> hole = <NUM_LIT:50> <EOL> topMargin = <NUM_LIT:50> <EOL> bottomMargin = <NUM_LIT> <EOL> sideMargin = <NUM_LIT:100> <EOL> def setup ( ) : <EOL> global world <EOL...
<s> class MovingBall ( object ) : <EOL> def __init__ ( self , xOffset , yOffset , x , y , speed , unit ) : <EOL> self . xOffset = xOffset <EOL> self . yOffset = yOffset <EOL> self . x = x <EOL> self . y = y <EOL> self . speed = speed <EOL> self . unit = unit <EOL> self . xDirection = <NUM_LIT:1> <EOL> self . yDirection...
<s> from shape3d import Shape3D <EOL> class Icosahedron ( Shape3D ) : <EOL> def __init__ ( self , radius = <NUM_LIT> ) : <EOL> Shape3D . __init__ ( self ) <EOL> self . topPent = [ PVector ( ) for _ in range ( <NUM_LIT:5> ) ] <EOL> self . bottomPent = [ PVector ( ) for _ in range ( <NUM_LIT:5> ) ] <EOL> c = dist ( cos (...
<s> import ast <EOL> class Program_info ( ) : <EOL> def __init__ ( self ) : <EOL> self . found_settings = False <EOL> self . found_setup = False <EOL> self . size = False <EOL> self . fullScreen = False <EOL> self . noSmooth = False <EOL> self . smooth = False <EOL> self . pixelDensity = False <EOL> def insert ( self ,...
<s> from functools import partial <EOL> from os . path import dirname <EOL> from nose . tools import raises , eq_ , ok_ <EOL> from . context import taxon , benchmark <EOL> from taxon import MemoryTaxon , RedisTaxon <EOL> from taxon . query import * <EOL> TestRedisTaxon = partial ( RedisTaxon , '<STR_LIT>' , '<STR_LIT:t...
<s> """<STR_LIT>""" <EOL> from django . contrib . sitemaps import Sitemap <EOL> from . models import Gallery , Photo <EOL> class GallerySitemap ( Sitemap ) : <EOL> def items ( self ) : <EOL> return Gallery . objects . on_site ( ) . is_public ( ) <EOL> def lastmod ( self , obj ) : <EOL> return obj . date_added <EOL> cla...
<s> import os <EOL> import sys <EOL> import tempfile <EOL> from twisted . trial import unittest <EOL> from twisted . python import util <EOL> from comet . icomet import IHandler <EOL> from comet . handler import SpawnCommand <EOL> SHELL = '<STR_LIT>' <EOL> class DummyEvent ( object ) : <EOL> def __init__ ( self , text ...
<s> from twisted . python import usage <EOL> from comet import BINARY_TYPE <EOL> from comet . utility . voevent import parse_ivorn <EOL> __all__ = [ "<STR_LIT>" ] <EOL> class BaseOptions ( usage . Options ) : <EOL> optParameters = [ <EOL> [ "<STR_LIT>" , None , None , "<STR_LIT>" ] <EOL> ] <EOL> def opt_local_ivo ( sel...
<s> from config import Config <EOL> import time <EOL> from collections import deque <EOL> from twisted . internet import reactor <EOL> class Channel ( object ) : <EOL> id = property ( lambda self : self . _id ) <EOL> max_messages = property ( lambda self : self . _max_messages ) <EOL> def __init__ ( self , id , max_mes...
<s> '''<STR_LIT>''' <EOL> import hashlib <EOL> def calculate_md5 ( item , block_size = <NUM_LIT> * <NUM_LIT> , hr = False ) : <EOL> '''<STR_LIT>''' <EOL> md5 = hashlib . md5 ( ) <EOL> for chunk in iter ( lambda : item . read ( block_size ) , b'<STR_LIT>' ) : <EOL> md5 . update ( chunk ) <EOL> if hr : <EOL> return md5 ....
<s> '''<STR_LIT>''' <EOL> ROOT = '<STR_LIT>' <EOL> HOST = '<STR_LIT:localhost>' <EOL> PORT_REDIS = <NUM_LIT> <EOL> DB_USERNAME = '<STR_LIT>' <EOL> DB_PASSWORD = '<STR_LIT:password>' <EOL> DB_LOG_PATH = ROOT + '<STR_LIT>' <EOL> LOG_LEVEL = '<STR_LIT>' <EOL> ERROR_LOG_PATH = ROOT + '<STR_LIT>' <EOL> WARNING_LOG_PATH = RO...
<s> from unittest import TestCase <EOL> from . . scent_picker import load_file <EOL> from . . scanner . base import BaseScanner <EOL> class ScentModuleTest ( TestCase ) : <EOL> def test_set_runner_and_get_runner_methods ( self ) : <EOL> scent = load_file ( '<STR_LIT>' ) <EOL> self . assertEqual ( scent . get_runners ( ...
<s> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] </s>
<s> from __future__ import with_statement <EOL> from blinker import Signal <EOL> def test_temp_connection ( ) : <EOL> sig = Signal ( ) <EOL> canary = [ ] <EOL> receiver = lambda sender : canary . append ( sender ) <EOL> sig . send ( <NUM_LIT:1> ) <EOL> with sig . connected_to ( receiver ) : <EOL> sig . send ( <NUM_LIT:...
<s> import sys <EOL> from types import ModuleType <EOL> __all__ = [ '<STR_LIT>' ] <EOL> class deferred_module ( ModuleType ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def shadow ( cls , module_name , deferred , ** attributes ) : <EOL> """<STR_LIT>""" <EOL> module = sys . modules [ module_name ] <EOL> sys . modu...
<s> from flatland import ( <EOL> Array , <EOL> Dict , <EOL> Integer , <EOL> MultiValue , <EOL> String , <EOL> ) <EOL> from tests . _util import eq_ , assert_raises <EOL> def test_set_flat_pruned ( ) : <EOL> sub = String . named ( u'<STR_LIT:s>' ) <EOL> pairs = [ ( u'<STR_LIT:s>' , u'<STR_LIT>' ) , ( u'<STR_LIT:s>' , '<...
<s> __doc__ = "<STR_LIT>" <EOL> import os <EOL> import sys <EOL> quiet = False <EOL> is_quick_start = False <EOL> root_dir = os . path . abspath ( os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , "<STR_LIT:..>" ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . join ( root_dir , "<ST...
<s> import sys <EOL> import psycopg2 <EOL> import argparse <EOL> import os <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( "<STR_LIT>" , type = int ) <EOL> parser . add_argument ( "<STR_LIT>" , type = int ) <EOL> arguments = parser . parse_args ( ) <EOL> os . setgid ( arguments . gid ) <EOL> ...
<s> __doc__ = "<STR_LIT>" <EOL> import sqlite <EOL> import data </s>
<s> import api <EOL> class FilterError ( api . APIError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Filter ( api . APIObject ) : <EOL> """<STR_LIT>""" <EOL> @ property <EOL> def subject ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _impl . getSubject ( self . critic ) <EOL> @ property <EOL> def type ( self ...
<s> import os <EOL> import base64 <EOL> import re <EOL> import configuration <EOL> import dbutils <EOL> class CheckFailed ( Exception ) : pass <EOL> class NoSuchUser ( CheckFailed ) : pass <EOL> class WrongPassword ( CheckFailed ) : pass <EOL> def createCryptContext ( ) : <EOL> try : <EOL> from passlib . context import...
<s> import gitutils <EOL> import stat <EOL> def joinPaths ( dirname , basename ) : <EOL> return "<STR_LIT>" % ( dirname , basename ) if dirname else basename <EOL> class ChangedPath : <EOL> def __init__ ( self , path , oldEntry , newEntry ) : <EOL> self . path = path <EOL> self . oldEntry = oldEntry <EOL> self . newEnt...
<s> import os <EOL> import subprocess <EOL> import pwd <EOL> import dbutils <EOL> import htmlutils <EOL> from extensions . manifest import Manifest , ManifestError <EOL> from extensions import getExtensionInstallPath <EOL> class ExtensionError ( Exception ) : <EOL> def __init__ ( self , message , extension = None ) : <...
<s> import gitutils <EOL> class CommitSet : <EOL> def __init__ ( self , commits ) : <EOL> self . __commits = dict ( [ ( str ( commit ) , commit ) for commit in commits ] ) <EOL> self . __merges = set ( ) <EOL> self . __children = { } <EOL> parents = set ( ) <EOL> for commit in self . __commits . values ( ) : <EOL> for ...
<s> import dbutils <EOL> import gitutils <EOL> import reviewing . mail as review_mail <EOL> import mailutils <EOL> from operation import Operation , OperationResult , OperationError , Optional <EOL> class CloseReview ( Operation ) : <EOL> def __init__ ( self ) : <EOL> Operation . __init__ ( self , { "<STR_LIT>" : int }...
<s> import urllib <EOL> import page <EOL> import page . utils <EOL> import auth <EOL> import configuration <EOL> import request <EOL> from page . parameters import Optional <EOL> class LoginHandler ( page . Page . Handler ) : <EOL> def __init__ ( self , target = "<STR_LIT:/>" , optional = "<STR_LIT>" ) : <EOL> super ( ...
<s> import time <EOL> import configuration <EOL> import gitutils <EOL> def timestamp ( ts ) : <EOL> return time . strftime ( "<STR_LIT>" , ts ) <EOL> def createEquivalentMergeCommit ( db , review , user , old_head , old_upstream , new_head , new_upstream , onto_branch = None ) : <EOL> repository = review . repository <...
<s> import sys <EOL> import os <EOL> import argparse <EOL> import logging <EOL> import re <EOL> import subprocess <EOL> import traceback <EOL> import time <EOL> import datetime <EOL> import testing <EOL> class Counters : <EOL> def __init__ ( self ) : <EOL> self . tests_run = <NUM_LIT:0> <EOL> self . tests_failed = <NUM...
<s> with frontend . signin ( ) : <EOL> frontend . page ( <EOL> "<STR_LIT>" , <EOL> expect = { "<STR_LIT>" : testing . expect . document_title ( u"<STR_LIT>" ) , <EOL> "<STR_LIT>" : testing . expect . paleyellow_title ( <NUM_LIT:0> , u"<STR_LIT>" ) , <EOL> "<STR_LIT>" : testing . expect . pageheader_links ( "<STR_LIT>" ...
<s> import re <EOL> COMMIT_SHA1 = "<STR_LIT>" <EOL> REVIEW_SUMMARY = "<STR_LIT>" <EOL> with frontend . signin ( "<STR_LIT>" ) : <EOL> document = frontend . page ( <EOL> "<STR_LIT>" , <EOL> params = { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : COMMIT_SHA1 } ) <EOL> scripts = document . findAll ( "<STR_LIT>" ) <EOL>...
<s> import os <EOL> FILENAME = "<STR_LIT>" <EOL> FILENAME_BASE = "<STR_LIT>" <EOL> NONSENSE = """<STR_LIT>""" <EOL> def lines ( * args ) : <EOL> return "<STR_LIT:\n>" . join ( ( line . upper ( ) if index in args else line ) <EOL> for index , line in enumerate ( NONSENSE . splitlines ( ) ) ) <EOL> def to ( name ) : <EOL...
<s> import os <EOL> with_class = testing . expect . with_class <EOL> extract_text = testing . expect . extract_text <EOL> def check_echo_filter_type ( document ) : <EOL> filterdialog = document . find ( "<STR_LIT>" , attrs = with_class ( "<STR_LIT>" ) ) <EOL> type_select = filterdialog . find ( "<STR_LIT>" , attrs = { ...
<s> """<STR_LIT>""" <EOL> import random <EOL> from math import sqrt , sin , cos , pi <EOL> class Point ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , value ) : <EOL> if isinstance ( value , complex ) : <EOL> self . value = value <EOL> elif isinstance ( value , ( tuple , list ) ) : <EOL> self . value = v...
<s> from pylab import * <EOL> from numpy import * <EOL> from pygraph . classes . digraph import digraph <EOL> from pygraph . algorithms . minmax import maximum_flow <EOL> from PCV . classifiers import bayes <EOL> """<STR_LIT>""" <EOL> def build_bayes_graph ( im , labels , sigma = <NUM_LIT> , kappa = <NUM_LIT:1> ) : <EO...
<s> from PIL import Image <EOL> from pylab import * <EOL> from numpy import * <EOL> from PCV . tools import imtools , pca <EOL> imlist = imtools . get_imlist ( '<STR_LIT>' ) <EOL> im = array ( Image . open ( imlist [ <NUM_LIT:0> ] ) ) <EOL> m , n = im . shape [ : <NUM_LIT:2> ] <EOL> immatrix = array ( [ array ( Image ....
<s> from __future__ import unicode_literals <EOL> from django . db import models , migrations <EOL> import django . utils . timezone <EOL> from django . conf import settings <EOL> class Migration ( migrations . Migration ) : <EOL> dependencies = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ] <EOL> operations = [ <EOL>...
<s> import re <EOL> import sys <EOL> from types import NoneType <EOL> class Element ( object ) : <EOL> """<STR_LIT>""" <EOL> self_closing_tags = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:input>' , '<STR_LIT:source>' , '<STR_LIT>' ) <EOL> ELEMENT = '<STR_LIT:%>' <EOL> ID = '<STR_L...
<s> """<STR_LIT>""" <EOL> from cheddar . index . index import Index <EOL> from cheddar . index . local import LocalIndex <EOL> from cheddar . index . remote import CachedRemoteIndex <EOL> class CombinedIndex ( Index ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , app ) : <EOL> self . local = LocalIndex ( app ) <E...
<s> '''<STR_LIT>''' <EOL> from . import Payload <EOL> class RestrictionsPayload ( Payload ) : <EOL> payload_type = '<STR_LIT>' <EOL> def __init__ ( self , identifier , uuid = None , ** kwargs ) : <EOL> Payload . __init__ ( self , self . payload_type , identifier , uuid , ** kwargs ) </s>
<s> """<STR_LIT>""" <EOL> from django . db import connection <EOL> from django . db import models <EOL> from django . utils . datastructures import SortedDict <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . contrib import comments <EOL> class CommentedObjectManager ( models . ...