code stringlengths 1 199k |
|---|
mangoes = 5
manGoes = mangoes + 5
print mangoes / 5 |
from sugar3.activity import bundlebuilder
if __name__ == "__main__":
bundlebuilder.start() |
import json
districts = {
11: ('Andrew Cohen', 'Bronx'),
22: ('Costa Constantinides', 'Queens'),
36: ('Robert Cornegy', 'Brooklyn'),
35: ('Laurie Cumbo', 'Brooklyn'),
30: ('Elizabeth Crowley', 'Queens'),
40: ('Mathieu Eugene', 'Brooklyn'),
21: ('Julissa Ferreras', 'Queens'),
44: ('David ... |
import os
import platform
import sys
from webkitpy.common.system.executive import Executive
class DeprecatedPort(object):
results_directory = "/tmp/layout-test-results"
# FIXME: This is only used by BotInfo.
def name(self):
return self.__class__
def flag(self):
if self.port_flag_name:
... |
import django.db.transaction
import tldap.transaction
from django.conf import settings
from django.core.management.base import BaseCommand
from karaage.people.models import Person
class Command(BaseCommand):
help = "Lock all training accounts"
@django.db.transaction.atomic
@tldap.transaction.commit_on_succe... |
from __future__ import unicode_literals
from indico.core.db import db
from indico.util.string import return_ascii
class LegacyEventMapping(db.Model):
"""Legacy event ID mapping
Legacy events (imported from CDS agenda) have non-numeric IDs
which are not supported by any new code. This mapping maps them
t... |
import unittest
from mock import patch, sentinel, MagicMock
import pysparc.messages
class BaseMessageTest(unittest.TestCase):
def setUp(self):
self.msg = pysparc.messages.BaseMessage()
def test_attributes(self):
self.assertEqual(self.msg.identifier, None)
self.assertEqual(self.msg.contai... |
import logging
common_globals = {}
execfile_('common.py', common_globals)
logger = logging.getLogger('plugin.xivo-yealink')
MODEL_VERSIONS = {
u'T19P': u'31.72.0.75',
u'T20P': u'9.72.0.80',
u'T21P': u'34.72.0.75',
u'T22P': u'7.72.0.80',
u'T26P': u'6.72.0.80',
u'T28P': u'2.72.0.80',
u'T41P': ... |
import django_tables2 as tables
from django_tables2.utils import A
from django.utils.safestring import mark_safe
from .models import Machine, MachineCategory, Account
class MachineTable(tables.Table):
name = tables.LinkColumn(
'kg_machine_detail', args=[A('pk')])
status = tables.Column(
empty_va... |
import json
from collections import OrderedDict
import click
from ..core import Graph
from ..filtering import filter_names
from ..workflow import Workflow
@click.command()
@click.argument("targets", nargs=-1)
@click.pass_obj
def info(obj, targets):
"""Display information about a target."""
workflow = Workflow.f... |
import ctypes
if ctypes.sizeof(ctypes.c_void_p) == 4:
POINTER_T = ctypes.POINTER
else:
# required to access _ctypes
import _ctypes
# Emulate a pointer class using the approriate c_int32/c_int64 type
# The new class should have :
# ['__module__', 'from_param', '_type_', '__dict__', '__weakref__',... |
import os, sys, signal, random, subprocess, time, tempfile
import numpy
import logging
from west.states import BasisState, InitialState
log = logging.getLogger(__name__)
SIGNAL_NAMES = {getattr(signal, name): name for name in dir(signal)
if name.startswith('SIG') and not name.startswith('SIG_')}
import ... |
from netzob.Model.Vocabulary.Types.Raw import Raw
from netzob.Model.Vocabulary.Types.ASCII import ASCII
from netzob.Model.Vocabulary.Types.Integer import Integer
from netzob.Model.Vocabulary.Types.BitArray import BitArray
from netzob.Model.Vocabulary.Types.HexaString import HexaString
from netzob.Model.Vocabulary.Types... |
import sys
import os
import ConfigParser
from getpass import getpass, getuser
import string
import re
import getopt
import logging
import grp
import time
import glob
from utils import get_aliases
__version__ = "0.9.16"
required_config = ['allowed', 'forbidden', 'warning_counter']
if sys.exec_prefix != '/usr':
# for... |
from pyphi.utils import hamming_emd
def test_cause_info(s):
mechanism = (0, 1)
purview = (0, 2)
answer = hamming_emd(
s.cause_repertoire(mechanism, purview),
s.unconstrained_cause_repertoire(purview))
assert s.cause_info(mechanism, purview) == answer
def test_effect_info(s):
mechanis... |
import getopt
import sys
import os
class OptionConfigurationError(Exception):
pass
def makeHandler(handler):
def make(state=None):
return handler
return make
def option_names_from_option_list(option_list):
names = []
for option in option_list:
for name in option['short']:
... |
"""Unit tests for resumable streaming upload functions and classes."""
from __future__ import absolute_import
from hashlib import md5
import os
import pkgutil
from gslib.exception import CommandException
from gslib.hashing_helper import CalculateHashesFromContents
from gslib.hashing_helper import CalculateMd5FromConten... |
'''
Created on Nov 25, 2014
@author: tedlaz
'''
from PyQt4 import QtGui, QtCore, Qt
import fld__parameters as par
from form_find import FormFind
from utils import sqlite3_methods as tu
class ButtonText2(QtGui.QWidget):
def __init__(self, pin, parent=None):
super(ButtonText2, self).__init__(parent)
#... |
import datetime
from nose.plugins.attrib import attr
from nose.tools import eq_
from socorro.external.postgresql.search import Search
from socorro.lib import datetimeutil
from unittestbase import PostgreSQLTestCase
@attr(integration='postgres') # for nosetests
class IntegrationTestSearch(PostgreSQLTestCase):
"""Te... |
from py4j.clientserver import ClientServer, JavaParameters
gateway = ClientServer(java_parameters=JavaParameters(auto_convert=True))
gs = gateway.entry_point
gs.disableInput()
gs.cameraStop()
gs.minimizeInterfaceWindow()
gs.setRotationCameraSpeed(80)
gs.setTurningCameraSpeed(100)
gs.setCameraSpeed(30)
gs.setCameraFocus... |
"""
Contains code related to computing discount percentage
and discount applicability.
WARNING:
Keep in mind that the code in this file only applies to discounts controlled in the lms like the first purchase offer,
not other discounts like coupons or enterprise/program offers configured in ecommerce.
"""
from datetime ... |
from south.db import db
from django.db import models
from frontend.models import *
class Migration:
def forwards(self, orm):
# Adding model 'Alerts'
db.create_table('frontend_alerts', (
('id', orm['frontend.alerts:id']),
('content_type', orm['frontend.alerts:content_type']),
... |
from django.test import SimpleTestCase
from base.models.authorized_relationship import AuthorizedRelationshipList
from base.models.enums.education_group_types import TrainingType, GroupType
from program_management.models.enums.node_type import NodeType
from program_management.tests.ddd.factories.authorized_relationship... |
"""Stub implementation of the verification service.
This implements the same interface as the verification service in
the edx-platform LMS, but it sends the user to a fake reverification flow.
We can test the Reverification XBlock without actually submitting
photos!
"""
from django.core.urlresolvers import reverse
from... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("delivery", "0015_matchreport_identifier")]
operations = [
migrations.AlterField(
model_name="report",
name="contact_voicemail",
fi... |
from . import res_company
from . import res_partner
from . import stock_location |
import pytest
from shuup.notify import Event
from shuup_tests.notify.fixtures import ATestEvent, get_initialized_test_event
@pytest.mark.django_db
def test_event_init():
assert get_initialized_test_event().variable_values
def test_extra_vars_fails():
with pytest.raises(ValueError):
ATestEvent(not_valid=... |
from datetime import datetime
from dateutil.relativedelta import relativedelta
from decimal import Decimal
import logging
import pdb
import time
import openerp
from openerp import netsvc, tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
import... |
from openerp import models, fields, api
from openerp.tools.translate import _
from openerp.addons.website.models.website import slug
class event_track_tag(models.Model):
_name = "event.track.tag"
_description = 'Track Tag'
_order = 'name'
name = fields.Char('Tag', translate=True)
track_ids = fields.... |
import src
class CriticalLockingPanel(
src.boiler_ui_module.BoilerUIModule):
id_ = 'critical-panel'
classes = {'scrolling-panel', 'system'}
conf = {
'static_url_prefix': '/critical/',
'static_path': './locking_panels/critical/static',
'css_files': ['critical.css'],
'j... |
from __future__ import absolute_import, print_function, unicode_literals, division
from .tests_mechanism import AbstractTestFixture, dataset
from .check_utils import *
from jormungandr import stat_manager
from jormungandr.stat_manager import StatManager
class StatError(Exception):
pass
def always_in_error(self, sta... |
"""
Tests of the Capa XModule
"""
import datetime
import json
import random
import requests
import os
import textwrap
import unittest
import ddt
from django.utils.encoding import smart_text
from lxml import etree
from mock import Mock, patch, DEFAULT
import six
import webob
from webob.multidict import MultiDict
import ... |
'''
Module :mod: 'hmtk.seismicity.max_magnitude.kijko_sellevol_bayes' implements
the Kijko & Sellevol (1989) method for estimating maximum magnitude from
observed seismicity with uncertain b-value
'''
import numpy as np
from math import fabs
from scipy.integrate import quadrature
from hmtk.seismicity.max_magnitude.base... |
from . import models |
from typing import List
from unittest import mock
from django.http import HttpResponseForbidden, HttpResponse, HttpResponseNotFound
from django.test import TestCase
from django.urls import reverse
from base.models.enums.education_group_types import MiniTrainingType
from base.tests.factories.academic_year import Academi... |
def remove_attrs(dictionary, *attrs):
"""Returns a copy of dictionary without attrs"""
result = {}
for key, value in dictionary.items():
if key not in attrs:
result[key] = value
return result |
"""Code run by pylint before running any tests."""
import pytest
from safe_lxml import defuse_xml_libs
defuse_xml_libs()
@pytest.fixture(autouse=True)
def no_webpack_loader(monkeypatch): # lint-amnesty, pylint: disable=missing-function-docstring
monkeypatch.setattr(
"webpack_loader.templatetags.webpack_loa... |
from . import material_plan_wizard |
import re
import spack.compiler
import spack.compilers.apple_clang as apple_clang
from spack.version import ver
class Gcc(spack.compiler.Compiler):
# Subclasses use possible names of C compiler
cc_names = ['gcc']
# Subclasses use possible names of C++ compiler
cxx_names = ['g++']
# Subclasses use po... |
from spack import *
class PySphinxcontribWebsupport(PythonPackage):
"""sphinxcontrib-webuspport provides a Python API to easily integrate
Sphinx documentation into your Web application."""
homepage = "http://sphinx-doc.org/"
url = "https://pypi.io/packages/source/s/sphinxcontrib-websupport/sphinxco... |
"""
All the constants are expressed in pixels. They are defined for the XO screen
and are usually adapted to different resolution by applying a zoom factor.
STABLE.
"""
import os
import logging
from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import Gio
FOCUS_LINE_WIDTH = 2
_TAB_CURVATUR... |
"""
Sample for python PCSC wrapper module: List PCSC readers
__author__ = "http://www.gemalto.com"
Copyright 2001-2010 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
Copyright 2010 Ludovic Rousseau
Author: Ludovic Rousseau, mailto:ludovic.rousseau@free.fr
This file is part of pyscard.
pyscard... |
from nose.tools import *
from utilities import execution_path, contains_word
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_multi_tile_policy():
srs = '+proj=longlat +ellps=WGS84 ... |
"""
Test CF-NetCDF file loading and saving.
"""
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
import six
import iris.tests as tests
import os
import os.path
import shutil
import stat
import tempfile
import biggus
import netCDF4 as nc
im... |
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(488, 426)
MainWindow.setStyleSheet("QWidget#MainWindow {\n"
" background-color : rgb(78,78,78)\n"
"}")
self.verticalLay... |
import numpy as np
import os
from psi4 import core
from psi4.driver import p4util
from psi4.driver.p4util.exceptions import *
def ah_iteration(mcscf_obj, tol=1e-3, max_iter=15, lindep=1e-14, print_micro=True):
"""
Solve the generalized eigenvalue problem:
| 0, g.T | | 1/l | = | 1/l |
| g, H/l | | X ... |
from __future__ import print_function
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
dim = 2
distribution = Normal(dim)
#
# Case 1: composite random vector based event
#
# The input vector
X = RandomVector(distribution)
# The model: the identity function
inVar... |
"""add preopen ports
Revision ID: 3bb80d1887d6
Revises: 1e8531583e20
Create Date: 2020-02-05 17:02:42.344726
"""
from alembic import op
import sqlalchemy as sa
revision = '3bb80d1887d6'
down_revision = '1e8531583e20'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - pl... |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.map_message_type import *
from hazelcast.protocol.event_response_const import *
REQUEST_TYPE... |
import collections
import mock
from neutron.tests import base
from networking_cisco.apps.saf.common import config
from networking_cisco.apps.saf.common import utils
from networking_cisco.apps.saf.db import dfa_db_models as dbm
from networking_cisco.apps.saf.server.services.firewall.native import (
fabric_setup_base... |
"""
The VMware API VM utility module to build SOAP object specs.
"""
import collections
import copy
import functools
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
from oslo_vmware import exceptions as vexc
from oslo_vmware.objects import dat... |
'''
Adds is_otc flag to documents in ownership and symbology indices
** Note **
This runs prospectively each day after the edgar and otc ndex scrapes
'''
import json
import logging
from elasticsearch import Elasticsearch
from elasticsearch.helpers import scan, streaming_bulk
class ADD_OTC_FLAGS:
def __i... |
"""
Shared constants across the VMware driver
"""
from nova.network import model as network_model
MIN_VC_VERSION = '5.1.0'
MIN_VC_OVS_VERSION = '5.5.0'
DISK_FORMAT_ISO = 'iso'
DISK_FORMAT_VMDK = 'vmdk'
DISK_FORMAT_ISCSI = 'iscsi'
DISK_FORMATS_ALL = [DISK_FORMAT_ISO, DISK_FORMAT_VMDK]
DISK_TYPE_THIN = 'thin'
CONTAINER_F... |
"""
Created on Oct 02, 2012
@author: Bilel Msekni
@contact: bilel.msekni@telecom-sudparis.eu
@author: Houssem Medhioub
@contact: houssem.medhioub@it-sudparis.eu
@organization: Institut Mines-Telecom - Telecom SudParis
@license: Apache License, Version 2.0
"""
from webob import Response
from pyocni.adapters.httpResponse... |
import re
import pytest
from dvc.repo.scm_context import SCMContext
from dvc.scm import Git, NoSCM
def pytest_generate_tests(metafunc):
if "scm_context" in metafunc.fixturenames:
metafunc.parametrize("scm_context", ["scm", "no_scm"], indirect=True)
@pytest.fixture
def scm_context(request, mocker):
spec ... |
from .pkg_info import __version__
from . import debug |
pdb = False
wrap_stdout = True
wrap_stderr = True
LINES_IN_TB = 4
bigtb = False
test_filter = ''
indent = 2 |
'''
JSON related utilities.
This module provides a few things:
1) A handy function for getting an object down to something that can be
JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) This s... |
from __future__ import print_function
import abc
import argparse
import logging
import re
from cliff.formatters import table
from cliff import lister
from cliff import show
from oslo.serialization import jsonutils
import six
from neutronclient.common import command
from neutronclient.common import exceptions
from neutr... |
"""EmbargoTerminationApprovals are the Sanction subclass that allows users
to make Embargoes public before the official end date. Like RegistrationAprpovals
and Embargoes, if an admin fails to approve or reject this request within 48
hours it is approved automagically.
Run nightly, this script will approve any embargo ... |
import datetime
import json
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: ceph_volume
short_description: Create ceph OSDs with ceph-volume
description:
- Using the ceph-volume utility available in Ceph this module
... |
"""
Tests for app.migrator
"""
import types
import uuid
import cloudstorage
from google.appengine.api import files
from google.appengine.api.files import blobstore as files_blobstore
from google.appengine.ext import blobstore
from app import config
from app import migrator
from app import models
from test import mock
f... |
from __future__ import unicode_literals
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from moto.core import BaseBackend
from moto.ec2 import ec2_backends
from moto.elb import elb_backends
from moto.elb.exceptions import LoadBalancerNotFoundError
DEFAULT_COOLDOWN = 300
class InstanceState(o... |
import json
import base64
import tempfile
from slackclient import SlackClient
from kubernetes import client, config
config.load_incluster_config()
v1=client.CoreV1Api()
for secrets in v1.list_secret_for_all_namespaces().items:
if secrets.metadata.name == 'slack':
token = base64.b64decode(secrets.data['token... |
import jpype
import jpype.imports
import common
import sys
import os
import importlib
import pytest
from unittest import mock
import _jpype
class CoverageCase(common.JPypeTestCase):
def setUp(self):
common.JPypeTestCase.setUp(self)
self.platform = sys.platform
def testWin32(self):
if sys... |
import os
import sys
import logging
if 'crt' in globals():
script_dir, script_name = os.path.split(crt.ScriptFullName)
if script_dir not in sys.path:
sys.path.insert(0, script_dir)
else:
script_dir, script_name = os.path.split(os.path.realpath(__file__))
from securecrt_tools import scripts
from secu... |
from op_test import OpTest
import unittest
import numpy as np
import six
class CrossEntropy2OpTestBase(OpTest):
def initParameters(self):
return [32, 64], 'float64', -100, False
def calc_output(self, logits, label, ignore_index):
ret = np.zeros(shape=label.shape, dtype=logits.dtype)
matc... |
"""Self-test suite for Cryptodome.Hash.CMAC"""
import json
import unittest
from binascii import unhexlify
from Cryptodome.Util.py3compat import tobytes, _memoryview
from Cryptodome.Hash import CMAC
from Cryptodome.Cipher import AES, DES3
from Cryptodome.Hash import SHAKE128
from Cryptodome.Util._file_system import pycr... |
import sys
from setuptools import setup
from setuptools import find_packages
version = '0.1.0.dev0'
install_requires = [
'acme=={0}'.format(version),
'letsencrypt=={0}'.format(version),
'PyOpenSSL',
'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary?
'setuptools', # pkg_resources
'zope... |
"""Test the Energy sensors."""
import copy
from datetime import timedelta
from unittest.mock import patch
import pytest
from homeassistant.components.energy import data
from homeassistant.components.sensor import (
ATTR_STATE_CLASS,
STATE_CLASS_TOTAL_INCREASING,
)
from homeassistant.components.sensor.recorder i... |
"""Windows cloudbaseinit recipes."""
import ntpath
import os
import socket
from winrm import exceptions as winrm_exceptions
from argus import exceptions
from argus.introspection.cloud import windows as introspection
from argus.recipes.cloud import base
from argus import util
LOG = util.get_logger()
COUNT = 20
DELAY = 2... |
import sys
import argparse
import cPickle as pickle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import os
from os.path import join as pjoin
WINDOW_SIZE = 10
WINDOW_RATIO = 10.0
'''
Inspect and plot results from run
'''
def smooth_arr(arr, win_size):
window = np.ones(int(win_size)) /... |
import os
import tempfile
import shlex
import subprocess
class TestData(object):
def __init__(self):
# create a directory hierarchy to do tests in
self.test_data_dir = os.path.realpath(os.path.join(tempfile.gettempdir(), 'db_test'))
if os.path.exists(self.test_data_dir):
self.rm_rf(self.test_data_di... |
import numpy, os
import matplotlib.pyplot as plt
def load_binary_file(file_name, dimension):
fid_lab = open(file_name, 'rb')
features = numpy.fromfile(fid_lab, dtype=numpy.float32)
fid_lab.close()
frame_number = features.size / dimension
features = features[:(dimension * (features.size / dimension))... |
'''
:codeauthor: :email:`Alexander Pyatkin <asp@thexyz.net>`
'''
from __future__ import absolute_import
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
fr... |
from __future__ import with_statement
import os
from robot.errors import DataError
from .filewriters import FileWriter
class DataFileWriter(object):
"""Object to write parsed test data file objects back to disk."""
def __init__(self, **options):
"""
:param `**options`: A :class:`.WritingContext`... |
"""The LUKSDE volume path specification resolver helper implementation."""
from dfvfs.file_io import luksde_file_io
from dfvfs.lib import definitions
from dfvfs.resolver_helpers import manager
from dfvfs.resolver_helpers import resolver_helper
from dfvfs.vfs import luksde_file_system
class LUKSDEResolverHelper(resolver... |
"""Bits and pieces used by the driver that don't really fit elsewhere."""
import collections
import struct
from pymongo.message import _Query
import bson
import pymongo
from bson.codec_options import CodecOptions
from bson.py3compat import itervalues, string_type, iteritems, u
from bson.son import SON
from pymongo.erro... |
from math import isclose
import os
import shutil
from PIL import Image
import pytest
from mfr.extensions.image import exceptions, ImageExporter, settings
BASE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def directory(tmpdir):
return str(tmpdir)
@pytest.fixture(scope="function", autouse=True)
def se... |
import urllib
import json
from flask import request, url_for
from gstack import helpers
from gstack import controllers
from gstack import app, authentication
from gstack.services import requester
from gstack.controllers import errors
def _add_network(authorization, args=None):
command = 'createSecurityGroup'
if... |
import mock
from cinder.tests.unit.targets import targets_fixture as tf
from cinder import utils
from cinder.volume.targets import iser
from cinder.volume.targets import lio
from cinder.volume.targets import tgt
class TestIserAdmDriver(tf.TargetDriverFixture):
"""Unit tests for the deprecated ISERTgtAdm flow"""
... |
import sys
import os
import sphinx_rtd_theme
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
]
templates_path = ['_templates']
source_suffix ... |
import bson.json_util
import pymongo
import json
from bson import ObjectId
from pymongo import Connection
import string
import tangelo
try:
import ogr
except ImportError:
from osgeo import ogr
def convertStringToFloatPoint(lng,lat):
if lat[-1:] == "S":
outlat= -float(lat[:-1])
else:
outl... |
'''
Flexible Data Gathering: readfile
=================================
This fdg module allows for reading in the contents of files, with various
options for format and filtering.
'''
from __future__ import absolute_import
import json as _json
import logging
import os
import re
import yaml as _yaml
from hubblestack.ext... |
from django.conf import settings
from django.contrib.auth import get_user_model
def notification_user(func):
def wrapper(*args, **kwargs):
User = get_user_model()
by = User.objects.filter(id=settings.TASK_USER_ID).first()
if 'by' not in kwargs:
kwargs['by'] = by
return func(*args, **kwargs)
return wrapper |
import inspect
import pickle
import pkgutil
import unittest
import traceback
import numpy as np
from Orange.base import SklLearner
import Orange.classification
from Orange.classification import (Learner, Model, NaiveBayesLearner,
LogisticRegressionLearner, NuSVMLearner, MajorityLearner, RandomForestLearner,
Sim... |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'inbox.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass |
import sys
import os
import errno
import subprocess
import tempfile
import shutil
import re
import csv
import gzip
import zipfile
import dicom
import nibabel
try:
from boto.s3.connection import OrdinaryCallingFormat, S3Connection
import boto.s3.key
from boto.exception import S3ResponseError
except ImportErr... |
from setuptools import setup
with open('README.rst', 'rb') as f:
readme = f.read().decode('utf-8')
setup(
name='pipsi',
version='0.9.dev',
description='Wraps pip and virtualenv to install scripts',
long_description=readme,
license='BSD',
author='Armin Ronacher',
author_email='armin.ronac... |
import os
import shutil
from datetime import timedelta
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import timezone
from allauth.account.models import EmailAddress
from rest_framework import ... |
import os
import socket
import time
from .utils import require_module, missing, LETTERS
import logbook
from logbook.helpers import u
import pytest
@require_module('zmq')
def test_zeromq_handler(logger, handlers, subscriber):
tests = [
u('Logging something'),
u('Something with umlauts äöü'),
... |
""" Utility functions for sparse matrix module
"""
import sys
import operator
import warnings
import numpy as np
from scipy._lib._util import prod
__all__ = ['upcast', 'getdtype', 'isscalarlike', 'isintlike',
'isshape', 'issequence', 'isdense', 'ismatrix', 'get_sum_dtype']
supported_dtypes = [np.bool_, np.by... |
"""An extensible HTML table reader and writer.
html.py:
Classes to read and write HTML tables
`BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_
must be installed to read HTML tables.
"""
import warnings
import numpy
from . import core
from astropy.table import Column
from astropy.utils.xml import write... |
"""
:synopsis: Define the basic script class that will generate the script code.
"""
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
from importlib import import_module
from .url import get_url, check_valid_url
class AbstractScript(object):
"""Abstract representation of a sc... |
'''trying to verify theoretical acf of arma
explicit functions for autocovariance functions of ARIMA(1,1), MA(1), MA(2)
plus 3 functions from nitime.utils
'''
import numpy as np
from numpy.testing import assert_array_almost_equal
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.tsa.arima_pr... |
import mock
import nose.tools as ntools
import numpy
import unittest
from smqtk.representation import DescriptorElement
from smqtk.representation import DescriptorElementFactory
from smqtk.representation.descriptor_element.local_elements \
import DescriptorMemoryElement
__author__ = "paul.tunison@kitware.com"
class... |
import os
import glob
from ast import literal_eval
import numpy as np
import sympy
from sympy import pi, sin, cos, var
from compmech.conecyl.sympytools import mprint_as_sparse, pow2mult
var('x1t, x1r, x2t, x2r')
var('y1t, y1r, y2t, y2r')
var('xi1, xi2')
subs = {
}
def List(*e):
return list(e)
printstr_full =... |
from sympy.physics.secondquant import (
Dagger, Bd, VarBosonicBasis, BBra, B, BKet, FixedBosonicBasis,
matrix_rep, apply_operators, InnerProduct, Commutator, KroneckerDelta,
AnnihilateBoson, CreateBoson, BosonicOperator,
F, Fd, FKet, BosonState, CreateFermion, AnnihilateFermion,
evaluate_deltas, Ant... |
if __name__ == '__main__':
import instance_occlsegm_lib
dataset = instance_occlsegm_lib.datasets.coco.COCOClassSegmentationDataset(
'minival')
instance_occlsegm_lib.datasets.view_class_seg_dataset(dataset) |
__all__ = ['socks'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.