code
stringlengths
9
256k
<s> import numpy as np <EOL> import matplotlib as mpl <EOL> from distutils . version import LooseVersion <EOL> import nose <EOL> import matplotlib . pyplot as plt <EOL> import nose . tools as nt <EOL> import numpy . testing as npt <EOL> from . import PlotTestCase <EOL> from . . import rcmod <EOL> class RCParamTester ( ...
<s> import sublime <EOL> import sublime_plugin <EOL> from . file_scanner import FileScanner <EOL> from . view_helper import ViewHelpers <EOL> class JumpIndentCommand ( object ) : <EOL> def run ( self , edit , extend_selection = False , indent_offset = <NUM_LIT:0> ) : <EOL> self . indent_offset = indent_offset <EOL> sel...
<s> import cobble <EOL> from . import html <EOL> def path ( elements ) : <EOL> return HtmlPath ( elements ) <EOL> def element ( names , class_names = None , fresh = None ) : <EOL> if class_names is None : <EOL> class_names = [ ] <EOL> if fresh is None : <EOL> fresh = False <EOL> return HtmlPathElement ( names , class_n...
<s> import io <EOL> from zipfile import ZipFile <EOL> from nose . tools import istest , assert_equal <EOL> from mammoth . docx . style_map import write_style_map , read_style_map <EOL> from mammoth . zips import open_zip <EOL> from mammoth . docx import xmlparser as xml <EOL> @ istest <EOL> def reading_embedded_style_m...
<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> import os <EOL> import sys <EOL> from . import ast <EOL> from . import headers <EOL> from . import keywords <EOL> from . import metrics <EOL> from . import sym...
<s> """<STR_LIT>""" </s>
<s> from django . core . paginator import Paginator , InvalidPage , EmptyPage <EOL> from django . core . urlresolvers import reverse <EOL> from django . http import Http404 , HttpResponseForbidden , HttpResponseServerError , HttpResponseRedirect <EOL> from django . shortcuts import render_to_response <EOL> from django ...
<s> """<STR_LIT>""" <EOL> BUILTINS = { <EOL> '<STR_LIT>' : [ <EOL> '<STR_LIT:null>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:string>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '...
<s> from abc import ABCMeta , abstractmethod <EOL> from pylease . logger import LOGME as logme <EOL> class Extension ( object ) : <EOL> """<STR_LIT>""" <EOL> __metaclass__ = ABCMeta <EOL> _IGNORE_ME_VAR_NAME = '<STR_LIT>' <EOL> ignore_me = False <EOL> def __init__ ( self , lizy ) : <EOL> super ( Extension , self ) . __...
<s> import os <EOL> from distutils . core import setup <EOL> package_dirs = ( '<STR_LIT>' , ) <EOL> def fullsplit ( path , result = None ) : <EOL> """<STR_LIT>""" <EOL> if result is None : <EOL> result = [ ] <EOL> head , tail = os . path . split ( path ) <EOL> if head == '<STR_LIT>' : <EOL> return [ tail ] + result <EO...
<s> import logging <EOL> from com . abiquo . model . enumerator import ConversionState <EOL> from org . jclouds . abiquo . predicates . cloud import VirtualDatacenterPredicates <EOL> from org . jclouds . abiquo . predicates . cloud import VirtualMachineTemplatePredicates <EOL> log = logging . getLogger ( '<STR_LIT>' ) ...
<s> """<STR_LIT>""" <EOL> import re <EOL> from functools import partial <EOL> from . dunderkey import dunder_get , dunder_partition , undunder_keys , dunder_truncate <EOL> class QuerySet ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> self . data = data <EOL> def filter ( self , * args , *...
<s> from django . test import TestCase <EOL> from django import template <EOL> from django . template import Template , Context <EOL> from django . shortcuts import render_to_response <EOL> import django . template . base as template_base <EOL> def make_parser ( template_string ) : <EOL> return template_base . Parser (...
<s> try : <EOL> from pymongo import MongoClient as PymongoConnection <EOL> from pymongo import MongoReplicaSetClient as PymongoReplicaSetConnection <EOL> except ImportError : <EOL> from pymongo import Connection as PymongoConnection <EOL> from mongokit . database import Database <EOL> class CallableMixin ( object ) : <...
<s> import unittest <EOL> from mongokit import * <EOL> from bson . objectid import ObjectId <EOL> import datetime <EOL> class JsonTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . connection = Connection ( ) <EOL> self . col = self . connection [ '<STR_LIT:test>' ] [ '<STR_LIT>' ] <EOL> def tea...
<s> import os <EOL> import unittest <EOL> import facebook <EOL> USER_ID = os . environ [ '<STR_LIT>' ] <EOL> ACCOUNT_ID = os . environ [ '<STR_LIT>' ] <EOL> CAMPAIGN_ID = os . environ [ '<STR_LIT>' ] <EOL> GROUP_ID = os . environ [ '<STR_LIT>' ] <EOL> CREATIVE_ID = os . environ [ '<STR_LIT>' ] <EOL> OFFSITE_PIXEL_ID = ...
<s> """<STR_LIT>""" <EOL> import warnings <EOL> try : <EOL> from bs4 . builder import HTML5TreeBuilder <EOL> HTML5LIB_PRESENT = True <EOL> except ImportError , e : <EOL> HTML5LIB_PRESENT = False <EOL> from bs4 . element import SoupStrainer <EOL> from bs4 . testing import ( <EOL> HTML5TreeBuilderSmokeTest , <EOL> SoupTe...
<s> modis_classifiers = dict ( ) <EOL> radar_classifiers = dict ( ) <EOL> modis_classifiers [ '<STR_LIT:default>' ] = [ ( u'<STR_LIT>' , <NUM_LIT> , <NUM_LIT> ) , ( u'<STR_LIT>' , <NUM_LIT> , <NUM_LIT> ) , ( u'<STR_LIT>' , <NUM_LIT> , <NUM_LIT> ) , ( u'<STR_LIT>' , <NUM_LIT> , <NUM_LIT> ) , ( u'<STR_LIT>' , <NUM_LIT> ,...
<s> """<STR_LIT>""" <EOL> import datasets <EOL> import dbio <EOL> import netCDF4 as netcdf <EOL> import os <EOL> import random <EOL> import string <EOL> import numpy as np <EOL> from datetime import date <EOL> from dateutil . relativedelta import relativedelta <EOL> def dates ( dbname ) : <EOL> dts = datasets . dates (...
<s> """<STR_LIT>""" <EOL> import output as vicoutput <EOL> from osgeo import ogr , gdal , osr <EOL> import decimal <EOL> import sys <EOL> import subprocess <EOL> import os <EOL> import string <EOL> import numpy <EOL> from datetime import date , datetime , timedelta <EOL> import multiprocessing as mp <EOL> import shutil...
<s> """<STR_LIT>""" <EOL> __version__ = "<STR_LIT>" <EOL> import pprint <EOL> from copy import copy , deepcopy <EOL> class Data ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , ** kw ) : <EOL> """<STR_LIT>""" <EOL> self . __dict__ = kw <EOL> def __str__ ( self ) : <EOL> "<STR_LIT>" <EOL> return pprint . p...
<s> """<STR_LIT>""" <EOL> __version__ = "<STR_LIT>" <EOL> def toOneOf ( value , converters , name = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> savedError = None <EOL> if name : <EOL> name = "<STR_LIT>" % name <EOL> for cvt in converters : <EOL> try : <EOL> result = cvt ( value ) <EOL> return result <EOL> except Except...
<s> "<STR_LIT>" <EOL> __version__ = "<STR_LIT>" <EOL> import unittest <EOL> import os <EOL> import mplStyle as S <EOL> class MySubStyle ( S . types . SubStyle ) : <EOL> """<STR_LIT>""" <EOL> prop = S . types . StyleProperty ( default = <NUM_LIT:0.0> , validator = float ) <EOL> value = S . types . StyleProperty ( defaul...
<s> from setuptools import setup <EOL> setup ( <EOL> name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> long_description = '<STR_LIT>' , <EOL> license = '<STR_LIT>' , <EOL> keywords = [ '<ST...
<s> from event import * <EOL> import unittest <EOL> class EventTest ( unittest . TestCase ) : <EOL> def test_event ( self ) : <EOL> e = Event ( ) <EOL> fired = [ ] <EOL> def l ( * args ) : <EOL> self . assertEqual ( <NUM_LIT:3> , args [ <NUM_LIT:0> ] ) <EOL> fired . append ( True ) <EOL> e . add_listener ( l ) <EOL> se...
<s> import os <EOL> import subprocess <EOL> import sys <EOL> import time <EOL> import logging <EOL> from trace_event import * <EOL> def _is_port_bindable ( host , port ) : <EOL> import socket <EOL> s = socket . socket ( ) <EOL> try : <EOL> s . bind ( ( host , port ) ) <EOL> except socket . error : <EOL> return False <E...
<s> from urls import * <EOL> urlpatterns += patterns ( <EOL> url ( r'<STR_LIT>' , '<STR_LIT>' ) , <EOL> ) </s>
<s> from django . core . urlresolvers import reverse <EOL> from django . db import models <EOL> from Event import Event <EOL> from Repository import Repository <EOL> class Commit ( Event ) : <EOL> class Meta : <EOL> app_label = '<STR_LIT>' <EOL> url = models . URLField ( "<STR_LIT>" , max_length = <NUM_LIT:200> , <EOL>...
<s> import feedparser <EOL> import dateutil <EOL> import markdown <EOL> import InheritanceQuerySet </s>
<s> """<STR_LIT>""" <EOL> import __init__ as markdown , re <EOL> from __init__ import etree <EOL> class DefListProcessor ( markdown . blockprocessors . BlockProcessor ) : <EOL> """<STR_LIT>""" <EOL> RE = re . compile ( r'<STR_LIT>' ) <EOL> def test ( self , parent , block ) : <EOL> return bool ( self . RE . search ( bl...
<s> import base64 <EOL> import cgi <EOL> try : <EOL> from Crypto . Cipher import AES <EOL> except : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> MAIL_HIDE_BASE = "<STR_LIT>" <EOL> def asurl ( email , <EOL> public_key , <EOL> private_key ) : <EOL> """<STR_LIT>""" <EOL> cryptmail = _encrypt_string ( email , base64 . b16de...
<s> from django . contrib import admin <EOL> from basic . bookmarks . models import * <EOL> class BookmarkAdmin ( admin . ModelAdmin ) : <EOL> list_display = ( '<STR_LIT:url>' , '<STR_LIT:description>' ) <EOL> search_fields = ( '<STR_LIT:url>' , '<STR_LIT:description>' , '<STR_LIT>' ) <EOL> prepopulated_fields = { '<ST...
<s> import datetime <EOL> from django . shortcuts import get_object_or_404 <EOL> from django . http import HttpResponseRedirect , Http404 <EOL> from django . core . urlresolvers import reverse <EOL> from basic . groups . models import Group , GroupMember <EOL> def membership_required ( function = None ) : <EOL> """<STR...
<s> from django . conf . urls import * <EOL> urlpatterns = patterns ( '<STR_LIT>' , <EOL> url ( r'<STR_LIT>' , <EOL> view = '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) , <EOL> url ( r'<STR_LIT>' , <EOL> view = '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) , <EOL> url ( r'<STR_LIT>' , <EOL> view = '<STR_LIT>' , <EOL> name = '<S...
<s> from django . test import TestCase , override_settings <EOL> from django . core . urlresolvers import reverse <EOL> from django . contrib . auth . models import User <EOL> from basic . relationships . models import * <EOL> class RelationshipTestCase ( TestCase ) : <EOL> @ override_settings ( AUTH_USER_MODEL = '<STR...
<s> from django . test import TestCase <EOL> import registration <EOL> from registration . tests . backends import * <EOL> from registration . tests . forms import * <EOL> from registration . tests . models import * <EOL> from registration . tests . views import * <EOL> class RegistrationVersionInfoTests ( TestCase ) :...
<s> from . import dayone_export , VERSION , compat , PlistError <EOL> import dateutil . parser <EOL> import jinja2 <EOL> import argparse <EOL> import codecs <EOL> import locale <EOL> import os <EOL> import sys <EOL> def template_not_found_message ( template ) : <EOL> message = [ "<STR_LIT>" . format ( template ) , <EOL...
<s> from Selenium2Library . keywords import _browsermanagement <EOL> import re <EOL> import importlib <EOL> import inspect <EOL> import warnings <EOL> from robot . utils import asserts <EOL> from selenium . webdriver . support . ui import WebDriverWait <EOL> from selenium . webdriver . support import expected_condition...
<s> import robot . utils . asserts as asserts <EOL> from robotpageobjects . page import Page , robot_alias <EOL> class Page ( Page ) : <EOL> name = "<STR_LIT>" <EOL> uri = "<STR_LIT>" <EOL> selectors = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:q>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_...
<s> import json <EOL> import os <EOL> import re <EOL> import unittest <EOL> import requests <EOL> import xml . etree . ElementTree as ET <EOL> from nose . tools import raises <EOL> from robotpageobjects import Page , exceptions <EOL> from scenarios . po . result_component import ResultPage , ResultPageWithDOMStrategyLo...
<s> from ncclient import manager <EOL> import getpass <EOL> def connect ( host , port , user , password , command ) : <EOL> with manager . connect ( <EOL> host = host , <EOL> port = port , <EOL> username = user , <EOL> password = password , <EOL> timeout = <NUM_LIT:10> , <EOL> device_params = { '<STR_LIT:name>' : '<STR...
<s> "<STR_LIT>" <EOL> from ncclient . xml_ import * <EOL> from ncclient . operations . rpc import RaiseMode , RPC <EOL> class Lock ( RPC ) : <EOL> "<STR_LIT>" <EOL> def request ( self , target = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> node = new_ele ( "<STR_LIT>" ) <EOL> sub_ele ( sub_ele ( node , "<STR_LIT:target>...
<s> from ncclient . operations . session import * <EOL> import unittest <EOL> from mock import patch <EOL> from ncclient import manager <EOL> import ncclient . manager <EOL> import ncclient . transport <EOL> from ncclient . xml_ import * <EOL> from ncclient . operations import RaiseMode <EOL> from xml . etree import El...
<s> from roku import Roku <EOL> def discover_roku ( ) : <EOL> """<STR_LIT>""" <EOL> print ( "<STR_LIT>" ) <EOL> rokus = Roku . discover ( ) <EOL> if not rokus : <EOL> print ( "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> return None <EOL> print ( "<STR_LIT>" ) <EOL> for i , r in enumerate ( rokus ) : <EOL...
<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> import warnings <EOL> try : <EOL> import openid <EOL> except ImportError as e : <EOL> warnings . warn ( <EOL> "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> DEBUG = True <EOL> TEMPLATE_DEBUG = DEBUG <EOL> ADMINS = ( <EOL> ) <EOL> MANAGERS = ADMINS <EOL> D...
<s> """<STR_LIT>""" <EOL> import urllib . parse <EOL> import os . path <EOL> from openid . yadis . discover import DiscoveryResult , DiscoveryFailure <EOL> from openid . yadis . constants import YADIS_HEADER_NAME <EOL> tests_dir = os . path . dirname ( __file__ ) <EOL> data_path = os . path . join ( tests_dir , '<STR_L...
<s> """<STR_LIT>""" <EOL> from base64 import b64decode <EOL> import unittest <EOL> import warnings <EOL> from urllib . parse import urlparse , parse_qsl , parse_qs <EOL> from openid . server import server <EOL> from openid import association , cryptutil , oidutil <EOL> from openid . message import Message , OPENID_NS ,...
<s> _auth_forms_code = '''<STR_LIT>''' </s>
<s> from pkgutil import extend_path <EOL> __path__ = extend_path ( __path__ , __name__ ) </s>
<s> """<STR_LIT>""" <EOL> import imp <EOL> import io <EOL> import logging <EOL> import os <EOL> import sys <EOL> from . decorators import plugin , rpc_export <EOL> from . . api import Nvim , walk <EOL> __all__ = ( '<STR_LIT>' , ) <EOL> logger = logging . getLogger ( __name__ ) <EOL> debug , info , warn = ( logger . deb...
<s> from __future__ import absolute_import , print_function , unicode_literals <EOL> from django . views . generic import DetailView , ListView <EOL> from meta . views import MetadataMixin <EOL> from . models import Post <EOL> class PostDetailView ( DetailView ) : <EOL> model = Post <EOL> def get_context_data ( self , ...
<s> from __future__ import absolute_import , print_function , unicode_literals <EOL> import os . path <EOL> from cms . plugin_base import CMSPluginBase <EOL> from cms . plugin_pool import plugin_pool <EOL> from . forms import LatestEntriesForm <EOL> from . models import AuthorEntriesPlugin , BlogCategory , GenericBlogP...
<s> from django . conf import settings as dj_settings <EOL> from djangocms_blog . models import thumbnail_model <EOL> from south . db import db <EOL> from south . v2 import SchemaMigration <EOL> class Migration ( SchemaMigration ) : <EOL> def forwards ( self , orm ) : <EOL> db . alter_column ( u'<STR_LIT>' , '<STR_LIT>...
<s> from __future__ import absolute_import , print_function , unicode_literals <EOL> import sys <EOL> from distutils . version import LooseVersion <EOL> import cms <EOL> from . base import BaseTest <EOL> try : <EOL> from unittest import skipIf <EOL> except ImportError : <EOL> from unittest2 import skipIf <EOL> class Wi...
<s> import os <EOL> import sys <EOL> import imp <EOL> import ast <EOL> import contextlib <EOL> from mamba import nodetransformers <EOL> from mamba . infrastructure import is_python3 <EOL> class ExampleCollector ( object ) : <EOL> def __init__ ( self , paths ) : <EOL> self . paths = paths <EOL> self . _node_transformer ...
<s> from expects import * <EOL> from doublex_expects import have_been_called_with <EOL> from doublex import Spy <EOL> from spec . object_mother import * <EOL> from mamba import reporter , formatters , example_group <EOL> with description ( reporter . Reporter ) : <EOL> with before . each : <EOL> self . example = an_exa...
<s> import random <EOL> from sys import maxint <EOL> from zen . graph import Graph <EOL> from zen . digraph import DiGraph <EOL> from zen . exceptions import ZenException <EOL> from zen . randomize import choose_node <EOL> def duplication_divergence_iky ( n , s , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> seed = kwargs ...
<s> import unittest <EOL> import zen <EOL> class UndirectedBATestCase ( unittest . TestCase ) : <EOL> def test_bad_argument ( self ) : <EOL> try : <EOL> zen . generating . barabasi_albert ( <NUM_LIT:10> , <NUM_LIT:3> , blah = <NUM_LIT:10> ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except zen . ZenException , e : <EOL> p...
<s> DOCUMENTATION = '''<STR_LIT>''' <EOL> EXAMPLES = '''<STR_LIT>''' <EOL> from ansible . module_utils . basic import * <EOL> from collections import defaultdict <EOL> try : <EOL> from nelsnmp . snmp import SnmpHandler <EOL> from nelsnmp . vendors . cisco . oids import CiscoOids <EOL> o = CiscoOids ( ) <EOL> has_nelsnm...
<s> """<STR_LIT>""" <EOL> import networkx as nx <EOL> import numpy . linalg <EOL> import matplotlib . pyplot as plt <EOL> n = <NUM_LIT:1000> <EOL> m = <NUM_LIT> <EOL> G = nx . gnm_random_graph ( n , m ) <EOL> L = nx . normalized_laplacian_matrix ( G ) <EOL> e = numpy . linalg . eigvals ( L . A ) <EOL> print ( "<STR_LIT...
<s> """<STR_LIT>""" <EOL> import networkx as nx <EOL> from networkx . generators . atlas import * <EOL> from pygraphviz import * <EOL> atlas = graph_atlas_g ( ) [ <NUM_LIT:0> : <NUM_LIT:20> ] <EOL> for G in atlas : <EOL> print ( "<STR_LIT>" <EOL> % ( G . name , NX . number_of_nodes ( G ) , NX . number_of_edges ( G ) ) ...
<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from nose . tools import assert_greater <EOL> from nose . tools import assert_true <EOL> from nose . tools import eq_ <EOL> import networkx as nx <EOL> from networkx . algorithms . approximation import max_clique <EOL> from networkx . algorithms . approxim...
<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from nose . tools import assert_equal <EOL> from nose . tools import assert_true <EOL> from nose . tools import raises <EOL> from networkx import cycle_graph <EOL> from networkx import NetworkXError <EOL> from networkx . algorithms . bipartite import compl...
<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from unittest import TestCase <EOL> from nose . tools import assert_almost_equal <EOL> from nose . tools import assert_equal <EOL> from nose . tools import raises <EOL> from networkx import nx <EOL> class TestGlobalReachingCentrality ( TestCase ) : <EOL> "...
<s> from nose . tools import * <EOL> import networkx as nx <EOL> from networkx import NetworkXNotImplemented <EOL> class TestAttractingComponents ( object ) : <EOL> def setUp ( self ) : <EOL> self . G1 = nx . DiGraph ( ) <EOL> self . G1 . add_edges_from ( [ ( <NUM_LIT:5> , <NUM_LIT:11> ) , ( <NUM_LIT:11> , <NUM_LIT:2> ...
<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from itertools import permutations <EOL> import networkx as nx <EOL> from . . utils import not_implemented_for <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> @ not_implemented_for ( '<STR_LIT>' ) <EOL> def efficiency ( G , u , v ) : <EOL...
<s> import random <EOL> import networkx <EOL> from nose . tools import * <EOL> from nose import SkipTest <EOL> from nose . plugins . attrib import attr <EOL> class TestPageRank ( object ) : <EOL> @ classmethod <EOL> def setupClass ( cls ) : <EOL> global numpy <EOL> try : <EOL> import numpy <EOL> except ImportError : <E...
<s> from nose . tools import * <EOL> import networkx as nx <EOL> class TestMCS : <EOL> def setUp ( self ) : <EOL> connected_chordal_G = nx . Graph ( ) <EOL> connected_chordal_G . add_edges_from ( [ ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:2> , <NUM_LIT:4...
<s> from nose . tools import assert_equal <EOL> import networkx as nx <EOL> class TestClosenessVitality ( object ) : <EOL> def test_unweighted ( self ) : <EOL> G = nx . cycle_graph ( <NUM_LIT:3> ) <EOL> vitality = nx . closeness_vitality ( G ) <EOL> assert_equal ( vitality , { <NUM_LIT:0> : <NUM_LIT:2> , <NUM_LIT:1> : ...
<s> """<STR_LIT>""" <EOL> from collections import OrderedDict <EOL> from . graph import Graph <EOL> from . multigraph import MultiGraph <EOL> from . digraph import DiGraph <EOL> from . multidigraph import MultiDiGraph <EOL> __all__ = [ ] <EOL> __all__ . extend ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT...
<s> """<STR_LIT>""" <EOL> from nose . tools import assert_almost_equal <EOL> from nose . tools import assert_equal <EOL> from nose . tools import assert_raises <EOL> from nose . tools import assert_true <EOL> from networkx . exception import NetworkXError <EOL> from networkx . generators . random_graphs import barabasi...
<s> from itertools import chain , count <EOL> import json <EOL> import networkx as nx <EOL> from networkx . utils import make_str , to_tuple <EOL> from tempfile import NamedTemporaryFile <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> _attrs = dict ( source = '<STR_LIT:source>' , target = '<STR_LIT:target>' , name ...
<s> from nose . tools import assert_equal <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def assert_nodes_equal ( nodes1 , nodes2 ) : <EOL> nlist1 = list ( nodes1 ) <EOL> nlist2 = list ( nodes2 ) <EOL> try : <EOL> d1 = dict ( nlist1 ) <EOL> d2 = dict ( nlist2 ) <EOL> except ( ValueError , TypeError )...
<s> import json <EOL> import requests <EOL> import sys <EOL> __author__ = '<STR_LIT>' <EOL> class Connection ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , url , access_token ) : <EOL> """<STR_LIT>""" <EOL> self . url = url <EOL> self . access_token = access_token <EOL> def milestone_by_name ( self , pr...
<s> import sys <EOL> import tempfile <EOL> import numpy as np <EOL> import zlib <EOL> import cStringIO <EOL> from PIL import Image <EOL> import pylibmc <EOL> import time <EOL> import restargs <EOL> import ocpcadb <EOL> import ocpcaproj <EOL> import ocpcarest <EOL> import django <EOL> import posix_ipc <EOL> import re <E...
<s> from __future__ import unicode_literals <EOL> from django . db import models , migrations <EOL> from django . conf import settings <EOL> class Migration ( migrations . Migration ) : <EOL> dependencies = [ <EOL> migrations . swappable_dependency ( settings . AUTH_USER_MODEL ) , <EOL> ] <EOL> operations = [ <EOL> mig...
<s> import sys <EOL> import os <EOL> import shlex <EOL> sys . path += [ os . path . abspath ( '<STR_LIT>' ) ] <EOL> import OCP . settings <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> from django . conf import settings <EOL> import ocpca <EOL> extensions = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_...
<s> import argparse <EOL> import numpy as np <EOL> import urllib , urllib2 <EOL> import cStringIO <EOL> import sys <EOL> import zlib <EOL> import libtiff <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <...
<s> import argparse <EOL> import sys <EOL> import os <EOL> import numpy as np <EOL> from PIL import Image <EOL> import cStringIO <EOL> import zlib <EOL> import ocppaths <EOL> import ocpcarest <EOL> import zindex <EOL> """<STR_LIT>""" <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LI...
<s> import argparse <EOL> import sys <EOL> import os <EOL> import numpy as np <EOL> from PIL import Image <EOL> import urllib , urllib2 <EOL> import cStringIO <EOL> import collections <EOL> import zlib <EOL> import kanno_cy <EOL> """<STR_LIT>""" <EOL> xtilesz = <NUM_LIT> <EOL> ytilesz = <NUM_LIT> <EOL> _resolution = <N...
<s> import numpy as np <EOL> import cStringIO <EOL> from PIL import Image <EOL> import zlib <EOL> import blosc <EOL> import ocplib <EOL> from ocptype import ANNOTATION_CHANNELS , TIMESERIES_CHANNELS , DTYPE_uint8 , DTYPE_uint16 , DTYPE_uint32 , DTYPE_uint64 , DTYPE_float32 <EOL> import logging <EOL> logger = logging . ...
<s> import numpy as np <EOL> from PIL import Image <EOL> from cube import Cube <EOL> import ocplib <EOL> from windowcutout import windowCutout <EOL> from ocpcaerror import OCPCAError <EOL> import logging <EOL> logger = logging . getLogger ( "<STR_LIT>" ) <EOL> class TimeCube8 ( Cube ) : <EOL> def __init__ ( self , cube...
<s> import argparse <EOL> import sys <EOL> import os <EOL> import numpy as np <EOL> import urllib , urllib2 <EOL> import cStringIO <EOL> from contextlib import closing <EOL> import zlib <EOL> sys . path += [ os . path . abspath ( '<STR_LIT>' ) ] <EOL> import OCP . settings <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT...
<s> import urllib2 <EOL> import h5py <EOL> import tempfile <EOL> import random <EOL> import numpy as np <EOL> from PIL import Image <EOL> from StringIO import StringIO <EOL> import makeunitdb <EOL> from ocptype import IMAGE , FLOAT32 <EOL> from params import Params <EOL> from postmethods import postNPZ , getNPZ , getHD...
<s> import sys <EOL> import os <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . abspath ( '<STR_LIT:.>' ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . abspath ( '<STR_LIT:..>' ) ) <EOL> extensions = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> tem...
<s> import re <EOL> import test_module . mistune as mistune <EOL> SOME_MARKDOWN = """<STR_LIT>""" <EOL> REG_CODE = re . compile ( r'<STR_LIT>' , re . MULTILINE | re . DOTALL ) <EOL> def extract_code ( html ) : <EOL> code = REG_CODE . findall ( html ) <EOL> for code_tpl in code : <EOL> print "<STR_LIT>" <EOL> snippet = ...
<s> __author__ = '<STR_LIT>' <EOL> import sys <EOL> path_sct = '<STR_LIT>' <EOL> sys . path . append ( path_sct + '<STR_LIT>' ) <EOL> import sct_extract_metric <EOL> import numpy <EOL> import nibabel <EOL> def compute_fract_vol_per_lab ( atlas_folder , file_label ) : <EOL> atlas_folder = '<STR_LIT>' <EOL> file_label = ...
<s> from aonlm import mabonlm3d <EOL> from aonlm import aonlm <EOL> import numpy as np <EOL> import nibabel as nib <EOL> from mixingsubband import mixingsubband <EOL> def test_filters ( ) : <EOL> nii_matlab_filtered1 = nib . load ( '<STR_LIT>' ) ; <EOL> matlab_filtered1 = nii_matlab_filtered1 . get_data ( ) . astype ( ...
<s> import sys <EOL> from msct_base_classes import BaseScript , Algorithm <EOL> from msct_parser import Parser <EOL> from msct_image import Image <EOL> import os <EOL> import sct_utils as sct <EOL> import numpy as np <EOL> from sct_straighten_spinalcord import smooth_centerline <EOL> import sct_convert as conv <EOL> de...
<s> import sct_utils as sct <EOL> from msct_parser import Parser <EOL> import os <EOL> import time <EOL> import sys <EOL> import getopt <EOL> class Param : <EOL> def __init__ ( self ) : <EOL> self . debug = False <EOL> self . fname_ref = '<STR_LIT>' <EOL> self . fname_moving = '<STR_LIT>' <EOL> self . transformation = ...
<s> import numpy as np <EOL> import commands , sys <EOL> status , path_sct = commands . getstatusoutput ( '<STR_LIT>' ) <EOL> sys . path . append ( path_sct + '<STR_LIT>' ) <EOL> sys . path . append ( '<STR_LIT>' ) <EOL> from msct_image import Image <EOL> from msct_parser import Parser <EOL> import nibabel <EOL> import...
<s> class param : <EOL> def __init__ ( self ) : <EOL> self . verbose = <NUM_LIT:1> <EOL> self . final_warp = '<STR_LIT>' <EOL> self . compose = <NUM_LIT:0> <EOL> import sys , commands <EOL> import getopt <EOL> status , path_sct = commands . getstatusoutput ( '<STR_LIT>' ) <EOL> sys . path . append ( path_sct + '<STR_LI...
<s> def get_fractional_volume_per_label ( atlas_folder , file_label , nb_RL_labels = <NUM_LIT:15> ) : <EOL> """<STR_LIT>""" <EOL> import sct_extract_metric <EOL> import nibabel <EOL> import numpy <EOL> label_id , label_name , label_file , combined_labels_ids , combined_labels_names , combined_labels_id_groups = sct_ext...
<s> import sys <EOL> import numpy as np <EOL> from msct_parser import Parser <EOL> from msct_image import Image <EOL> from sct_image import get_orientation_3d , set_orientation <EOL> import sct_utils as sct <EOL> from os import rmdir , chdir <EOL> def get_parser ( ) : <EOL> parser = Parser ( __file__ ) <EOL> parser . u...
<s> from msct_parser import Parser <EOL> import sys <EOL> import sct_utils as sct <EOL> def get_parser ( ) : <EOL> parser = Parser ( __file__ ) <EOL> parser . usage . set_description ( '''<STR_LIT>''' ) <EOL> parser . add_option ( name = "<STR_LIT>" , <EOL> type_value = "<STR_LIT>" , <EOL> description = "<STR_LIT>" , <...
<s> import commands <EOL> def test ( data_path ) : <EOL> folder_data = [ '<STR_LIT>' ] <EOL> file_data = [ '<STR_LIT>' ] <EOL> cmd = '<STR_LIT>' + data_path + folder_data [ <NUM_LIT:0> ] + file_data [ <NUM_LIT:0> ] <EOL> return commands . getstatusoutput ( cmd ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test ( ...
<s> import os <EOL> import logging <EOL> import os . path as op <EOL> try : <EOL> from testkraut . testcase import TestFromSPEC , discover_specs , template_case , TemplateTestCase <EOL> if '<STR_LIT>' in os . environ : <EOL> lgr = logging . getLogger ( '<STR_LIT>' ) <EOL> console = logging . StreamHandler ( ) <EOL> lgr...
<s> import logging <EOL> log = logging . getLogger ( '<STR_LIT>' ) <EOL> from optparse import make_option <EOL> import os , os . path <EOL> import sys <EOL> from zipfile import ZipFile <EOL> from tempfile import mkdtemp <EOL> from django . conf import settings <EOL> from django . contrib . gis . gdal import ( CoordTran...
<s> from csvkit . py2 import CSVKitWriter <EOL> import sys <EOL> from cement . core import handler , output <EOL> class CSVOutputHandler ( output . CementOutputHandler ) : <EOL> """<STR_LIT>""" <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> overridable = True <EOL> def render ( self , data , template = None ) : <EO...
<s> """<STR_LIT>""" <EOL> '''<STR_LIT>''' <EOL> from flask import Flask , send_file , request <EOL> from flask . ext import restful <EOL> from flask . ext . restful import Resource , reqparse <EOL> import json <EOL> from io import BytesIO <EOL> import zipfile <EOL> import next . utils <EOL> import next . broker . broke...