code stringlengths 1 199k |
|---|
import os
import unittest
import threading
import IECore
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
class SceneWriterTest( GafferSceneTest.SceneTestCase ) :
def testWrite( self ) :
s = GafferScene.Sphere()
g = GafferScene.Group()
g["in"][0].setInput( s["out"] )
g["transform"]["tr... |
"""Views used by the built-in site search functionality."""
from __future__ import unicode_literals
import json
from compat import six
from django.shortcuts import redirect
from django.http import HttpResponse
from django.views import generic
from django.views.generic.list import BaseListView
import watson
class Search... |
import re
import os
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_str
from sorl.thumbnail.base import EXTENSIONS
from sorl.thumbnail.conf import settings
from sorl.thumbnail.engines.base import EngineBase
from subprocess import Popen, PIPE
from tempfile import mkstemp
size_r... |
from .model import Rect
class _BaseReply:
def __init__(self, data):
for member in self.__class__._members:
if member[0] in data:
setattr(self, member[0], member[1](data[member[0]]))
else:
setattr(self, member[0], None)
@classmethod
def _parse_l... |
from typing import List, Tuple, Dict
from .providers import METRICS_PROVIDERS, MetricsProvider
def get_provider_choices() -> List[Tuple[str, str]]:
"""Returns a list of currently available metrics providers
suitable for use as model fields choices.
"""
choices = []
for provider in METRICS_PROVIDERS:... |
"""Software construction toolkit site_scons configuration.
This module sets up SCons for use with this toolkit. This should contain setup
which occurs outside of environments. If a method operates within the context
of an environment, it should instead go in a tool in site_tools and be invoked
for the target environm... |
def extractShirokunsCom(item):
'''
Parser for 'shirokuns.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Living in this World with Cut & Paste', 'Li... |
from datetime import timedelta
from decimal import Decimal
import os
import shutil
from whoosh.fields import TEXT, KEYWORD, NUMERIC, DATETIME, BOOLEAN
from whoosh.qparser import QueryParser
from django.conf import settings
from django.utils.datetime_safe import datetime, date
from django.test import TestCase
from hayst... |
from django.core.urlresolvers import reverse
from django.views.generic import DetailView
from django.views.generic import RedirectView
from django.views.generic import UpdateView
from django.views.generic import ListView
from braces.views import LoginRequiredMixin
from .forms import UserForm
from .models import User
cl... |
import mimetypes
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.core.files.storage import Storage
from django.utils.text import get_valid_filename
try:
import cloudfiles
from cloudfiles.errors import NoSuchObject
except Imp... |
import parlai.core.build_data as build_data
import os
def _process(fname, fout):
with open(fname) as f:
lines = [line.strip('\n') for line in f]
# main article
s = '1 ' + lines[2]
# add question
s = s + lines[4]
# add answer
s = s + '\t' + lines[6]
# add candidates (and strip the... |
namespace = '{http://www.w3.org/2000/svg}'
dpi = 90
units = {
None: 1, # Default unit (same as pixel)
'px': 1, # px: pixel. Default SVG unit
'em': 10, # 1 em = 10 px FIXME
'ex': 5, # 1 ex = 5 px FIXME
'in': dpi, # 1 in = 96 px
'cm': dpi / 2.54, ... |
from __future__ import unicode_literals, division
from fabric.context_managers import hide, settings as fab_settings, lcd
from fabric.decorators import task
from fabric.operations import local
from django.conf import settings
@task
def run():
""" --> [LOCAL] Starts django development server """
local('python ma... |
"""
Class to handle logging over UDP
(c) 2015 Massachusetts Institute of Technology
"""
import socket
import logging
logger = logging.getLogger(__name__)
class LogUDP:
def __init__(self,address,port):
"""
Intialize our UDP logger
@param address: Address of remote server
... |
from django.contrib.sites.models import Site
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import Http404
from django.shortcuts import get_object_or_404
from press_links.models import Entry
from press_links.enums import DRAFT_STATUS, HIDDEN_STATUS
from templatable_view import... |
import unittest
import numpy as np
from mock import Mock, patch, PropertyMock
import repstruct.features.extract as extract
import repstruct.dataset as dataset
class TestExtract(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testGetRgbFromLocations(self):
im = ... |
from basil.HL.RegisterHardwareLayer import RegisterHardwareLayer
class gpio(RegisterHardwareLayer):
'''GPIO interface
'''
def __init__(self, intf, conf):
self._registers = {'RESET': {'descr': {'addr': 0, 'size': 8, 'properties': ['writeonly']}},
'VERSION': {'descr': {'addr... |
from PIL import Image
from io import BytesIO
_loaded = False
def display_pil_image(im):
"""Generate PNG data for IPython display"""
b = BytesIO()
im.save(b, format='png')
return b.getvalue()
def load_ipython_extension(ip):
from IPython.core import display
global _loaded
if not _loaded:
... |
from sympy import Symbol, Matrix, Integral, log, Rational, Derivative, exp, \
sqrt, pi, Function, sin, cos, pprint_use_unicode, oo, Eq, Le, \
Gt, Ne, Limit, factorial, gamma, conjugate, I, Piecewise, S
from sympy.printing.pretty import pretty as xpretty
x = Symbol('x')
y = Symbol('y')
th = Symbol('thet... |
import numpy
has_matplotlib = True
try:
from matplotlib import pyplot, figure
except ImportError:
has_matplotlib = False
from dagpype._core import filters
def _make_relay_call(fn, name):
def new_fn(*args, **kwargs):
@filters
def _dagpype_internal_fn_act(target):
try:
... |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class DjangoX509Config(AppConfig):
name = 'django_x509'
verbose_name = _('x509 Certificates')
default_auto_field = 'django.db.models.AutoField' |
import numpy as np
from bokeh.io import curdoc, show
from bokeh.models import Bezier, ColumnDataSource, Grid, LinearAxis, Plot
N = 9
x = np.linspace(-2, 2, N)
y = x**2
source = ColumnDataSource(dict(
x=x,
y=y,
xp02=x+0.4,
xp01=x+0.1,
xm01=x-0.1,
yp01=y+0.2,
ym01=y... |
from django.conf.urls import url
from dojo.test import views
urlpatterns = [
# tests
url(r'^calendar/tests$', views.test_calendar, name='test_calendar'),
url(r'^test/(?P<tid>\d+)$', views.view_test,
name='view_test'),
url(r'^test/(?P<tid>\d+)/ics$', views.test_ics,
name='test_ics'),
... |
from bisect import bisect_left
from collections import defaultdict
from functools import lru_cache
from pathlib import Path
from typing import DefaultDict, Dict, Iterator, List, Set, Tuple
from automata.fa.dfa import DFA
from automata.fa.nfa import NFA
from permuta import Av, Perm
from permuta.permutils import all_symm... |
"""
This code compared a couple histograms.
"""
from __future__ import absolute_import, division, \
print_function, unicode_literals
import sys
import logging
import os
import numpy as np
import scipy.sparse as sp
import cv2
cv2.namedWindow('GetArroundASegmentationFailure', 0)
cv2.destroyWindow('GetArroundASegmenta... |
from zeit.cms.i18n import MessageFactory as _
import grokcore.component as grok
import logging
import zeit.cms.browser.interfaces
import zeit.cms.browser.menu
import zeit.cms.checkout.interfaces
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.cms.repository.browser.delete
import zeit.cms.repos... |
import uuid
from collections import defaultdict
from datetime import datetime
from functools import reduce
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.db import models
from django.db.models import F
from django.contrib.postgres.fields import ArrayField
from django.d... |
try:
import textile
except ImportError:
pass
try:
import markdown2
except ImportError:
pass
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
from ccgallery import settings as c_settings
from ccgallery.models import get_model
register = template.L... |
from prpy.robot import Robot
class WAMRobot(Robot):
def __init__(self, robot_name=None):
Robot.__init__(self, robot_name=robot_name)
def CloneBindings(self, parent):
Robot.CloneBindings(self, parent) |
import example_0090
example_0090.function_manipulate_objects_strict(1970)
example_0090.function_manipulate_objects_strict('Origin')
try:
example_0090.function_manipulate_objects_strict(3.14)
except TypeError as ex:
print '***', ex |
import math
FFT_BASELINE = -10
def compute_fft(dut, data_pkt, reflevel_pkt):
"""
Return an array of dBm values by computing the FFT of
the passed data and reference level.
:param dut: WSA device
:type dut: pyrf.devices.thinkrf.WSA4000
:param data_pkt: packet containing samples
:type data_pkt... |
"""Trac Environment model and related APIs."""
from __future__ import with_statement
import os.path
import setuptools
import sys
from urlparse import urlsplit
from trac import db_default
from trac.admin import AdminCommandError, IAdminCommandProvider
from trac.cache import CacheManager
from trac.config import *
from tr... |
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
urlretrieve('http://alps.comp-phys.org/static/software/releases/clapack.zip', 'clapack.zip')
import zipfile
with zipfile.ZipFile('clapack.zip') as fz:
fz.extractall() |
from typing import List
class ToTypeClass2(object):
"""description of class"""
def __init__(self, **kargs):
"""
:param kargs:
"""
self.__id = kargs.get('id', None)
self.__symbol = kargs.get('symbol', '')
self.__synonyms = kargs.get('synonyms', [])
self.__l... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('files', '__first__'),
('auth', '0009_alter_user_last_name_max_length'),
migrations.swappable_dependency(sett... |
import unittest
import tempfile
import shutil
import os
from redi import redi
from redi.utils import SimpleConfigParser
class TestReadConfig(unittest.TestCase):
def setUp(self):
_configure_redi_logger()
def test_read_config(self):
configuration_directory = tempfile.mkdtemp()
try:
... |
print("hello") |
import os
import glob
from filetools import pruneFilelist
def concatenatePDFs(filelist, pdfname, pdftk='pdftk', gs='gs', cleanup=False,
quiet=False):
"""
Takes a list or a string list of PDF filenames (space-delimited), and an
output name, and concatenates them.
It first tries pdftk ... |
"""
Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditio... |
"""Starts the vtgate and vtocc processes."""
import json
import logging
import os
import socket
import subprocess
import time
import urllib
from vttest import environment
from vttest import fakezk_config
class ShardInfo(object):
"""Contains the description for setting up a test shard.
Every shard should have a uniq... |
class CircleCraterError(Exception):
def __init__(self, message_str = ''):
self.message = message_str |
from goscale.cms_plugins import GoscaleCMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
import models
GOSCALE_VIDEOS_PLUGIN_TEMPLATES = getattr(settings, 'GOSCALE_VIDEOS_PLUGIN_TEMPLATES', (
('videos.html', _('Videos')),
)... |
from tsrc.workspace.config import WorkspaceConfig
from path import Path
def test_save(tmp_path: Path) -> None:
""" Check that workspace config can be written
and read.
Note: the writing is done by `tsrc init`, all other
commands simply read the file.
"""
config = WorkspaceConfig(
manifes... |
"""This module contains PerformanceLogProcessor and subclasses.
Several performance tests have complicated log output, this module is intended
to help buildsteps parse these logs and identify if tests had anomalies.
The classes in this file all have the same method ProcessLine, just like
GTestLogParser in //tools/build... |
import os
ROOT_PATH = os.path.dirname( __file__ )
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DBCONF = os.path.join( ROOT_PATH, 'rs', 'rawsdata.conf' )
ADMINS = (
('alex', 'alex@centrumcyfrowe.pl'),
('', ''),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'sqlite3',
'NAME': 'session.db',
... |
from __future__ import print_function, division
import sys,os
qspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,qspin_path)
from quspin.basis import boson_basis_general
from quspin.basis.transformations import square_lattice_trans
from quspin.operators import hamiltonian
import numpy as np
def test(sps,Lx,... |
from .read import (
read_csv,
read_excel,
read_umi_tools,
read_hdf,
read_loom,
read_mtx,
read_text,
read_zarr,
read_h5ad,
)
from .write import write_csvs, write_loom, _write_h5ad, write_zarr
from . import h5ad |
from __future__ import absolute_import
from .__init__ import commandline, parse
commandline(parse) |
"""
Locals computes the value of locals()
"""
from pythran.passmanager import ModuleAnalysis
import pythran.metadata as md
import gast as ast
class Locals(ModuleAnalysis):
"""
Statically compute the value of locals() before each statement
Yields a dictionary binding every node to the set of variable names d... |
from devilry.simplified import (SimplifiedModelApi, simplified_modelapi,
FieldSpec, PermissionDenied)
from ..models import Config
import examiner
@simplified_modelapi
class SimplifiedConfig(SimplifiedModelApi):
class Meta:
model = Config
resultfields = FieldSpec('grad... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'UserKey.last_modified'
db.alter_column('sshkey_userkey', 'last_modified', self.gf(... |
import sys
import os
import warnings
import re
SEPARATOR = ';;'
class Contact:
def __init__(self, *args):
self.data = args
@property
def name(self):
return self.data[0]
@property
def tags(self):
return list(self.data[1:])
@property
def phone(self):
for d in se... |
import unittest
from test.primaires.connex.static.commande import TestCommande
from test.primaires.joueur.static.joueur import ManipulationJoueur
from test.primaires.scripting.static.scripting import ManipulationScripting
class TestTraite(TestCommande, ManipulationJoueur, ManipulationScripting,
unittest.TestCas... |
import logging
import platform
import sys
import linux
log = logging.getLogger(__name__)
def detect_init(*args, **kwargs):
"""Detect the service manager running on this box
args/kwargs match those of service.Service
:return: The appropriate Service object for this system
"""
detected_os = platfor... |
"""
WSGI config for {{ project_name }} project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPL... |
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.utils import simplejson
from django.db import models
from waiter.apis.twitter import TwitterMenu
from .managers import TwitterIdentificationManager
import oauth2
import urlli... |
"""The morph-tool command line launcher."""
import logging
import click
import matplotlib.pyplot as plt
from neurom import load_neuron
from neurom.view.plotly import draw as plotly_draw
from neurom.viewer import draw as pyplot_draw
logging.basicConfig()
logger = logging.getLogger('morph_tool')
logger.setLevel(logging.I... |
import sys
import os
cwd = os.getcwd()
project_root = os.path.dirname(cwd)
sys.path.insert(0, project_root)
import flib
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'flib'
copyright = u'2015, bab'
version = flib.__versi... |
from flask import Flask
from flask.ext.login import LoginManager
from flask.ext.assets import Environment, Bundle
from .models import db, User
from .views import module
__all__ = ('create_app',)
def _init_db(app):
"""Setup for Flask-SQLAlchemy."""
db.app = app
db.init_app(app)
def _init_assets(app):
"""... |
"""Various small physics functions
Mostly obtained from PyARTS
"""
import logging
import numbers
import datetime
import calendar
import itertools
import numpy
import scipy.interpolate
import matplotlib
import matplotlib.dates
import numexpr
import pyproj
import pint
from .constants import (h, k, R_d, R_v, c, M_d, M_w, ... |
from django.conf.urls.defaults import *
from resources.models import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^tag/(?P<tag_id>\d+)/$', 'resources.views.resources_tagged', name='resources-tagged' ),
url(r'^all$', 'django.views.generic.date_based.archive_ind... |
import time
class NomatimRateLimitCache:
"""
Keep a cache of results, and limit lookups to 1 per second.
"""
def __init__(self, method):
self.method = method
self.cache = {}
self.last_call = time.time() - 100
def __call__(self, *args):
return self.cache.get(args, self... |
""" mdwf functions. version 0.5
"""
import os
import subprocess
import sys
from collections import OrderedDict
import json
import shutil
import fileinput
import hashlib
import time
import datetime
from glob import glob
import re
DEFAULT = '\033[0m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW... |
"""Airlinese.
---
layout: post
source: Garner's Modern American Usage
source_url: http://bit.ly/1T4alrY
title: Airlinese
date: 2014-06-10 12:31:19
categories: writing
---
Airlinese.
"""
from proselint.tools import existence_check, memoize
@memoize
def check(text):
"""Check the text."""
err = ... |
import zmq
import time
from mongrel2.request import Request
try:
import json
except:
import simplejson as json
CTX = zmq.Context()
HTTP_FORMAT = "HTTP/1.1 %(code)s %(status)s\r\n%(headers)s\r\n\r\n%(body)s"
MAX_IDENTS = 100
def http_response(body, code, status, headers):
payload = {'code': code, 'status': s... |
from fnmatch import fnmatch
from os.path import splitext, split, relpath
from lanyon.utils import OrderedDict
registry = OrderedDict()
def get_url(page):
"Returns the final output url string for `page`"
urlfunc = get_url_func(page)
url = urlfunc(page)
return url
def get_url_func(page):
"""
Retur... |
import json
from django import forms
from django.template.loader import render_to_string
from django.utils import translation
from django.utils.functional import cached_property
from wagtail.core.blocks import FieldBlock
DEFAULT_TABLE_OPTIONS = {
'minSpareRows': 0,
'startRows': 3,
'startCols': 3,
'colHe... |
"""Discussions feature flags"""
from functools import wraps
from django.conf import settings
SOCIAL_AUTH_API = "SOCIAL_AUTH_API"
NOVOED_INTEGRATION = "NOVOED_INTEGRATION"
def is_enabled(name, default=None):
"""
Returns True if the feature flag is enabled
Args:
name (str): feature flag name
d... |
"""
Each tests should start in an empty directory that will be destroyed at the end.
"""
from __future__ import unicode_literals
import unittest
import tempfile
import os
import os.path
import shutil
import re
import gitchangelog
def set_env(key, value):
def decorator(f):
def _wrapped(*args, **kwargs):
... |
"""
Copyright (c) 2013, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of ... |
"""
Interfaces with Egardia/Woonveilig alarm control panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.egardia/
"""
import logging
import requests
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alar... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/creature/npc/droid/shared_dark_trooper_phase_ii_base.iff"
result.attribute_template_id = 3
result.stfName("droid_name","dark_trooper_phase_ii_base")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resu... |
import re
import urllib2
import urllib
import lxml.html
import requests
from flask import current_app as app
from shiva.lyrics import LyricScraper
from shiva.utils import get_logger
log = get_logger()
class MetroLyrics(LyricScraper):
"""
"""
def __init__(self, artist, title):
self.artist = artist
... |
def hello(name):
name = name + '!!!!!'
print 'Hello', name |
class Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
while n > 1:
if n % 3 == 0:
n //= 3
else:
break
return n == 1
def main():
solver = Solution()
tests = [
((1,)... |
from __future__ import absolute_import
from calc.tests.base import CalcTestBase
class TestDivide(CalcTestBase):
def test_divide_two_numbers(self):
resp = self.app.get('/divide?numbers=3&numbers=4')
self.assertEqual('0.75', resp.data)
def test_divide_three_numbers(self):
resp = self.app.g... |
from babelfish import Language
import os
import pytest
from subliminal.providers.argenteam import ArgenteamSubtitle, ArgenteamProvider
from vcr import VCR
vcr = VCR(path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
match_on=['method', 'scheme', 'hos... |
import os
from .requestHandlers.graphiql import GraphiQLRequestHandler
from .requestHandlers.graphql import GraphQLRequestHandler
root_dir = os.path.dirname(__file__)
template_dir = os.path.join(root_dir, 'templates')
static_dir = os.path.join(root_dir, 'static', 'build') |
"""Copy a file or directory. Multiple source files may be specified if the destination is
an existing directory.
"""
from __future__ import print_function
import argparse
import os
import shutil
def pprint(path):
if path.startswith(os.environ['HOME']):
return '~' + path.split(os.environ['HOME'], 1)[-1]
... |
import numpy
np=numpy
import sys
import pickle
import time
import os
import os.path
import subprocess
import pipes
import h5py
import itertools
import matchmmd
from gen_deepart import read_lfw_attributes,attr_pairs
from gen_deepart import deepart_reconstruct
colorization=False
attr=10
source_k=2000
target_k=2000
test_i... |
import sys
import os
import math
from orbit.utils import NamedObject, TypedObject
class Waveform(NamedObject, TypedObject):
"""
The base abstract class of waveforms hierarchy.
"""
def __init__(self, name = "no name"):
NamedObject.__init__(self, name)
TypedObject.__init__(self, "base waveform")
class KickerWavef... |
""" A script to manage development tasks """
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
from subprocess import call, check_call, CalledProcessError
from manager import Manager
manager = Manager()
BASEDIR = p.dirname(__file__)
de... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
BASE_D... |
from django.core.management.base import BaseCommand, CommandError
from django.template.loader import render_to_string
from pyconcz_2017.proposals.models import Talk, Workshop, FinancialAid
PROPOSAL_MAP = dict(
talk=Talk.objects.filter(accepted=True),
workshop=Workshop.objects.filter(accepted=True, type='worksho... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/space/debris/shared_xwing_debris_d.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
"""
Some codes from
https://github.com/openai/InfoGAN/blob/master/infogan/misc/custom_ops.py
"""
from __future__ import division
from __future__ import print_function
import prettytensor as pt
from tensorflow.python.training import moving_averages
import tensorflow as tf
from prettytensor.pretty_tensor_class import Pha... |
"""Utils.py - Utilities for ruffus pipelines
============================================
Reference
---------
"""
import inspect
import sys
def isTest():
"""return True if the pipeline is run in a "testing" mode.
This method checks if ``-is-test`` has been given as a
command line option.
"""
return ... |
import logging
from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand
from grano.views import app
from grano.model import Project
from grano.logic import import_schema, export_schema
from grano.logic import import_aliases, export_aliases
from grano.logic import rebuild as rebuild_
from grano.... |
import sys
sys.path.insert(0, '../')
import pyuv
def on_channel_write(handle, error):
global channel, tcp_server
channel.close()
tcp_server.close()
def on_ipc_connection(handle, error):
global channel, connection_accepted, loop, tcp_server
if connection_accepted:
return
conn = pyuv.TCP(l... |
"""Import CLTK corpora.
TODO: Fix so ``import_corpora()`` can take relative path.
TODO: Add https://github.com/cltk/pos_latin
"""
from cltk.corpus.chinese.corpora import CHINESE_CORPORA
from cltk.corpus.coptic.corpora import COPTIC_CORPORA
from cltk.corpus.greek.corpora import GREEK_CORPORA
from cltk.corpus.latin.corpo... |
from django.conf.urls import url
import comments.views
urlpatterns = [
url(r'^load/$', comments.views.load),
url(r'^send/comment/$', comments.views.send_comment),
url(r'^send/reply/$', comments.views.send_reply),
] |
from pyamg.gallery import poisson
from pyamg import smoothed_aggregation_solver
from pyamg.util.utils import profile_solver
from pyamg.relaxation.smoothing import change_smoothers
from numpy.testing import TestCase
methods = ['gauss_seidel',
'jacobi',
'richardson',
'sor',
'ch... |
from netforce.model import Model, fields, get_model
import time
from netforce import database
from netforce.access import get_active_user, set_active_user
from netforce.access import get_active_company
class Move(Model):
_name = "stock.move"
_string = "Stock Movement"
_name_field = "number"
_multi_compa... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_bolma_hue.iff"
result.attribute_template_id = 9
result.stfName("monster_name","bolma")
#### BEGIN MODIFICATIONS ####
result.setStringAttribute("radial_filename", "radials/player_pet.py")
result.options_mask... |
"""
Load pp, plot and save
"""
import os, sys
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from mpl_toolkits.basemap import Basemap
rc('font', family = 'serif', ... |
class TrieNode(object):
def __init__(self):
self.is_file = False
self.children = {}
self.content = ""
class FileSystem(object):
def __init__(self):
self.__root = TrieNode()
def ls(self, path):
"""
:type path: str
:rtype: List[str]
"""
c... |
import api
import pymongo
import spur
import json
from api.common import validate, check, WebException, InternalException, safe_fail
from voluptuous import Schema, Required, Length
server_schema = Schema({
Required("name"): check(
("Name must be a reasonable string.", [str, Length(min=1, max=128)])),
Re... |
from setuptools import setup, find_packages
import sys
if sys.version_info < (2, 6):
print("THIS MODULE REQUIRES PYTHON 2.6 OR LATER. YOU ARE CURRENTLY USING PYTHON " + sys.version)
sys.exit(1)
import PyBaiduYuyin
setup(
name="PyBaiduYuyin",
version=PyBaiduYuyin.__version__,
packages=["PyBaiduYuyin"... |
import numpy as np
from collections import defaultdict
from .util import stacklast
from .testing import check_conversion
from .basics import (sRGB1_to_sRGB1_linear, sRGB1_linear_to_sRGB1,
sRGB1_linear_to_XYZ100, XYZ100_to_sRGB1_linear,
XYZ_to_xyY, xyY_to_XYZ,
... |
import os
import fcntl
from select import select
from collections import namedtuple
from evdev import _input, _uinput, ecodes, util
from evdev.events import InputEvent
class EvdevError(Exception):
pass
_AbsInfo = namedtuple('AbsInfo', ['value', 'min', 'max', 'fuzz', 'flat', 'resolution'])
_KbdInfo = namedtuple('Kbd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.