code
stringlengths
9
256k
<s> try : <EOL> import paramiko <EOL> from boto . manage . cmdshell import SSHClient <EOL> except ImportError : <EOL> paramiko = None <EOL> SSHClient = None <EOL> from tests . compat import mock , unittest <EOL> class TestSSHTimeout ( unittest . TestCase ) : <EOL> @ unittest . skipIf ( not paramiko , '<STR_LIT>' ) <EOL...
<s> from tests . unit import unittest <EOL> import boto . swf . layer1_decisions <EOL> class TestDecisions ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . decisions = boto . swf . layer1_decisions . Layer1Decisions ( ) <EOL> def assert_data ( self , * data ) : <EOL> self . assertEquals ( self . decisi...
<s> from botocore import xform_name <EOL> from botocore . docs . method import get_instance_public_methods <EOL> from botocore . docs . utils import DocumentedShape <EOL> from boto3 . docs . base import BaseDocumenter <EOL> from boto3 . docs . utils import get_resource_ignore_params <EOL> from boto3 . docs . method imp...
<s> import random <EOL> import sys <EOL> import time <EOL> from botocore . compat import six <EOL> if sys . version_info [ : <NUM_LIT:2> ] == ( <NUM_LIT:2> , <NUM_LIT:6> ) : <EOL> import unittest2 as unittest <EOL> else : <EOL> import unittest <EOL> if sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> : <EOL> import mo...
<s> import os <EOL> import mock <EOL> import boto3 <EOL> from tests . unit . docs import BaseDocsTest <EOL> from boto3 . docs . service import ServiceDocumenter <EOL> class TestServiceDocumenter ( BaseDocsTest ) : <EOL> def test_document_service ( self ) : <EOL> service_documenter = ServiceDocumenter ( '<STR_LIT>' , se...
<s> class ArgumentError ( ValueError ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> class ClientError ( Exception ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> class AuthError ( ClientError ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> class TimeoutError ( ClientError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class ServiceInitE...
<s> from setuptools import setup <EOL> required_modules = [ ] <EOL> setup ( name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> install_requires = required_modules , <EOL> license = '<STR_LIT...
<s> from boundary import HostGroupModify <EOL> class HostGroupCreate ( HostGroupModify ) : <EOL> def __init__ ( self , update ) : <EOL> HostGroupModify . __init__ ( self , False ) <EOL> self . path = "<STR_LIT>" <EOL> self . sources = None <EOL> def getDescription ( self ) : <EOL> return "<STR_LIT>" </s>
<s> from boundary import ApiCli <EOL> class PluginList ( ApiCli ) : <EOL> def __init__ ( self ) : <EOL> ApiCli . __init__ ( self ) <EOL> self . path = "<STR_LIT>" <EOL> def addArguments ( self ) : <EOL> ApiCli . addArguments ( self ) <EOL> def getDescription ( self ) : <EOL> return "<STR_LIT>" </s>
<s> '''<STR_LIT>''' <EOL> __author__ = "<STR_LIT>" <EOL> __copyright__ = "<STR_LIT>" <EOL> __license__ = "<STR_LIT>" <EOL> from geoserver . support import ResourceInfo , xml_property , write_bool , url <EOL> from geoserver . style import Style <EOL> class _attribution ( object ) : <EOL> def __init__ ( self , title , wi...
<s> from app . util . log import get_logger <EOL> from app . util . shell . shell_client_factory import ShellClientFactory <EOL> class RemoteService ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , host , username , executable_path ) : <EOL> """<STR_LIT>""" <EOL> self . _logger = get_logger ( __name__ ) <...
<s> import functools <EOL> from app . master . cluster_master import ClusterMaster <EOL> from app . subcommands . service_subcommand import ServiceSubcommand <EOL> from app . util import analytics , log <EOL> from app . util . conf . configuration import Configuration <EOL> from app . web_framework . cluster_master_app...
<s> from contextlib import suppress <EOL> import os <EOL> import subprocess <EOL> import time <EOL> SIGINFO = <NUM_LIT> <EOL> def kill_gracefully ( process , timeout = <NUM_LIT:2> ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> with suppress ( ProcessLookupError ) : <EOL> process . terminate ( ) <EOL> stdout , stderr = pro...
<s> import tokenize <EOL> from pylint . checkers import BaseChecker <EOL> from pylint . interfaces import ITokenChecker <EOL> class ClusterRunnerTokenChecker ( BaseChecker ) : <EOL> """<STR_LIT>""" <EOL> __implements__ = ITokenChecker <EOL> name = '<STR_LIT>' <EOL> msgs = { <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' , <EO...
<s> import builtins <EOL> import http . client <EOL> from threading import Event <EOL> from unittest import skip <EOL> from unittest . mock import ANY , call , MagicMock , Mock , mock_open , patch <EOL> from genty import genty , genty_dataset <EOL> import requests <EOL> import requests . models <EOL> from app . project...
<s> from __future__ import unicode_literals <EOL> from . rotunicode import RotUnicode <EOL> from . utils import ruencode , rudecode </s>
<s> import sys <EOL> from codeop import CommandCompiler <EOL> from six import iteritems , text_type <EOL> from pygments . token import Generic , Token , Keyword , Name , Comment , String <EOL> from pygments . token import Error , Literal , Number , Operator , Punctuation <EOL> from pygments . token import Whitespace <E...
<s> import subprocess <EOL> import sys <EOL> import tempfile <EOL> from textwrap import dedent <EOL> from bpython import args <EOL> from bpython . test import FixLanguageTestCase as TestCase <EOL> try : <EOL> import unittest2 as unittest <EOL> except ImportError : <EOL> import unittest <EOL> try : <EOL> from nose . plu...
<s> import datetime <EOL> import hashlib <EOL> import hmac <EOL> import requests <EOL> import json <EOL> def sign ( key , msg ) : <EOL> return hmac . new ( key , msg . encode ( '<STR_LIT:utf-8>' ) , hashlib . sha256 ) . digest ( ) <EOL> def getSignatureKey ( key , dateStamp , regionName , serviceName ) : <EOL> kDate = ...
<s> import inspect <EOL> import datetime <EOL> import re <EOL> import six <EOL> from django . conf import settings <EOL> from django . contrib . auth import REDIRECT_FIELD_NAME <EOL> from django . contrib . auth . views import redirect_to_login , logout_then_login <EOL> from django . core . exceptions import Improperly...
<s> __author__ = '<STR_LIT>' <EOL> try : <EOL> from xml . etree import cElementTree as ElementTree <EOL> except ImportError : <EOL> try : <EOL> import cElementTree as ElementTree <EOL> except ImportError : <EOL> try : <EOL> from xml . etree import ElementTree <EOL> except ImportError : <EOL> from elementtree import Ele...
<s> import copy <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> try : <EOL> from django . utils import six <EOL> except ImportError : <EOL> import six <EOL> try : <EOL> import json <EOL> except ImportError : <EOL> from django . utils import simplejson as json...
<s> from __future__ import absolute_import , unicode_literals <EOL> import inspect <EOL> from functools import total_ordering <EOL> from itertools import chain <EOL> from django . db . models . fields import FieldDoesNotExist <EOL> from django . utils import six <EOL> from django . utils . html import escape <EOL> from...
<s> from django . core . paginator import EmptyPage , PageNotAnInteger <EOL> import pytest <EOL> from django_tables2 import Column , RequestConfig , Table <EOL> from fudge import Fake <EOL> from . utils import build_request <EOL> NOTSET = object ( ) <EOL> @ pytest . yield_fixture <EOL> def table ( ) : <EOL> yield ( Fak...
<s> import pytest <EOL> from goldsberry . _apifunctions import * <EOL> test_data = [ <EOL> ( _nbaLeague , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( _nbaLeague , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( _nbaLeague , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( _nbaSeason , <NUM_LIT> , '<STR_LIT>' ) , <EOL> ( _nbaSeason , <NUM_LIT> , ...
<s> from __future__ import unicode_literals <EOL> from django . test import TestCase <EOL> from django . test . utils import override_settings <EOL> from . . import settings as rs <EOL> TEST_SETTINGS = { <EOL> '<STR_LIT>' : '<STR_LIT:localhost>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> ...
<s> import usb . core <EOL> import usb . util <EOL> import errno <EOL> import logging <EOL> import struct <EOL> import array <EOL> _log = logging . getLogger ( "<STR_LIT>" ) <EOL> class UsbHardware ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , id_vendor = <NUM_LIT> , id_product = <NUM_LIT> , ep = <NUM_...
<s> import os <EOL> import sys <EOL> import braintree <EOL> from braintree . exceptions . configuration_error import ConfigurationError <EOL> from braintree . credentials_parser import CredentialsParser <EOL> from braintree . environment import Environment <EOL> class Configuration ( object ) : <EOL> """<STR_LIT>""" <E...
<s> from braintree . exceptions . http . connection_error import ConnectionError <EOL> from braintree . exceptions . http . invalid_response_error import InvalidResponseError <EOL> from braintree . exceptions . http . timeout_error import TimeoutError </s>
<s> import braintree <EOL> from braintree . apple_pay_card import ApplePayCard <EOL> from braintree . credit_card import CreditCard <EOL> from braintree . payment_method import PaymentMethod <EOL> from braintree . paypal_account import PayPalAccount <EOL> from braintree . europe_bank_account import EuropeBankAccount <E...
<s> import braintree <EOL> import warnings <EOL> from decimal import Decimal <EOL> from braintree . add_on import AddOn <EOL> from braintree . apple_pay_card import ApplePayCard <EOL> from braintree . coinbase_account import CoinbaseAccount <EOL> from braintree . android_pay_card import AndroidPayCard <EOL> from braint...
<s> from tests . test_helper import * <EOL> from braintree . test . nonces import Nonces <EOL> from braintree . credentials_parser import CredentialsParser <EOL> class TestCredentialsParser ( unittest . TestCase ) : <EOL> def test_parses_client_credentials ( self ) : <EOL> parser = CredentialsParser ( <EOL> client_id =...
<s> import json <EOL> from tests . test_helper import * <EOL> class TestClientToken ( unittest . TestCase ) : <EOL> def test_credit_card_options_require_customer_id ( self ) : <EOL> for option in [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] : <EOL> try : <EOL> client_token = ClientToken . generate ( { <EOL> "<STR_LIT>" ...
<s> from tests . test_helper import * <EOL> class TestSubscription ( unittest . TestCase ) : <EOL> def test_create_raises_exception_with_bad_keys ( self ) : <EOL> try : <EOL> Subscription . create ( { "<STR_LIT>" : "<STR_LIT:value>" } ) <EOL> self . assertTrue ( False ) <EOL> except KeyError as e : <EOL> self . assertE...
<s> __author__ = '<STR_LIT>' <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from sklearn . neighbors import NearestNeighbors <EOL> from scipy . spatial . distance import cdist <EOL> from scipy import linalg <EOL> import multiprocessing <EOL> def distance_matrix ( Xvals ) : <EOL> covar = np . cov...
<s> from django import template <EOL> register = template . Library ( ) <EOL> def beautify ( val , sep ) : <EOL> val = str ( val ) <EOL> if val != "<STR_LIT:.>" : val = val . replace ( '<STR_LIT:.>' , sep ) <EOL> if val . find ( sep ) == - <NUM_LIT:1> : val = val + sep + "<STR_LIT>" <EOL> elif len ( val . split ( sep )...
<s> from django import forms <EOL> from django . contrib . auth import get_user_model <EOL> from django . forms import widgets <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> class CommaSeparatedUserInput ( widgets . Input ) : <EOL> input_type = '<STR_LIT:text>' <EOL> def render ( self , name , ...
<s> from django . dispatch import Signal <EOL> signup_complete = Signal ( providing_args = [ "<STR_LIT:user>" , ] ) <EOL> activation_complete = Signal ( providing_args = [ "<STR_LIT:user>" , ] ) <EOL> confirmation_complete = Signal ( providing_args = [ "<STR_LIT:user>" , "<STR_LIT>" ] ) <EOL> password_complete = Signal...
<s> try : <EOL> from setuptools import setup <EOL> except ImportError : <EOL> from distutils . core import setup <EOL> setup ( name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> packages = {...
<s> from pyth . plugins . rtf15 . reader import Rtf15Reader <EOL> from pyth . plugins . pdf . writer import PDFWriter <EOL> doc = Rtf15Reader . read ( open ( "<STR_LIT>" ) ) <EOL> fontfile = "<STR_LIT>" <EOL> from reportlab . lib . styles import getSampleStyleSheet <EOL> from reportlab . pdfbase . pdfmetrics import reg...
<s> """<STR_LIT>""" <EOL> import BeautifulSoup <EOL> from pyth import document <EOL> from pyth . format import PythReader <EOL> from pyth . plugins . xhtml . css import CSS <EOL> class XHTMLReader ( PythReader ) : <EOL> @ classmethod <EOL> def read ( self , source , css_source = None , encoding = "<STR_LIT:utf-8>" , li...
<s> import sys , os <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>' <EOL> version = '<STR_LIT>' <EOL> release = '<STR_LIT>' <EOL> exclude_patterns = [ '<STR_LIT>' ] <EOL> pygm...
<s> import sys <EOL> import os <EOL> import errno <EOL> import random <EOL> import time <EOL> from datetime import timedelta <EOL> try : <EOL> from procname import setprocname <EOL> except ImportError : <EOL> def setprocname ( * args , ** kwargs ) : <EOL> pass <EOL> import socket <EOL> import signal <EOL> import traceb...
<s> from fabric . state import env <EOL> from fabric . api import sudo , settings <EOL> def post_install_postgresql ( ) : <EOL> """<STR_LIT>""" <EOL> from django . conf import settings as s <EOL> with settings ( warn_only = True ) : <EOL> sudo ( '<STR_LIT>' ) <EOL> sudo ( """<STR_LIT>""" % env . password , user = '<STR...
<s> from edfplus import load_edf </s>
<s> from exceptions import LockedOut <EOL> from utils import reset_attempts </s>
<s> import unittest <EOL> from flask import url_for <EOL> from yapper import create_app , db <EOL> from yapper . blueprints . user . models import Role , User <EOL> class UserFormTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . app = create_app ( '<STR_LIT:test>' ) <EOL> self . app_context = s...
<s> from django . conf import settings <EOL> TRUE_SETTINGS = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> START_TAG = getattr ( settings , "<STR_LIT>" , "<STR_LIT>" ) <EOL> END_TAG = getattr ( settings , "<STR_LIT>" , START_TAG ) <EOL> for setting in TRUE_SETTINGS : <EOL> locals ( ) [ setting ] = getattr ( s...
<s> import os <EOL> import shutil <EOL> import subprocess <EOL> import logging <EOL> from BroControl import py3bro <EOL> from BroControl import ssh_runner <EOL> from BroControl import util <EOL> def install ( src , dstdir , cmdout ) : <EOL> if not os . path . lexists ( src ) : <EOL> cmdout . error ( "<STR_LIT>" % src )...
<s> from flask import abort <EOL> from flask_views . base import View , TemplateResponseMixin <EOL> class SingleObjectMixin ( object ) : <EOL> """<STR_LIT>""" <EOL> document_class = None <EOL> """<STR_LIT>""" <EOL> get_fields = { <EOL> '<STR_LIT:id>' : '<STR_LIT:id>' , <EOL> } <EOL> """<STR_LIT>""" <EOL> context_object...
<s> from atomformat import Feed <EOL> from announcements . models import Announcement <EOL> class AnnouncementsBase ( Feed ) : <EOL> def items ( self ) : <EOL> return Announcement . objects . order_by ( "<STR_LIT>" ) [ : <NUM_LIT:10> ] <EOL> def item_title ( self , item ) : <EOL> return item . title <EOL> def item_cont...
<s> VERSION = ( <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , "<STR_LIT>" , <NUM_LIT:1> ) <EOL> def get_version ( ) : <EOL> if VERSION [ <NUM_LIT:3> ] == "<STR_LIT>" : <EOL> return "<STR_LIT>" % ( VERSION [ <NUM_LIT:0> ] , VERSION [ <NUM_LIT:1> ] , VERSION [ <NUM_LIT:2> ] ) <EOL> elif VERSION [ <NUM_LIT:3> ] == "<STR_LIT>"...
<s> from django . db import models <EOL> class Item ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:name>' ] </s>
<s> import Tkinter <EOL> def center_window ( app ) : <EOL> w = app . winfo_screenwidth ( ) <EOL> h = app . winfo_screenheight ( ) <EOL> rootsize = tuple ( int ( _ ) for _ in app . geometry ( ) . split ( '<STR_LIT:+>' ) [ <NUM_LIT:0> ] . split ( '<STR_LIT:x>' ) ) <EOL> x = w / <NUM_LIT:2> - rootsize [ <NUM_LIT:0> ] / <N...
<s> from __future__ import with_statement <EOL> import shutil <EOL> import tempfile <EOL> import os . path <EOL> import random <EOL> import string <EOL> try : <EOL> unicode <EOL> except NameError : <EOL> unicode = str <EOL> try : <EOL> xrange <EOL> except NameError : <EOL> xrange = range <EOL> def create_test_directory...
<s> """<STR_LIT>""" <EOL> from termsaverlib . screen . base . filereader import FileReaderBase <EOL> from termsaverlib import constants <EOL> from termsaverlib . i18n import _ <EOL> class ProgrammerScreen ( FileReaderBase ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> FileReaderBase...
<s> import fnmatch <EOL> import os . path <EOL> def get_real_metric_path ( absolute_path , metric_path ) : <EOL> if os . path . islink ( absolute_path ) : <EOL> real_fs_path = os . path . realpath ( absolute_path ) <EOL> relative_fs_path = metric_path . replace ( '<STR_LIT:.>' , os . sep ) <EOL> base_fs_path = absolute...
<s> __version_info__ = { <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : <NUM_LIT:3> , <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> <EOL> } <EOL> def get_version ( short = False ) : <EOL> assert __version_info__ [ '<STR_LIT>' ] in ( '<STR_LIT>' , '<STR_LIT>' ...
<s> EnsureSConsVersion ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> import os <EOL> import inspect <EOL> import platform <EOL> def get_cuda_paths ( ) : <EOL> """<STR_LIT>""" <EOL> if os . name == '<STR_LIT>' : <EOL> bin_path = '<STR_LIT>' <EOL> lib_path = '<STR_LIT>' <EOL> inc_path = '<STR_LIT>' <EOL> elif os . name == '<STR_LI...
<s> import copy <EOL> class SelectiveUnimplementer ( object ) : <EOL> def __init__ ( self , base , deletions ) : <EOL> self . _base = base <EOL> self . _deletions = deletions <EOL> def unimplemented ( self , * args , ** kwargs ) : <EOL> raise NotImplementedError <EOL> def __getattr__ ( self , name ) : <EOL> if name not...
<s> from copperhead import * <EOL> import numpy as np <EOL> import unittest <EOL> from create_tests import create_tests <EOL> from recursive_equal import recursive_equal <EOL> @ cu <EOL> def test_repl ( x , n ) : <EOL> return replicate ( x , n ) <EOL> @ cu <EOL> def test_internal_tuple_repl ( x , n ) : <EOL> return rep...
<s> class DefaultBackend ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . service = None <EOL> def prepare ( self , request , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> def authenticate ( self , request , ** kwargs ) : <EOL> """<STR_LIT>""" <EO...
<s> """<STR_LIT>""" <EOL> import Queue <EOL> import base64 <EOL> import json <EOL> import logging <EOL> import shutil <EOL> import socket <EOL> import ssl <EOL> import time <EOL> import urllib <EOL> import urllib2 <EOL> import gflags <EOL> FLAGS = gflags . FLAGS <EOL> import poster . encode <EOL> import poster . stream...
<s> """<STR_LIT>""" <EOL> import logging <EOL> import os <EOL> import sys <EOL> import threading <EOL> import gflags <EOL> FLAGS = gflags . FLAGS <EOL> from dpxdt . client import capture_worker <EOL> from dpxdt . client import fetch_worker <EOL> from dpxdt . client import pdiff_worker <EOL> from dpxdt . client import t...
<s> '''<STR_LIT>''' <EOL> import math <EOL> import numpy as np <EOL> import scipy . io <EOL> __author__ = """<STR_LIT>""" <EOL> def cosineDistance ( x , y ) : <EOL> '''<STR_LIT>''' <EOL> denom = math . sqrt ( sum ( x ** <NUM_LIT:2> ) * sum ( y ** <NUM_LIT:2> ) ) <EOL> dist = <NUM_LIT:1.0> - ( np . dot ( x , y . conj ( ...
<s> from werkzeug . security import generate_password_hash , check_password_hash <EOL> from itsdangerous import TimedJSONWebSignatureSerializer as Serializer <EOL> from flask import current_app <EOL> from flask . ext . login import UserMixin <EOL> from . import db , login_manager <EOL> class Role ( db . Model ) : <EOL>...
<s> __author__ = "<STR_LIT>" <EOL> __email__ = "<STR_LIT>" <EOL> from functools import wraps <EOL> from do_benchmark import benchmark <EOL> def memo ( func ) : <EOL> '''<STR_LIT>''' <EOL> cache = { } <EOL> @ wraps ( func ) <EOL> def wrap ( * args ) : <EOL> if args not in cache : <EOL> cache [ args ] = func ( * args ) <...
<s> __author__ = "<STR_LIT>" <EOL> from collections import Counter <EOL> def check_if_anagram ( word1 , word2 ) : <EOL> counter = Counter ( ) <EOL> for c in word1 : <EOL> counter [ c ] += <NUM_LIT:1> <EOL> for c in word2 : <EOL> counter [ c ] -= <NUM_LIT:1> <EOL> for values in counter . values ( ) : <EOL> if values != ...
<s> __author__ = "<STR_LIT>" <EOL> import pickle <EOL> def import_pickle ( filename ) : <EOL> fh = None <EOL> try : <EOL> fh = open ( filename , "<STR_LIT:rb>" ) <EOL> mydict2 = pickle . load ( fh ) <EOL> return mydict2 <EOL> except ( EnvironmentError ) as err : <EOL> print ( "<STR_LIT>" . format ( os . path . basename...
<s> __author__ = "<STR_LIT>" <EOL> import heapq <EOL> class PriorityQueue ( object ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self ) : <EOL> self . _queue = [ ] <EOL> self . _index = <NUM_LIT:0> <EOL> def push ( self , item , priority ) : <EOL> heapq . heappush ( self . _queue , ( - priority , self . _index , item ...
<s> __author__ = "<STR_LIT>" <EOL> '''<STR_LIT>''' <EOL> def print_prev_same_1s ( num ) : <EOL> n1s = find_num_1s ( num ) <EOL> i = num - <NUM_LIT:1> <EOL> while True : <EOL> n1s_here = find_num_1s ( i ) <EOL> if n1s_here == n1s : <EOL> return bin ( i ) <EOL> i -= <NUM_LIT:1> <EOL> if i < <NUM_LIT:0> : <EOL> return Non...
<s> __author__ = "<STR_LIT>" <EOL> from collections import Counter <EOL> def find_top_N_recurring_words ( seq , N ) : <EOL> '''<STR_LIT>''' <EOL> dcounter = Counter ( ) <EOL> for word in seq . split ( ) : <EOL> dcounter [ word ] += <NUM_LIT:1> <EOL> return dcounter . most_common ( N ) <EOL> if __name__ == '<STR_LIT:__m...
<s> __author__ = "<STR_LIT>" <EOL> import numpy <EOL> def searching_in_a_matrix ( m1 , value ) : <EOL> """<STR_LIT>""" <EOL> rows = len ( m1 ) <EOL> cols = len ( m1 [ <NUM_LIT:0> ] ) <EOL> lo = <NUM_LIT:0> <EOL> hi = rows * cols <EOL> while lo < hi : <EOL> mid = ( lo + hi ) // <NUM_LIT:2> <EOL> row = mid // cols <EOL> ...
<s> """<STR_LIT>""" <EOL> from threading import Thread <EOL> from flask import current_app , render_template <EOL> from flask . ext . mail import Message <EOL> from . import mail <EOL> def send_async_email ( app , msg ) : <EOL> with app . app_context ( ) : <EOL> mail . send ( msg ) <EOL> def send_email ( to , subject ,...
<s> """<STR_LIT>""" <EOL> import locale <EOL> __version__ = "<STR_LIT>" <EOL> __author__ = "<STR_LIT>" <EOL> __date__ = "<STR_LIT>" <EOL> try : <EOL> from io import StringIO <EOL> except ImportError : <EOL> from cStringIO import StringIO <EOL> import codecs <EOL> import locale <EOL> import logging <EOL> import os <EOL>...
<s> """<STR_LIT>""" <EOL> import time <EOL> import hashlib <EOL> from base64 import b64encode <EOL> from urlparse import urlparse <EOL> from . utils import randombytes , parse_dict_header <EOL> def http_basic ( r , username , password ) : <EOL> """<STR_LIT>""" <EOL> username = str ( username ) <EOL> password = str ( pa...
<s> from random import randint <EOL> class UserAgents : <EOL> def __init__ ( self ) : <EOL> self . user_agents = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL>...
<s> </s>
<s> """<STR_LIT>""" <EOL> from fabric . api import ( run as fabric_run , local , sudo as fabric_sudo , hide , <EOL> put as fabric_put , settings , env , require , abort , cd ) <EOL> from fabric . contrib . files import ( exists as fabric_exists , sed as fabric_sed ) <EOL> import os <EOL> from buedafab . utils import ab...
<s> """<STR_LIT>""" </s>
<s> import functools <EOL> import logging <EOL> from tornado import gen <EOL> from tornado . options import define <EOL> from tornado . options import options <EOL> from twork . errors import BaseError <EOL> define ( '<STR_LIT>' , <EOL> default = False , <EOL> type = bool , <EOL> help = '<STR_LIT>' ) <EOL> define ( '<S...
<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> db . create_table ( u'<STR_LIT>' , ( <EOL> ( u'<STR_LIT:id>' , ...
<s> """<STR_LIT>""" <EOL> from django . test import TestCase <EOL> from django . core . urlresolvers import reverse <EOL> from tos . models import TermsOfService <EOL> from landing . models import SEEDUser as User <EOL> class UserLoginTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . user_details = { '<STR_LI...
<s> """<STR_LIT>""" <EOL> 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> db . add_column ( u'<STR_LIT>' , '<STR_LI...
<s> from south . utils import datetime_utils as datetime <EOL> from south . db import db <EOL> from south . v2 import DataMigration <EOL> from django . db import models <EOL> import re <EOL> from seed . data import bedes <EOL> from seed . utils import mapping as m_utils <EOL> from seed . models import ( <EOL> STRING , ...
<s> """<STR_LIT>""" <EOL> from django . conf . urls import patterns , url <EOL> urlpatterns = patterns ( <EOL> '<STR_LIT>' , <EOL> url ( <EOL> r'<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> name = '<STR_LIT>' <EOL> ) , <EOL> ) </s>
<s> from datetime import datetime <EOL> from django . db import models <EOL> TEXT = <NUM_LIT:1> <EOL> RADIO = <NUM_LIT:2> <EOL> ENUM = <NUM_LIT:3> <EOL> QUESTION_TYPES = ( <EOL> ( TEXT , '<STR_LIT>' ) , <EOL> ( RADIO , '<STR_LIT>' ) , <EOL> ( ENUM , '<STR_LIT>' ) , <EOL> ) <EOL> class Survey ( models . Model ) : <EOL> ...
<s> </s>
<s> import httplib <EOL> import json <EOL> import sys <EOL> from urllib import urlencode <EOL> import requests <EOL> import logging <EOL> from requests . packages . urllib3 . util import Retry <EOL> import robot <EOL> from robot . api import logger <EOL> from robot . libraries . BuiltIn import BuiltIn <EOL> try : <EOL>...
<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> from numpy import sum , ones_like , array <EOL> from numpy import dot , diag , log , exp , pi , asarray , isscalar <EOL> from numpy . linalg import ...
<s> from . . resfiles import Resources <EOL> resources = Resources ( package = __name__ , <EOL> patterns = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> datadir = '<STR_LIT>' , <EOL> check_file = '<STR_LIT>' , <EOL> env = '<STR_LIT>' ) <EOL> del Resources </s>
<s> """<STR_LIT>""" <EOL> def test_docstrings ( ) : <EOL> import doctest <EOL> doctest . testmod ( optionflags = doctest . NORMALIZE_WHITESPACE ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_docstrings ( ) </s>
<s> from math import log <EOL> from scipy . stats import distributions <EOL> from bumps . names import * <EOL> USAGE = """<STR_LIT>""" <EOL> if len ( sys . argv ) > <NUM_LIT:1> : <EOL> D_class = getattr ( distributions , sys . argv [ <NUM_LIT:1> ] ) <EOL> args = [ float ( v ) for v in sys . argv [ <NUM_LIT:2> : ] ] <EO...
<s> """<STR_LIT>""" <EOL> from pylab import * <EOL> from dream import * <EOL> if <NUM_LIT:1> : <EOL> n = <NUM_LIT:5> <EOL> S = [ <NUM_LIT:0.1> ] * <NUM_LIT:5> <EOL> x = [ - <NUM_LIT:4> , - <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> ] <EOL> y = [ <NUM_LIT:2> , - <NUM_LIT:2> , - <NUM_LIT:4> , <NUM_LIT:0> , <NU...
<s> """<STR_LIT>""" <EOL> from __future__ import print_function <EOL> def fitter ( request ) : <EOL> from bumps . fitservice import fitservice <EOL> return fitservice ( request ) <EOL> def count ( request ) : <EOL> print ( "<STR_LIT>" ) <EOL> total = <NUM_LIT:0> <EOL> for _ in range ( request [ '<STR_LIT:data>' ] ) : <...
<s> from django . conf . urls import url , include <EOL> from django . contrib . admin . views . decorators import staff_member_required <EOL> from rest_framework import routers <EOL> from . import views <EOL> from . api import views as api_views <EOL> from django . conf import settings <EOL> router = routers . Default...
<s> import os <EOL> import sys <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> os . environ . setdefault ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> from django . core . management import execute_from_command_line <EOL> execute_from_command_line ( sys . argv ) </s>
<s> """<STR_LIT>""" <EOL> __version__ = '<STR_LIT>' <EOL> __author__ = '<STR_LIT>' <EOL> try : <EOL> from urllib import urlencode <EOL> except ImportError : <EOL> from urllib . parse import urlencode <EOL> from . client import Client , login , authorize <EOL> from . models import Spreadsheet , Worksheet , Cell <EOL> fr...
<s> revision = '<STR_LIT:3>' <EOL> down_revision = '<STR_LIT:2>' <EOL> from alembic import op <EOL> import sqlalchemy as sa <EOL> def upgrade ( ) : <EOL> op . rename_table ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> op . alter_column ( '<STR_LIT>' , '<STR_LIT>' , new_column_name = '<STR_LIT>' , existing_type = sa . Integer ( )...
<s> __author__ = '<STR_LIT>' <EOL> import markovobfuscate . obfuscation as obf <EOL> import logging <EOL> import re <EOL> import random <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> logging . basicConfig ( level = logging . DEBUG ) <EOL> split_regex = r'<STR_LIT:\n>' <EOL> training_file = "<STR_LIT>" <EOL> m1 = obf...