code stringlengths 1 199k |
|---|
import jtutil
from jtelem import jtelem
class new(jtelem):
def __init__(self):
jtelem.__init__(self)
def classname(self):
return "jtvglue"
def xmlout(self):
return "<vglue/>" |
from time import sleep
from base import WebTest, USER, PASS
from creds import RECIP
from runner import test_runner
class SearchTest(WebTest):
def __init__(self):
WebTest.__init__(self)
self.login(USER, PASS)
self.wait_with_folder_list()
def load_search_page(self):
list_item = sel... |
'''Helper for plotting reblocking plots.'''
import matplotlib.pyplot as plt
def plot_reblocking(block_info, plotfile=None, plotshow=True):
'''Plot the reblocking data.
Parameters
----------
block_info : :class:`pandas.DataFrame`
Reblocking data (i.e. the first item of the tuple returned by ``reblock``).
plotfil... |
from ajenti.com import Interface
class IRequestDispatcher(Interface):
def match(self, uri):
pass
def process(self, req, start_response):
pass
class IContentProvider(Interface):
path = ''
module = ''
js_files = []
css_files = []
widget_files = []
def content_path(self):
... |
"""
This file implements a Rectangle class for geometric operations.
"""
import copy
from dragonfly.windows.point import Point
class Rectangle(Point):
#-----------------------------------------------------------------------
# Methods for initialization, copying, and introspection.
def __init__(self, x1=... |
def itemNames():
return ['droid_memory_module']
def itemChances():
return [100] |
"""
The I{sudsobject} module provides a collection of suds objects
that are primarily used for the highly dynamic interactions with
wsdl/xsd defined types.
"""
from logging import getLogger
from . import tostr
from .compat import basestring
from .utils import is_builtin
log = getLogger(__name__)
def items(sobject):
... |
import unittest
from tenacity import RetryError, retry, stop_after_attempt
from tenacity import tornadoweb
from tornado import gen
from tornado import testing
from .test_tenacity import NoIOErrorAfterCount
@retry
@gen.coroutine
def _retryable_coroutine(thing):
yield gen.sleep(0.00001)
thing.go()
@retry(stop=sto... |
from urllib2 import Request, urlopen
import base64
from tweepy import oauth
from tweepy.error import TweepError
from tweepy.api import API
class AuthHandler(object):
def apply_auth(self, url, method, headers, parameters):
"""Apply authentication headers to request"""
raise NotImplementedError
de... |
import zstackwoodpecker.test_state as ts_header
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template1", \
path_list=[[TestAction.create_volume_snapshot, "vm1-root", "snapshot1"], \
[TestAction.stop_vm, "vm1"], \
[TestAction.star... |
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest import test
CONF = config.CONF
class VolumesSnapshotsTestJSON(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
super(VolumesSnapshotsTest... |
"""
Example Session Command
Make sure you can authenticate before running this command. This command
is currently hard coded to use the Identity service.
For example:
python -m examples.session /tenants
"""
import sys
from examples import common
from examples import connection
from openstack.identity import identi... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('domain', '0020_meta'),
]
operations = [
migrations.AddField(
model_name='attribute',
name='optionsets',
field=models.... |
import mock
from ironic.common import driver_factory
from ironic.common import exception
from ironic.common import states
from ironic.common import utils as cmn_utils
from ironic.conductor import task_manager
from ironic.conductor import utils as conductor_utils
from ironic import objects
from ironic.tests import base ... |
"""Helper utility to save parameter dicts."""
import tvm
import tvm._ffi
_save_param_dict = tvm._ffi.get_global_func("tvm.relay._save_param_dict")
_load_param_dict = tvm._ffi.get_global_func("tvm.relay._load_param_dict")
def save_param_dict(params):
"""Save parameter dictionary to binary bytes.
The result binar... |
from typing import Any
from django.core.management.base import BaseCommand
from django.db.utils import IntegrityError
from django.conf import settings
from zproject.backends import ZulipLDAPUserPopulator
from zerver.models import UserProfile
from zerver.lib.logging_util import create_logger
logger = create_logger(__nam... |
input = """
{d}.
a | c :- d.
a | c :- b.
a :- b.
b :- a.
"""
output = """
{}
{c, d}
{a, b, d}
""" |
from traits.api import Float, Property, Bool, Button, String, Enum
from pychron.core.ui.thread import Thread
from pychron.globals import globalv
from pychron.lasers.laser_managers.base_lase_manager import BaseLaserManager
class RemoteLaserManager(BaseLaserManager):
position = String(enter_set=True, auto_set=False)
... |
from uw_sws.section_status import get_section_status_by_label |
"""Support for Tuya select."""
from __future__ import annotations
from typing import cast
from tuya_iot import TuyaDevice, TuyaDeviceManager
from tuya_iot.device import TuyaDeviceStatusRange
from homeassistant.components.select import SelectEntity, SelectEntityDescription
from homeassistant.config_entries import Config... |
import json
from textwrap import dedent
from typing import Optional
import pytest
from pants.backend.python.target_types import PexExecutionMode
from pants.testutil.pants_integration_test import PantsResult, run_pants, setup_tmpdir
@pytest.mark.parametrize(
("entry_point", "execution_mode", "include_tools"),
[
... |
import tempfile
import io
import sys
import subprocess
MAIN_SCRIPT_URL = "https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py"
def download_with_requests(url, dst):
import requests
resp = requests.get(url, stream=True)
itercontent = resp.iter_content(chunk_size=io... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1ServicePort(object... |
'''
'''
import hashlib
import hmac
Test.Summary = '''
Test url_sig plugin
'''
Test.ContinueOnFail = True
Test.SkipUnless(Condition.PluginExists('url_sig.so'))
url_sig_log_id = Test.Disk.File("url_sig_short.log")
url_sig_log_id.Content = "url_sig.gold"
server = Test.MakeOriginServer("server")
request_header = {
"hea... |
from functools import wraps
from allura import model as M
from ming.orm.ormsession import ThreadLocalORMSession
from pylons import c
def with_user_project(username):
def _with_user_project(func):
@wraps(func)
def wrapped(*args, **kw):
user = M.User.by_username(username)
c.use... |
import datetime
from nova import exception
from nova import objects
from nova.objects import fields
from nova import test
class TestImageMeta(test.NoDBTestCase):
def test_basic_attrs(self):
image = {'status': 'active',
'container_format': 'bare',
'min_ram': 0,
... |
import logging
from collections import OrderedDict
from typing import Dict, Iterable, List, Optional, Tuple
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions import InstallationError
from pip._internal.models.wheel import Wheel
from pip._internal.req.req_install import InstallRequi... |
"""Escaping functions for compiled soy templates.
This module contains the public functions and classes to sanitize content for
different contexts.
The bulk of the logic resides in generated_sanitize.py which is generated by
GeneratePySanitizeEscapingDirectiveCode.java to match other implementations.
Please keep as muc... |
import unittest
from bhdashboard.tests.widgets import timeline
def suite():
suite = unittest.TestSuite()
suite.addTest(timeline.suite())
return suite
if __name__ == '__main__':
unittest.main(defaultTest='suite') |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ImageItemURLQueue'
db.create_table('for_sale_imageitemurlqueue', (
('id', self.gf('django.db.models.fields.... |
"""Test the mib_etherlike module."""
import unittest
from mock import Mock
import os
import sys
TEST_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
SWITCHMAP_DIRECTORY = os.path.abspath(os.path.join(TEST_DIRECTORY, os.pardir))
ROOT_DIRECTORY = os.path.abspath(os.path.join(SWITCHMAP_DIRECTORY, os.pardir))
if TE... |
from setuptools import setup
setup(
name = 'not_zipsafe_egg',
packages = ['lib'],
zip_safe = False
) |
import importlib
import json
import os
from typing import Any, Dict
from django.utils.translation import ugettext as _
from zerver.lib.actions import (
internal_send_huddle_message,
internal_send_private_message,
internal_send_stream_message_by_name,
)
from zerver.lib.bot_config import ConfigError, get_bot_... |
from nailgun.orchestrator import plugins_serializers
from nailgun.orchestrator.priority_serializers import PriorityStrategy
def stage_serialize(serializer, graph_tasks, cluster, nodes):
"""Serialize tasks for given stage
:param serializer: plugins_serializers.BasePluginDeploymentHooksSerializer
:param graph... |
"""Support for Sensors using public Netatmo data."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_NAME, CONF_MODE, CONF_MONITORED_CONDITIONS, TEMP_CELSIUS,
DEVICE_CLASS_TEMPERATURE, DEVIC... |
import sys, os
import time
extensions = ['sphinx.ext.todo']
templates_path = [u'_templates']
source_suffix = '.rst'
source_encoding = u'utf-8-sig'
master_doc = u'index'
project = u'OpenSplice GPB Tutorial'
this_year = time.strftime( '%Y' )
copyright = u'{y}, ADLINK Technology Limited'.format( y = this_year )
print 'Cop... |
"""Database models."""
from __future__ import absolute_import, unicode_literals
from datetime import timedelta
import timezone_field
from celery import schedules
from celery.five import python_2_unicode_compatible
from django.conf import settings
from django.core.exceptions import MultipleObjectsReturned, ValidationErr... |
"""Tests for api.py."""
__author__ = 'aiuto@google.com (Tony Aiuto)'
import json
import os
import gflags as flags
from google.apputils import basetest
from googleapis.codegen import data_types
from googleapis.codegen import language_model
from googleapis.codegen.api import Api
from googleapis.codegen.api import AuthSco... |
"""Module for testing the add/del/show hub command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestHub(TestBrokerCommand):
def test_100_add_hub1_default_org(self):
command = ["add", "hub", "--hub", "hub1", "--fulln... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
class MapQuery(object):
"""Query to retrieve complete ways and relations in an area."""
_QUERY_TEMPLATE = "(node({south},{west},{north},{east});<;);"
def __init__(self, south, west, north, east):
"""
Initialize query with given bounding box.
:param bbox Bounding box with limit values... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import functools
import logging
import os
import shutil
import sys
from collections import defaultdict
from pex.fetcher import Fetcher
from pex.pex import PEX
from pex.... |
from __future__ import division
import datetime
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
class BaseUsage(object):
... |
import os
import stat
import subprocess
from keystone.common import logging
from keystone import config
LOG = logging.getLogger(__name__)
CONF = config.CONF
DIR_PERMS = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
CERT_PERMS = stat.S_... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.backend.jvm.tasks.jvm_compile.base_compile_integration_test import BaseCompileIT
class ZincCompileIntegrationTest(BaseCompileIT):
def test_java_src_zi... |
"""Utility methods for working with WSGI servers."""
import sys
import eventlet
import eventlet.wsgi
import greenlet
from paste import deploy
import routes.middleware
import webob.dec
import webob.exc
from nova import exception
from nova import flags
from nova import log as logging
from nova import utils
FLAGS = flags.... |
import json
import logging
import time
import random
import requests
from .basic import BasicHttpClient
class KylinHttpClient(BasicHttpClient): # pylint: disable=too-many-public-methods
_base_url = 'http://{host}:{port}/kylin/api'
def __init__(self, host, port, version):
super().__init__(host, port)
... |
"""Tests for the inputsplitter module.
Authors
-------
* Fernando Perez
* Robert Kern
"""
import unittest
import sys
import nose.tools as nt
from IPython.core import inputsplitter as isp
from IPython.core.tests.test_inputtransformer import syntax, syntax_ml
from IPython.testing import tools as tt
from IPython.utils imp... |
import time
from datetime import datetime, timedelta
import six
from cqlengine.functions import QueryValue
from cqlengine.operators import BaseWhereOperator, InOperator
class StatementException(Exception): pass
import sys
class UnicodeMixin(object):
if sys.version_info > (3, 0):
__str__ = lambda x: x.__unic... |
import os
import xlog
logger = xlog.getLogger("gae_proxy")
logger.set_buffer(500)
from . import check_local_network
from .config import config, direct_config
from . import host_manager
from front_base.openssl_wrap import SSLContext
from front_base.connect_creator import ConnectCreator
from front_base.ip_manager import ... |
Coordinator = 'Coordinator' # Voodoo Coordinator; it will always be there
Login = 'Login'
UserProcessing = 'UserProcessing'
Proxy = 'Proxy'
Laboratory = 'Laboratory'
Translator = 'Translator'
Experiment = 'Experiment' |
'''
Calcule a soma dos dígitos de um inteiro positivo n. Ex.: sd(123) = 6.
'''
def sd(n):
if n <= 9:
return n
else:
return n % 10 + sd(n//10) |
import os
import typing
import unittest
from threading import Event
from unittest.mock import Mock, call, patch
import pytest
import requests_mock
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from streamlink.session import Streamlink
from streamlink.stream.hls import HLSStream, HLSStreamReader
from... |
from setuptools import setup, find_packages
import versioneer
setup(
name='q2cli',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license='BSD-3-Clause',
url='https://qiime2.org',
packages=find_packages(),
include_package_data=True,
scripts=['bin/tab-qiime'],
e... |
from django.test import TestCase, RequestFactory
from django.conf import settings
from djangobb_forum.models import Post
from djangobb_forum.util import smiles, convert_text_to_html, paginate
class TestParsers(TestCase):
def setUp(self):
self.data_url = "Lorem ipsum dolor sit amet, consectetur http://django... |
from django.db import models
from django.utils.translation import ugettext as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db.models.signals import post_save
from development.models import Project
from django.contrib.auth.models import User
fro... |
"""
Test Program for evaluating the PIL module, writing and reading PNG images
Tom Anderson
"""
from PIL import Image, ImageDraw
import time
filename= "pngtest.png"
imsize= 512
im = Image.new("RGB", (imsize, imsize), "black")
draw = ImageDraw.Draw(im)
draw.setfill("on")
draw.setink("yellow")
draw.line((0, im.size[1], i... |
from copy import deepcopy
import numpy as np
from ... import units as u
from ...tests.helper import (catch_warnings,
pytest, quantity_allclose as allclose,
assert_quantity_allclose as assert_allclose)
from ...utils import OrderedDescriptorContainer
from ...utils... |
"""
Simple GRU RNNs for solving the QA tasks from:
"Towards AI-Complete Question Answering: A Set of Prerequisite Toy Tasks"
J. Weston, A. Bordes, S. Chopra, T. Mikolov, A. Rush
http://arxiv.org/abs/1502.05698
Inspired by (and approximately replicating) the blog post by Stephen Merity:
http://smerity.com/articles/2015/... |
import base64
import collections
import json
import unittest
from decimal import Decimal
from django import forms
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorList
from django.template.loader import render_to_string
from django.test import SimpleTestCase, TestCase
from django.u... |
from __future__ import unicode_literals
from django.db import migrations
INDEX_SQL = """
CREATE INDEX msgs_unlabelled_inbox
ON msgs_message(org_id, created_on DESC)
WHERE is_active = TRUE AND is_handled = TRUE AND is_archived = TRUE AND "type" = 'I';
"""
class Migration(migrations.Migration):
dependencies = [("msgs... |
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^my-project/', include('my_project.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/',... |
import sys
import os
import numpy as np
import pandas
import wqio
from wqio import utils
import pybmpdb
import pynsqd
from .info import POC_dicts
bmpcats_to_use = [
'Bioretention', 'Detention Basin',
'Green Roof', 'Biofilter',
'LID', 'Manufactured Device',
'Media Filter', 'Porous Pavement',
'Retenti... |
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
from MySQLdb import *
from getpass import *
import ConfigParser
from twisted.protocols.basic import LineReceiver
from DatabaseServiceProvider import DatabaseServiceProvider
class TCPLoggingServer(LineReceiver):
def connecti... |
import sys, os, pprint
from datetime import date
template_blitshader_source = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name}.
//
// Copyright {year} The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
... |
from itertools import product
import os
import os.path as op
from unittest import SkipTest
import pytest
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_allclose, assert_equal)
from scipy import stats, linalg
import matplotlib.pyplot as plt
... |
from buzhug import * |
"""
:mod:`operalib.kernels` implements some Operator-Valued Kernel
models.
"""
from numpy import dot, diag, sqrt
from sklearn.metrics.pairwise import rbf_kernel
from sklearn.kernel_approximation import RBFSampler, SkewedChi2Sampler
from scipy.sparse.linalg import LinearOperator
from scipy.linalg import svd
class DotPro... |
import optparse
import parse_deps
import sys
import os
srcdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../src"))
html_warning_message = """
<!------------------------------------------------------------------------------
WARNING: This file is generated by generate_about_tracing_contents.py
Do... |
"""Test RelVars"""
from __future__ import unicode_literals
from copy import copy
from datetime import date, datetime, timedelta
import pytest
from psycopg2 import DatabaseError, IntegrityError
from pyrseas.relation import RelVar, Attribute
from pyrseas.testutils import RelationTestCase
TEST_DATA1 = {'title': "John Doe"... |
try:
import mpmath as mp
except ImportError:
pass
try:
from sympy.abc import x # type: ignore[import]
except ImportError:
pass
def lagrange_inversion(a):
"""Given a series
f(x) = a[1]*x + a[2]*x**2 + ... + a[n-1]*x**(n - 1),
use the Lagrange inversion formula to compute a series
g(x) = ... |
from unittest.mock import patch, Mock
from Crypto.Cipher import AES
from lxml import etree
from federation.protocols.diaspora.encrypted import pkcs7_unpad, EncryptedPayload
from federation.tests.fixtures.keys import get_dummy_private_key
def test_pkcs7_unpad():
assert pkcs7_unpad(b"foobar\x02\x02") == b"foobar"
... |
import sys
sys.path.append('/opt/ofelia/vt_manager/src/python/vt_manager/communication/') |
"""
solace.tests.core_views
~~~~~~~~~~~~~~~~~~~~~~~
Test the kb views.
:copyright: (c) 2009 by Plurk Inc., see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
import unittest
from solace.tests import SolaceTestCase
from solace import models, settings
from solace.... |
'''Helper utilities and decorators.'''
from flask import flash, request, url_for, current_app
from wexplorer.explorer.models import FileUploadPassword
def flash_errors(form, category="warning"):
'''Flash all errors for a form.'''
for field, errors in form.errors.items():
for error in errors:
... |
import atmPy.atmos.air as air
from numpy import abs
class TestAir(object):
def __init__(self):
self.a = air.Air()
self.mu_vals = {'T': [-5, 0, 10, 15, 25],
'mu': [1.7105007E-5, 1.7362065e-5, 1.7869785E-5, 1.8120528E-5, 1.861598E-5]
}
self.rho_v... |
import os
import subprocess
import sys
from config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, DIST_ARCH
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
update_gyp()
def update_gyp():
gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.p... |
import unittest
import os
from pymatgen.analysis.ferroelectricity.polarization import *
from pymatgen.core.structure import Structure
from pymatgen.io.vasp.outputs import Outcar
from pymatgen.io.vasp.inputs import Potcar
from pymatgen.util.testing import PymatgenTest
import numpy as np
test_dir = os.path.join(os.path.d... |
import unittest
from .testcase import BulbsTestCase
from bulbs.model import Node, NodeProxy, Relationship, RelationshipProxy
from bulbs.property import Integer, String, DateTime, Bool
from bulbs.utils import current_datetime
class Knows(Relationship):
label = "knows"
timestamp = DateTime(default=current_datetim... |
from rx import Observable
from rx.internal import extensionmethod
@extensionmethod(Observable, name="slice")
def slice_(self, start=None, stop=None, step=1):
"""Slices the given observable. It is basically a wrapper around the
operators skip(), skip_last(), take(), take_last() and filter().
This marble diag... |
"""
Holds the controlfields plugin.
"""
__author__ = 'Jonny Lamb'
__copyright__ = ', '.join([
'Copyright © 2008 Jonny Lamb',
'Copyright © 2010 Jan Dittberner',
'Copyright © 2012 Nicolas Dandrimont',
])
__license__ = 'MIT'
from debian import deb822
import logging
from debexpo.lib import c... |
import re
import numpy as np
import netCDF4
import sys
import pdb
outfile = sys.argv[1]
f = open('../KenaiRiverTemps.dat', 'r')
f.readline()
f.readline()
ttime = []
temp = []
salt = []
for line in f:
nul, a, b, c = re.split('\s+', line)
ttime.append(float(a))
temp.append(float(b))
salt.append(0.0)
out =... |
from __future__ import unicode_literals, print_function
import imaplib, poplib
from frappe.utils import cint
def get_port(doc):
if not doc.incoming_port:
if doc.use_imap:
doc.incoming_port = imaplib.IMAP4_SSL_PORT if doc.use_ssl else imaplib.IMAP4_PORT
else:
doc.incoming_port = poplib.POP3_SSL_PORT if do... |
__author__ = 'rochelle' |
"""
Created on Tue Dec 15 09:51:21 2015
@author: dan
"""
import pandas as pd
from helper import *
from scipy.optimize import curve_fit
conditions = pd.DataFrame.from_csv('../data/growth_conditions.csv')
conditions = conditions[conditions['reference']=='Schmidt et al. 2015']
conditions = conditions[conditions['strain']=... |
"""
* Palindrome Index (Python)
* HackerRank Algorithm Challenge
* https://www.hackerrank.com/challenges/two-strings
*
* michael@softwareontheshore.com
*
"""
testA = 'hello\nworld'
testB = 'hi\nworld'
def testTwoStrings(input):
input = input.split('\n')
textA = input[0]
textB = input[1]
# remove ... |
from flask import request
from werkzeug.exceptions import NotFound
from indico.modules.attachments.models.attachments import Attachment, AttachmentType
from indico.modules.attachments.models.folders import AttachmentFolder
class SpecificAttachmentMixin:
"""Mixin for RHs that reference a specific attachment."""
... |
"""
Unit tests for easyconfig/parser.py
@author: Stijn De Weirdt (Ghent University)
"""
import os
import sys
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered
from unittest import TextTestRunner
from vsc.utils.fancylogger import setLogLevelDebug, logToScreen
import easybuild.tools.build_log
from... |
"""
Python standard logging doesn't super-intelligent and won't expose filehandles,
which we want. So we're not using it.
Copyright 2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Li... |
import unittest
import serial
import struct
import sys
import StringIO
import time
from collections import namedtuple
sys.path.append('..')
import esptool, espefuse
global serialport
serialport = None
class EspEfuseArgs(object):
def __init__(self):
self.do_not_confirm = True
self.no_protect_key = Fa... |
from unidecode import unidecode
from django.template.defaultfilters import slugify as django_slugify
from django.utils import crypto
def slugify(string):
string = unicode(string)
string = unidecode(string)
return django_slugify(string.replace('_', ' '))
def random_string(length):
return crypto.get_rando... |
"""
Simple shim for mspms development.
"""
import msprime.cli
if __name__ == "__main__":
msprime.cli.mspms_main() |
import numpy as np
from hyperspy.components1d import EELSArctan
def test_function2():
g = EELSArctan()
g.A.value = 10
g.k.value = 2
g.x0.value = 1
np.testing.assert_allclose(g.function(0), 4.63647609)
np.testing.assert_allclose(g.function(1), 10*np.pi/2)
np.testing.assert_allclose(g.function... |
from django.db import models
from django.contrib.auth.models import User
from django.forms import ValidationError
import datetime
YEAR_CHOICES = []
for y in range((datetime.datetime.now().year - 7), (datetime.datetime.now().year + 1)):
YEAR_CHOICES.append((y, y))
SEX_CHOICES = (
('Laki-laki', 'Laki-laki'),
... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import copy, logging
from functools import partial
from collections import defaultdict, n... |
__author__ = 'ketchup'
__version__= '0.1'
__modified_by = 'ketchup'
import sys
import xml.dom.minidom
class Script:
scriptId = ''
output = ''
def __init__( self, ScriptNode ):
if not (ScriptNode is None):
self.scriptId = ScriptNode.getAttribute('id')
self.output = ScriptNod... |
import numpy as np
from sqlalchemy import Column, Integer, ForeignKey, \
String, Unicode, LargeBinary
from sqlalchemy.orm import relationship
from chemiris.models import Base, JSONDict
from chemiris.timeseries.TimeSeries import dumps, loads
import chemiris.peaks.Math as peakmath
class Peak(Base):... |
"""
pythoner.net
Copyright (C) 2013 PYTHONER.ORG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in... |
'''
Constants for GoodCrypto app.
Copyright 2014-2016 GoodCrypto
Last modified: 2016-11-07
'''
import os, os.path
WARNING_WARNING_WARNING_TESTING_ONLY_DO_NOT_SHIP = False
if WARNING_WARNING_WARNING_TESTING_ONLY_DO_NOT_SHIP:
WARNING = 'WARNING! WARNING! WARNING! TESTING ONLY! DO NOT SHIP!'
PROJECT = 'Goo... |
def dict_to_css(dictionary, name, local):
# todo: decide if we need `word-wrap: break-word;` or not?
KEYS = {
'fontStyle' : 'font-style',
'foreground': 'color',
'background': 'background-color'
}
output = []
output.append('/*\n*{auth}\n*{name} syntax highlight theme\n*\n*{com... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.