code stringlengths 1 199k |
|---|
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("search", "0001_squashed_0003_filter_tags"),
]
operations = [
migrations.AlterModelOptions(
name="filter", options={"base_manager_name": "objects"},
),
] |
"""Event tracker backend that saves events to a python logger."""
from __future__ import absolute_import
from datetime import datetime
from datetime import date
import logging
import json
from pytz import UTC
MAX_EVENT_SIZE = 1024 # 1 KB
class LoggerBackend(object):
"""
Event tracker backend that uses a python... |
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):
# Deleting field 'ProcessorCategory.maintainer'
db.delete_column(u'core_processorcategory', 'maintai... |
import numbers
from ._price import Price
from ._priceful import Priceful
class PriceInfo(Priceful):
"""
Object for passing around pricing data of an item.
"""
price = None
base_price = None
quantity = None
def __init__(self, price, base_price, quantity, expires_on=None):
"""
... |
import logging
import os
import time
import psycopg2
from odoo import sql_db
from odoo.tools import config
_logger = logging.getLogger(__name__)
LOG_MIN_DURATION_STATEMENT = int(config.get("log_min_duration_statement", "-1"))
ENV_VAR = "ODOO_LOG_MIN_DURATION_STATEMENT"
if ENV_VAR in os.environ:
LOG_MIN_DURATION_STA... |
""" InstallView.py
This file is the installation script. It will create an admin user, and create the Settings object
"""
from django.views.generic import TemplateView
from django.conf import settings as django_settings
from signetsim.models import User
from os import utime
from os.path import join
from threading impo... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('schools', '0003_auto_20150520_1438'),
]
operations = [
migrations.AlterField(
model_name='addresslocation',
name='address',
... |
""" Rigaku Supermini
"""
from lims.exportimport.instruments.resultsimport import \
AnalysisResultsImporter, InstrumentCSVResultsFileParser
class RigakuSuperminiCSVParser(InstrumentCSVResultsFileParser):
def __init__(self, csv):
InstrumentCSVResultsFileParser.__init__(self, csv)
self._columns = [... |
from oracle import get_encrypted_data, edit
import sys
def recover_char_at(offset, enc):
modification_char = 'x'
original_encoding = enc[offset]
new_encoding = edit(enc, offset, modification_char)[offset]
recovered_char = chr(ord(modification_char) ^ ord(original_encoding)
^ ord(new... |
import os
import subprocess
from subprocess import Popen, PIPE
from time import sleep
fname = "/tmp/eatmem.c"
fname_exe = "/tmp/pbs_cgroup_eat_mem"
print os.getppid()
p = Popen(["gcc", "-o", fname_exe, fname], stdout=PIPE, stderr=PIPE)
(output, error) = p.communicate()
print output
print error
p = Popen([fname_exe, "30... |
import sys
import csv
sys.path.insert(0, '.')
sys.path.insert(0, '..')
try:
import manage # pylint: disable=unused-import
except ImportError as err:
sys.stderr.write("Could not run script! Is manage.py not in the current"\
"working directory, or is the environment not configured?:\n"\
"{}\n".for... |
import sys
from weboob.capabilities.geolocip import ICapGeolocIp
from weboob.tools.application.repl import ReplApplication
__all__ = ['Geolooc']
class Geolooc(ReplApplication):
APPNAME = 'geolooc'
VERSION = '0.i'
COPYRIGHT = 'Copyright(C) 2010-2011 Romain Bignon'
DESCRIPTION = "Console application allow... |
import os
import re
import string
import shutil
import datetime
import unicodedata
DATE_FORMAT = '%Y-%m-%d-%H:%M:%S'
ICAL_DATE_FORMAT = '%Y%m%dT%H%M%SZ'
ATOM_DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
def mkdir_p(path):
try:
os.makedirs(path)
except OSError:
pass
def add_to_build(main_folder, folder):
... |
from __future__ import unicode_literals
import frappe
from frappe import _, throw, msgprint
from frappe.utils import nowdate
from frappe.model.document import Document
class SMSSettings(Document):
pass
def validate_receiver_nos(receiver_list):
validated_receiver_list = []
for d in receiver_list:
# remove invalid c... |
""" HasUserLoggedIn.py
This file ...
"""
from django import __version__
from signetsim.managers.computations import updateComputationTime
from signetsim.settings.Settings import Settings
class HasUserLoggedIn(object):
def isUserLoggedIn(self, request):
if int(__version__.split('.')[0]) < 2:
return not request.us... |
"""
This file contains tasks that are designed to perform background operations on the
running state of a course.
At present, these tasks all operate on StudentModule objects in one way or another,
so they share a visitor architecture. Each task defines an "update function" that
takes a module_descriptor, a particular... |
"""
Test that various events are fired for models in the student app.
"""
from __future__ import absolute_import
import mock
from django.db.utils import IntegrityError
from django.test import TestCase
from django_countries.fields import Country
from student.models import CourseEnrollmentAllowed
from student.tests.facto... |
from weboob.tools.test import BackendTest
from random import choice
class HelloBankTest(BackendTest):
MODULE = 'hellobank'
def test_bank(self):
l = list(self.backend.iter_accounts())
if len(l) > 0:
a = l[0]
list(self.backend.iter_coming(a))
list(self.backend.i... |
class SimpleWebFeature(object):
"""
A simple, Atom-ish, single geometry (WGS84) GIS feature.
"""
def __init__(self, id=None, geometry=None, title=None, summary=None,
link=None):
"""
Initialises a SimpleWebFeature from the parameters provided.
:param id: Identifie... |
import asyncio
import base64
import json
import aiohttp
import pytest
from aiogremlin import exception
from aiohttp import web
from gremlin_python.driver import request
from goblin import driver, provider
@pytest.mark.asyncio
async def test_get_close_conn(connection):
ws = connection._transport
assert not ws.cl... |
import os
import fnmatch
import six
import pytest
from llnl.util.filesystem import LibraryList, HeaderList
from llnl.util.filesystem import find_libraries, find_headers, find
import spack.paths
@pytest.fixture()
def library_list():
"""Returns an instance of LibraryList."""
# Test all valid extensions: ['.a', '.... |
import os
import unittest
from lxml import etree
import zope.testbrowser.testing
from zope.app.testing.functional import HTTPCaller
from imagestore.testing import http_get, http_post, http_put, http_delete
from imagestore.testing import FunctionalLayer
from z3c.blobfile.testing import FunctionalBlobDocFileSuite
NS = 'h... |
import worker
import win32serviceutil
import win32service
import win32event
import servicemanager
class WindowsService(win32serviceutil.ServiceFramework):
_svc_name_ = "CoalitionWorker"
_svc_display_name_ = "Coalition Worker"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.h... |
from spack.compiler import \
Compiler, get_compiler_version, UnsupportedCompilerFlag
from spack.version import ver
class XlR(Compiler):
# Subclasses use possible names of C compiler
cc_names = ['xlc_r']
# Subclasses use possible names of C++ compiler
cxx_names = ['xlC_r', 'xlc++_r']
# Subclasses... |
from spack import *
import os.path
class Dyninst(CMakePackage):
"""API for dynamic binary instrumentation. Modify programs while they
are executing without recompiling, re-linking, or re-executing."""
homepage = "https://dyninst.org"
git = "https://github.com/dyninst/dyninst.git"
maintainers =... |
import logging
import logging.config
from vFense import VFENSE_LOGGING_CONFIG
from vFense.db.client import db_create_close, r
from vFense.plugins.patching import *
from vFense.core._constants import CommonKeys
from vFense.plugins.patching._constants import CommonAppKeys, CommonSeverityKeys
from vFense.core.agent import... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobileTe... |
import sys
from services.housing import HouseTemplate
from engine.resources.scene import Point3D
def setup(housingTemplates):
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_medium_windowed_deed.iff", "object/building/player/shared_player_house_generic_medium_windowed.iff", 2... |
from distutils.core import setup, Extension
import glob, os, shutil
version = '1.1.34'
from generator import mavgen, mavparse
mdef_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'message_definitions')
dialects_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dialects')
v09_diale... |
"""Infrared intensities"""
import pickle
from math import sqrt
from sys import stdout
import numpy as np
import ase.units as units
from ase.parallel import parprint, paropen
from ase.vibrations import Vibrations
class InfraRed(Vibrations):
"""Class for calculating vibrational modes and infrared intensities
usin... |
__author__ = 'CwT'
from DexParse import *
array = [0x32, 0xa, # if-eq v0, v0, 8
0x26, 0x3, 0x0, # fill-array-data v0, 3
0x0300, 0x2, 0x1, 0x0, 0x0 # fill-array-data-payload 0x0300, width, size, data[]
]
array2 = [0x32, 0xd, # if-eq v0, v0, 8
0x1023, 0x06d7, # new-array v0,... |
"""
Copyright 2012 GroupDocs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... |
import pytest
import logging
import time
from dtest import Tester
since = pytest.mark.since
logger = logging.getLogger(__name__)
_LOG_ERR_ILLEGAL_CAPACITY = "Caused by: java.lang.IllegalArgumentException: Illegal Capacity: -1"
@since('4.0')
class TestInternodeMessaging(Tester):
@pytest.fixture(autouse=True)
def... |
import copy
from oslo_log import log as logging
from tempest_lib.services.identity.v2.token_client import TokenClientJSON
from tempest_lib.services.identity.v3.token_client import V3TokenClientJSON
from tempest.common import cred_provider
from tempest.common import negative_rest_client
from tempest import config
from t... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(1046, 507)
self.resultSave_Button = QtWidgets.QPushButton(Dialog)
self.resultSave_Button.setEnabled(False)
self.resultSave_Button.setGeo... |
from keystone.common import sql
from keystone import exception
from keystone.openstack.common import timeutils
from keystone import trust
class TrustModel(sql.ModelBase, sql.DictBase):
__tablename__ = 'trust'
attributes = ['id', 'trustor_user_id', 'trustee_user_id',
'project_id', 'impersonatio... |
__author__ = 'j.s@google.com (Jeff Scudder)'
import StringIO
import urlparse
import urllib
import httplib
class Error(Exception):
pass
class UnknownSize(Error):
pass
MIME_BOUNDARY = 'END_OF_PART'
class HttpRequest(object):
"""Contains all of the parameters for an HTTP 1.1 request.
The HTTP headers are represent... |
import logging
import random
import netaddr
from sqlalchemy import orm
from sqlalchemy.orm import exc
from quantum.api.v2 import attributes
from quantum.common import exceptions as q_exc
from quantum.common import utils
from quantum.db import api as db
from quantum.db import models_v2
from quantum.openstack.common impo... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from . import random
from . import linalg
from .core import (BLOCK_SIZE, DistArray, assemble, zeros, ones, copy, eye,
triu, tril, blockwise_dot, dot, transpose, add, subtract,
... |
from jsonschema import validators
from unittest import mock
from watcher.api.controllers.v1 import audit_template
from watcher.common import exception
from watcher.common import nova_helper
from watcher.decision_engine.scope import compute
from watcher.tests import base
from watcher.tests.decision_engine.model import f... |
import logging
from django.db import transaction
from orchestra.models import StaffBotRequest
from orchestra.models import StaffingResponse
logger = logging.getLogger(__name__)
@transaction.atomic
def mark_worker_as_winner(worker, task, required_role_counter,
staffing_request_inquiry):
sta... |
import jarray
import inspect
import os
import java.util.ArrayList as ArrayList
from java.lang import Class
from java.lang import System
from java.lang import ProcessBuilder
from java.io import File
from java.util.logging import Level
from org.sleuthkit.datamodel import SleuthkitCase
from org.sleuthkit.datamodel import ... |
"""Tests for full_text_search.py"""
import datetime
import unittest
from google.appengine.ext import db
from google.appengine.ext import testbed
from google.appengine.api import search
import sys
import logging
import delete
import full_text_search
import model
TEST_DATETIME = datetime.datetime(2010, 1, 1, 0, 0, 0)
cla... |
import sys
sys.path.insert(1, "../../../")
import h2o
def cupMediumGBM(ip,port):
train = h2o.import_file(path=h2o.locate("bigdata/laptop/usecases/cup98LRN_z.csv"))
test = h2o.import_file(path=h2o.locate("bigdata/laptop/usecases/cup98VAL_z.csv"))
train["TARGET_B"] = train["TARGET_B"].asfactor()
# Train H2O GBM M... |
"""Common code to stream (and backfill) rows to BigQuery."""
import datetime
import logging
from google.appengine.api import app_identity
from google.appengine.api import datastore_errors
from google.appengine.api import memcache
from google.appengine.ext import ndb
from components import net
from components import uti... |
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('invitations', '0003_auto_20160510_1703'),
]
operations = [
migrations.AddField(
model_name='invitation',
name='expire_date',
field=models.Dat... |
from __future__ import print_function
from collections import namedtuple
import sys
import uuid
from pygments.lexers import PythonLexer
from IPython.external import qt
from IPython.external.qt import QtCore, QtGui
from IPython.core.inputsplitter import InputSplitter, IPythonInputSplitter
from IPython.core.inputtransfor... |
import copy
from glance.common import exception
import glance.domain.proxy
from glance import i18n
_ = i18n._
def is_image_mutable(context, image):
"""Return True if the image is mutable in this context."""
if context.is_admin:
return True
if image.owner is None or context.owner is None:
ret... |
import subprocess
import sys
import netaddr
from oslo_config import cfg
import six
from rally.common.i18n import _
from rally.common import log as logging
from rally.common import sshutils
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
from rally.plugins.openstack.scenarios.nova import utils... |
import RPi.GPIO as GPIO
import time
KEYPAD_TYPE_PRESSED = 11
KEYPAD_TYPE_HOLDOWN = 12
class keypad:
"""keypad (M x N) library for python"""
def __init__(self, **kwargs):
self.valid = False # Default: keypad is not valid to run
self.prekey = None # Previous pressed keycode
self.row = 4
self.co... |
from __future__ import absolute_import, division, print_function, \
with_statement
import os
import sys
import hashlib
import logging
import binascii
import base64
import time
import datetime
import random
import struct
import zlib
import hmac
import hashlib
import shadowsocks
from shadowsocks import common
from sh... |
import json
import uuid
from openstackclient.tests.functional.network.v2 import common
class AddressScopeTests(common.NetworkTests):
"""Functional tests for address scope"""
# NOTE(dtroyer): Do not normalize the setup and teardown of the resource
# creation and deletion. Little is gained whe... |
from __future__ import absolute_import, unicode_literals, print_function, division
from openpyxl import Workbook
from openpyxl.styles import Font
from openpyxl.writer.write_only import WriteOnlyCell
from django.http import HttpResponseBadRequest
from django.contrib.auth.mixins import LoginRequiredMixin
from django.view... |
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.api.v2 import attributes as attr
from neutron.tests.tempest.api import base
LONG_NAME_OK = 'x' * (attr.NAME_MAX_LEN)
class MeteringTestJSON(base.BaseAdminNetworkTest):
"""
Tests the following operations in the Neutron API usin... |
from __future__ import print_function
from __future__ import with_statement
from builtins import object
import sys
import os
import argparse
from VistATestClient import VistATestClientFactory, createTestClientArgParser
from LoggerManager import getTempLogFile
class VistAGlobalExport(object):
def __init__(self):
p... |
import sys
models=['BM25','LMD','LMJ','PL2','TF.IDF']
beta = 500;
b = 0.75;
lam = 0.5;
c = 10.0;
k = 1.2;
mu=500
rb=0.5
params=['b','k','beta','mu','lam','c']
model_params={'BM25':'b','LMD':'mu','LMJ':'lam','PL2':'c'}
if len(sys.argv) < 8:
print "Not enough arguements provided."
print "python lucene_model_bigra... |
import pecan
from pecan import rest
import wsme
import wsmeext.pecan as wsme_pecan
from solum.api.controllers.v1.datamodel import pipeline
from solum.api.controllers.v1 import execution
from solum.api.handlers import pipeline_handler
from solum.common import exception
from solum import objects
from solum.openstack.comm... |
import base64
import copy
import datetime
import functools
import iso8601
import os
import string
import tempfile
import fixtures
import mock
from oslo.config import cfg
from nova.api.ec2 import cloud
from nova.api.ec2 import ec2utils
from nova.api.ec2 import inst_state
from nova.api.metadata import password
from nova.... |
from airflow import DAG
from airflow.contrib.operators import gcs_to_bq, kubernetes_pod_operator
default_args = {
"owner": "Google",
"depends_on_past": False,
"start_date": "2021-03-01",
}
with DAG(
dag_id="world_bank_health_population.country_series_definitions",
default_args=default_args,
max_... |
import os
import random
import sys
import time
import tempfile
import shutil
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):... |
"""The volume types manage extension."""
import six
import webob
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api.v1 import types
from cinder.api.views import types as views_types
from cinder import exception
from cinder.i18n import _
from cinder import rpc
from cinder import util... |
from nailgun.db import db
from nailgun.db.sqlalchemy.models import NovaNetworkConfig
from nailgun.network.manager import AllocateVIPs70Mixin
from nailgun.network.manager import AssignIPs61Mixin
from nailgun.network.manager import AssignIPs70Mixin
from nailgun.network.manager import AssignIPsLegacyMixin
from nailgun.net... |
"""
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
"""
import numpy as np
from mapping import Mapping
from clawpack.clawutil.data import ClawData
import clawpack.seismic.dtopotools_h... |
import struct, time
from warpnet_common_params import *
from warpnet_client_definitions import *
from twisted.internet import reactor
import binascii
STRUCTID_CONTROL = 0x13
STRUCTID_CONTROL_ACK = 0x14
STRUCTID_COMMAND = 0x17
STRUCTID_COMMAND_ACK = 0x18
STRUCTID_OBSERVE_PER = 0x26
STRUCTID_OBSERVE_PER_REQ = 0x27
COMMAN... |
import re
import os
import sys
from setuptools import setup
def read(*paths):
"""
Build a file path from paths and return the contents.
"""
with open(os.path.join(*paths), 'r') as f:
return f.read()
def get_version(package):
"""
Return package version as listed in `__version__` in `init.... |
import logging
import re
from streamlink.plugin import Plugin, PluginError, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
@pluginmatcher(re.compile(r"""
https?://(?:www\.)?bloomberg\.com/
(?:
news/videos/[^/]+/[^/]+... |
from datetime import datetime
from app import app, db
from app.core.models import Role, Games
from datetime import datetime
def create_games():
pass
""" Create games when app starts """
from app.core.models import Games, Role
# Create all tables
# db.create_all()
# Adding roles
# Add users
... |
from __future__ import unicode_literals
from rest_framework.parsers import BaseParser
from rest_framework.exceptions import ParseError
from rest_framework_plist.plist import read
class PlistParser(BaseParser):
'''
Parses Plist-serialized data.
'''
media_type = 'application/x-plist'
def parse(self, s... |
import sys
import time
from django.conf import settings
TEST_DATABASE_PREFIX = 'test_'
class BaseDatabaseCreation(object):
"""
This class encapsulates all backend-specific differences that pertain to
database *creation*, such as the column types to use for particular Django
Fields, the SQL used to creat... |
import re
import os
import argparse
IGNORES = ["iso_c_binding", "iso_fortran_env", "omp_lib", "mpi"]
module_re = re.compile(r"^(\s*)([Mm][Oo][Dd][Uu][Ll][Ee])(\s+)((?:[a-z][a-z_0-9]+))",
re.IGNORECASE|re.DOTALL)
module_proc_re = re.compile(r"(\s*)(module)(\s+)(procedure)(\s+)((?:[a-z][a-z_0-9]+))... |
"""
Classes that wrap the Windows Common controls
.. implicitly document some private classes
.. autoclass:: _toolbar_button
:members:
:show-inheritance:
.. autoclass:: _treeview_element
:members:
:show-inheritance:
.. autoclass:: _listview_item
:members:
:show-inheritance:
"""
from __future__ import ... |
import sys
sys.path.append('..')
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.helpers.hasmethod import hasmethod
from hamcrest import *
import unittest
import datetime
class IsGivenDayOfWeek(BaseMatcher):
"""Matches dates that fall on a given day of the week."""
def __init__(self, day):... |
import sympy.mpmath
from sympy.mpmath import *
from sympy.mpmath.libmp import *
import random
def test_type_compare():
assert mpf(2) == mpc(2,0)
assert mpf(0) == mpc(0)
assert mpf(2) != mpc(2, 0.00001)
assert mpf(2) == 2.0
assert mpf(2) != 3.0
assert mpf(2) == 2
assert mpf(2) != '2.0'
as... |
"""
Different cubehelix palettes
============================
_thumb: .4, .65
"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="white")
rs = np.random.RandomState(50)
f, axes = plt.subplots(3, 3, figsize=(9, 9), sharex=True, sharey=True)
for ax, s in zip(axes.flat, np.lin... |
from .libs import (
objc_method,
NSLayoutAttributeTop, NSLayoutAttributeLeft,
NSLayoutAttributeRight, NSLayoutAttributeBottom,
NSLayoutRelationEqual, NSLayoutRelationGreaterThanOrEqual, NSLayoutRelationLessThanOrEqual,
NSLayoutConstraint,
NSLayoutPriority,
NSRect, NSPoint, NSSize,
NSView... |
import zmq,sys
import signal
import re
import time
def Exit_gracefully(signal, frame):
context.destroy()
print(" signal caught, exiting")
sys.exit(0)
signal.signal(signal.SIGINT, Exit_gracefully)
endpoint="SUB>tcp://localhost:60202"
theMessage=[]
if len(sys.argv)==1:
print "A simple debugging/monitoring tool ... |
import os
import sys
import unittest
import rosgraph.masterapi
import rostest
_ID = '/caller_id'
class MasterApiOnlineTest(unittest.TestCase):
def setUp(self):
self.m = rosgraph.masterapi.Master(_ID)
def test_getPid(self):
val = self.m.getPid()
val = int(val)
def test_getUri(self):
... |
#===============================================================================
# View utils provide utility a.k.a helper methods for views - to ensure that we are
# not cluttering view with helper functions.
# Ensure to add all helper methods here. Views should be reserved for business specific
# ... |
from telemetry.core import util
from telemetry.page.actions import loop
from telemetry.unittest import tab_test_case
AUDIO_1_LOOP_CHECK = 'window.__hasEventCompleted("#audio_1", "loop");'
VIDEO_1_LOOP_CHECK = 'window.__hasEventCompleted("#video_1", "loop");'
class LoopActionTest(tab_test_case.TabTestCase):
def setUp(... |
import sys, os
cwd = os.getcwd()
project_root = os.path.dirname(cwd)
sys.path.insert(0, project_root)
import denton
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u''
copyright = u'2014, Will Kahn-Greene'
version = denton.... |
import helium
import unittest
SMILES = helium.Smiles()
class TestAtomInvariant(helium.AtomInvariant):
def __call__(self, mol, atom):
return atom.element()
class TestExtendedConnectivities(unittest.TestCase):
def test_extended_connectivities(self):
mol = helium.Molecule()
SMILES.read('CCC... |
"""
Definitions for the Dynamics. Dynamics derives from 2 other mixin
classes, which provide functionality for hierachical components and for local
components definitions of interface and dynamics
:copyright: Copyright 2010-2017 by the NineML Python team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from ... |
import os
from tempfile import mkdtemp
gettext = lambda s: s
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
HELPER_SETTINGS = {
'NOSE_ARGS': [
'-s',
],
'ROOT_URLCONF': 'filer.test_utils.urls',
'INSTALLED_APPS': [
'easy_thumbnails',
'mptt',
'filer',... |
from django.utils.translation import ugettext
from chamber.formatters import natural_number_with_currency
def price_humanized(value, inst, currency=None):
"""
Return a humanized price
"""
return (natural_number_with_currency(value, ugettext('CZK') if currency is None else currency) if value is not None
... |
''' Provide U.S. marriage and divorce statistics between 1867 and 2014
Data from the CDC's National Center for Health Statistics (NHCS) database
(http://www.cdc.gov/nchs/).
Data organized by Randal S. Olson (http://www.randalolson.com)
'''
from __future__ import absolute_import, division, print_function, unicode_litera... |
"""
flask.templating
~~~~~~~~~~~~~~~~
Implements the bridge to Jinja2.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from jinja2 import BaseLoader, Environment as BaseEnvironment, \
TemplateNotFound
from .globals import _request_ctx_stack, _app_ctx_sta... |
from flask import session, render_template, redirect, request
from webViews.view import normalView
from webViews.dockletrequest import dockletRequest
from webViews.dashboard import *
import time, re, json, os
class adminView(normalView):
template_path = "settings.html"
@classmethod
def get(self):
re... |
from __future__ import unicode_literals
from datetime import date, datetime
from nose_parameterized import parameterized, param
import dateparser
from tests import BaseTestCase
class TestParseFunction(BaseTestCase):
def setUp(self):
super(TestParseFunction, self).setUp()
self.result = NotImplemented... |
from __future__ import absolute_import, division, print_function
import pytest ; pytest
import mock
from mock import patch
from bokeh.core.validation import check_integrity
from bokeh.plotting import figure
from bokeh.models import GlyphRenderer, Label, Plot, LinearAxis, CustomJS
from bokeh.models.ranges import FactorR... |
"""
The thresholding helper module implements the most popular signal thresholding
functions.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
__all__ = ['threshold', 'threshold_firm']
def soft(data, value, substitute=0):
data = np.asarray(data)
magnitude = np.absolute(dat... |
"""kolibri URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... |
from test_base import BaseTestCase
class TestLiteracy(BaseTestCase):
def test_literacy_path(self):
response = self.client.get('/metadata/literacy')
self.assert_200(response)
def test_literacy_plural_path(self):
response = self.client.get('/metadata/literacies')
self.assert_200(re... |
import sys
import json
import urllib.request as urllib
import distutils.version as duv
url = "https://pypi.python.org/pypi/%s/json" % (sys.argv[1],)
data = json.load(urllib.urlopen(urllib.Request(url)))
versions = list(data["releases"])
versions.sort(key=duv.LooseVersion)
print('\n'.join(versions)) |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailmenus', '0004_auto_20160130_0024'),
]
operations = [
migrations.AddField(
model_name='flatmenuitem',
name='url_append',
... |
"""Fetch a variety of acoustic metrics from The Echo Nest.
"""
import time
import logging
import socket
import os
import tempfile
from string import Template
import subprocess
from beets import util, config, plugins, ui
import pyechonest
import pyechonest.song
import pyechonest.track
log = logging.getLogger('beets')
RE... |
import sys
import numpy as np
import lxmls.sequences.discriminative_sequence_classifier as dsc
import pdb
class StructuredPerceptron(dsc.DiscriminativeSequenceClassifier):
''' Implements a first order CRF'''
def __init__(self, observation_labels, state_labels, feature_mapper,
num_epochs = 10, l... |
from Tkinter import *
master = Tk()
w = Canvas(master, width=200, height=100)
w.pack()
w.create_line(0, 0, 200, 100)
w.create_line(0, 100, 200, 0, fill="red", dash=(4, 4))
w.create_rectangle(50, 25, 150, 75, fill="blue")
mainloop() |
from django.contrib import admin
from django.forms import ModelForm
from blog.models import Category, Post
from django.core.exceptions import PermissionDenied
from suit_redactor.widgets import RedactorWidget
class PageForm(ModelForm):
class Meta:
model = Post
fields = (
'title',
... |
"""
Gather HTTP Response code and Duration of HTTP request
* urllib2
"""
import urllib2
import time
from datetime import datetime
import diamond.collector
class WebsiteMonitorCollector(diamond.collector.Collector):
"""
Gather HTTP response code and Duration of HTTP request
"""
def get_default_config_h... |
from django.core.management.base import NoArgsCommand, CommandError
from apps.bike import control
class Command(NoArgsCommand):
help = 'Updates bike.station for borrows that have ended.'
def handle_noargs(self, *args, **options):
control.update_stations() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.