code stringlengths 1 199k |
|---|
import attr
import mock
from django.test import SimpleTestCase
from base.ddd.utils.business_validator import MultipleBusinessExceptions
from base.models.enums.learning_unit_year_session import DerogationSession
from ddd.logic.learning_unit.commands import CreateEffectiveClassCommand
from ddd.logic.learning_unit.domain.... |
import setuptools
with open('VERSION.txt', 'r') as f:
version = f.read().strip()
setuptools.setup(
name="odoo8-addons-oca-social",
description="Meta package for oca-social Odoo addons",
version=version,
install_requires=[
'odoo8-addon-base_mail_bcc',
'odoo8-addon-email_template_qweb'... |
from openerp import api, models
class HrExpenseExpense(models.Model):
_inherit = "hr.expense.expense"
@api.onchange("employee_id")
def onchange_journal_id(self):
self.journal_id = False
default_journal_id = self.env.context.get("default_journal_id", False)
if default_journal_id:
... |
from curses.ascii import NUL
from sqlalchemy import and_, case, desc, extract, func, null, or_
from sqlalchemy.orm import aliased, subqueryload
from radar.database import db
from radar.models.groups import Group, GroupPatient, GroupUser
from radar.models.patient_aliases import PatientAlias
from radar.models.patient_dem... |
from . import test_product_template_link_date_span |
from spack import *
class RRmpi(RPackage):
"""An interface (wrapper) to MPI APIs. It also provides interactive R
manager and worker environment."""
homepage = "http://www.stats.uwo.ca/faculty/yu/Rmpi"
url = "https://cran.r-project.org/src/contrib/Rmpi_0.6-6.tar.gz"
list_url = "https://cran.r... |
import gtk
import herzi_properties_group
class HerziProperties(gtk.HBox):
def __init__(self):
gtk.HBox.__init__(self)
self.groups = []
self.set_spacing(18)
def add(self, label):
self.groups.append(herzi_properties_group.HerziPropertiesGroup(label))
self.pack_start(self.gr... |
import argparse
import collections
import contextlib
INDENTATION = " "
COMMAND_DELIMITER = " \\\n{}&& ".format(INDENTATION)
labels = [
("com.redhat.component", "openscap-container"),
("name", "openscap"),
("version", "testing"),
("usage", "The OpenSCAP container image is used by the Atomic Management... |
from __future__ import absolute_import
from io import BytesIO
from wvtest import *
from bup import vint
from buptest import no_lingering_errors
def encode_and_decode_vuint(x):
f = BytesIO()
vint.write_vuint(f, x)
return vint.read_vuint(BytesIO(f.getvalue()))
@wvtest
def test_vuint():
with no_lingering_e... |
import unittest
import os
import logging
from hyo2.soundspeedmanager import AppInfo
from hyo2.soundspeed.soundspeed import SoundSpeedLibrary
from hyo2.soundspeed.base.callbacks.fake_callbacks import FakeCallbacks
from hyo2.soundspeed.base.testing import SoundSpeedTesting
logging.basicConfig(level=logging.DEBUG)
logger ... |
import os
import glob
from copy import copy
Import ('env')
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
system = 'boost_system%s' % env['BOOST_APPEND']
regex = 'boost_regex%s' % env['BOOST_APPEND']
libraries = copy(env['LIBMAPNIK_LIBS'])
libraries.append('mapnik')
for cpp_test in glob.glob('*_test.cpp'):
... |
"""be - Minimal Asset Management System
Usage:
$ be project item task
Return codes:
0: No error
1: Program fault # returned from exceptions
2: User error
3: Project has been misconfigured
4: A template has been misconfigured
"""
import os
import re
import sys
import time
import getpass
import t... |
"""
"""
import Live
from _Framework.ControlSurfaceComponent import ControlSurfaceComponent
from ClyphXClipEnvCapture import ClyphXClipEnvCapture
from consts import *
if IS_LIVE_9:
import random
ENV_TYPES = ('IRAMP', 'DRAMP', 'IPYR', 'DPYR', 'SQR', 'SAW')
class ClyphXClipActions(ControlSurfaceComponent):
__modul... |
import os
import sys
import getpass
import time
import tty
import termios
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
import six
from lsm import (Client, Pool, VERSION, LsmError, Disk,
Volume, JobStatus, ErrorNumber, BlockRange,
uri_parse, Proxy, size_... |
"""": # -*-python-*-
bup_python="$(dirname "$0")/bup-python" || exit $?
exec "$bup_python" "$0" ${1+"$@"}
"""
from __future__ import absolute_import
from calendar import timegm
from pipes import quote
from subprocess import check_call
from time import strftime, strptime
import sys
import tempfile
from bup import git, o... |
import debug
class Environment(dict):
def __init__(self, parent, *args, **kw):
"""
:rtype : Environment
"""
self.parent = parent
super(Environment, self).__init__(*args, **kw)
def __call__(self, item):
return self[item]
def __setitem__(self, key, value):
... |
''' Engine to expand `User Defined Functions` (including Jinja2 templates) '''
import functools
import imp
import inspect
import os
import re
import sys
import time
import traceback
import jinja2
from PyKDE4.kdecore import KConfig, i18nc
from PyKDE4.ktexteditor import KTextEditor
import kate
import kate.ui
from libkate... |
import pyui2
from pyui2.desktop import getDesktop, getTheme, getPresenter
from pyui2.base import Base
from pyui2.layouts import Much
from pyui2.widgets.button import Button
class CloseButton(Button):
widgetLabel = "CLOSEBUTTON"
def __init__(self, handler):
Button.__init__(self, "", handler)
class Minimi... |
from shyft import api
import numpy as np
from numpy.testing import assert_array_almost_equal
import unittest
class KalmanAndBiasPrediction(unittest.TestCase):
"""
These tests verifies and demonstrates the Kalman and BiasPrediction functions available
in Shyft api.
"""
def test_parameter(self):
... |
class Solution:
# @param {integer} numRows
# @return {integer[][]}
def generate(self, numRows):
lists = []
for i in range(numRows):
lists.append([1] * (i + 1))
if i > 1:
for j in range(1, i):
lists[i][j] = lists[i - 1][j - 1] + list... |
"""
GitLab API:
https://docs.gitlab.com/ee/api/users.html
https://docs.gitlab.com/ee/api/users.html#delete-authentication-identity-from-user
"""
import requests
def test_create_user(gl, fixture_dir):
user = gl.users.create(
{
"email": "foo@bar.com",
"username": "foo",
"na... |
import unittest, json
TABLE_NAME = 'Table-HR'
TABLE_RT = 45
TABLE_WT = 123
TABLE_RT2 = 10
TABLE_WT2 = 10
TABLE_HK_NAME = u'hash_key'
TABLE_HK_TYPE = u'N'
TABLE_RK_NAME = u'range_key'
TABLE_RK_TYPE = u'S'
HK_VALUE = u'123'
RK_VALUE = u'Decode this data if you are a coder'
HK = {TABLE_HK_TYPE: HK_VALUE}
RK = {TABLE_RK_TY... |
import os
import importlib
import inspect
from ..webclipboardbase import WebClipBoardBase
pluginClassList=[]
pluginModuleList=[]
def rescanPlugins():
global pluginClassList
global pluginModuleList
global __all__
pluginClassList = []
pluginModuleList = []
files=[os.path.splitext(x)[0] for x in os.listdir(os.path.d... |
{
'name' : 'Improvements for mass mailing',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'category' : 'Mail',
'website' : 'https://yelizariev.github.io',
'description': """
Modules adds:
* partners info in mail.mail.statistics tree
* partners info in mail.mail.statistics f... |
dc = {'a' : 'a-ele', 'b' : 'b-ele', 'c' : 'c-ele'}
ki = dc.iterkeys()
for k in ki:
print "k = [%s], v = [%s]" % (k, dc[k]) |
import lxml.etree as ET
import unittest
from kimchi.model.libvirtstoragepool import StoragePoolDef
class storagepoolTests(unittest.TestCase):
def test_get_storagepool_xml(self):
poolDefs = [
{'def':
{'type': 'dir',
'name': 'unitTestDirPool',
'pat... |
from spell.utils.log import *
from spell.lib.exception import *
from spell.lib.registry import REGISTRY
from spell.lang.constants import *
from spell.lang.modifiers import *
from interface import Interface
from config import Configurable
__all__ = ['EvInterface,EvView']
INTERFACE_DEFAULTS = { OnFailure:ABORT | SKIP | R... |
'''
Created on 21 kwi 2013
@author: jurek
'''
from hra_core.special import ImportErrorMessage
try:
from PyQt4.QtGui import * # @UnusedWildImport
from PyQt4.QtCore import * # @UnusedWildImport
from hra_core.misc import Params
from hra_core.collections_utils import nvl
from hra_gui.qt.utils.signals ... |
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QWidget
from mdt.gui.maps_visualizer.actions import NewConfigAction
from mdt.gui.maps_visualizer.base import DataConfigModel
from mdt.gui.maps_visualizer.design.ui_TabTextual import Ui_TabTextual
from mdt.gui.utils import blocked_signals
from mdt.visualizati... |
TOPP_UNSPEC = 0
TOPP_OK = 1
TOPP_CANNOT_PREPROCESS = 2
TOPP_SHORT_TRAJ = 3
TOPP_MVC_HIT_ZERO = 4
TOPP_CLC_ERROR = 5
TOPP_SDBEGMIN_TOO_HIGH = 6
TOPP_SDENDMIN_TOO_HIGH = 7
TOPP_FWD_HIT_ZERO = 8
TOPP_BWD_HIT_ZERO = 9
TOPP_FWD_FAIL = 10
TOPP_BWD_FAIL = 11
MESSAGES = {
TOPP_UNSPEC: "unspecified error",
TOPP_OK: "eve... |
import avango
import avango.gua
import avango.script
import avango.vive
import logging
def print_graph(root_node):
stack = [(root_node, 0)]
while stack:
node, level = stack.pop()
print("│ " * level + "├── {0} <{1}>".format(
node.Name.value, node.__class__.__name__))
... |
from os import stat, access, lstat, listdir, mkdir, X_OK
from os.path import abspath, split, exists, isfile, isdir
from re import match
from itertools import ifilter, islice
from comine.iface.infer import ILayout, LayoutError
class Layout(ILayout):
'''
Standard files layout handler. Eeac... |
import urllib, zipfile, os, sys, shutil
def runNative(cmd):
out = os.system(cmd)
if(out != 0):
print("===================================")
print("OpenModularGuns setup failed with error code "+str(out))
print("===================================")
sys.exit(1)
print(" ______ .______ _______ .__ __. ... |
from pysix.cphd03 import CPHDReader
import sys
import multiprocessing
if __name__ == '__main__':
if len(sys.argv) >= 2:
inputPathname = sys.argv[1]
else:
print "Usage: " + sys.argv[0] + " <Input CPHD>"
sys.exit(0)
reader = CPHDReader(inputPathname, multiprocessing.cpu_count())
pr... |
"""simplify network
Revision ID: 1eb51c6159ac
Revises: 7d6099524c02
Create Date: 2017-12-29 11:36:35.323359
"""
from alembic import op
import sqlalchemy as sa
from hydra_base import db
import logging
log = logging.getLogger(__name__)
revision = '1eb51c6159ac'
down_revision = None
branch_labels = None
depends_on = None
... |
from time import sleep
from dragonfly import *
import winsound
class PlaySound(ActionBase):
def __init__(self, name=None, file=None):
ActionBase.__init__(self)
if name is not None:
self._name = name
self._flags = winsound.SND_ASYNC | winsound.SND_ALIAS
elif file is ... |
from django.urls import path, re_path, include, reverse
from django.utils.translation import gettext_lazy as _
from pytigon_lib.schviews import generic_table_start, gen_tab_action, gen_row_action
from django.views.generic import TemplateView
from . import views
urlpatterns = [
re_path(
"^(?P<app_or_subject>... |
from django.template import Context,loader,RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from django.core.context_processors import csrf
from django.shortcuts import render_to_response,get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import ... |
""" The SUPReMM module contains software that generates job-level summaries from PCP archives """
__all__ = ["outputter"] |
from wasp_general.version import __author__, __version__, __credits__, __license__, __copyright__, __email__
from wasp_general.version import __status__
from configparser import ConfigParser, NoOptionError, NoSectionError
import os
from wasp_general.verify import verify_type, verify_value
class WConfig(ConfigParser):
... |
"""
Test the pipeline module.
"""
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
f... |
def prime_gen():
from itertools import count
primes = []
yield 2
for n in count(3,2):
div = False
if any(n % p == 0 for p in primes):
div = True
# print "testing", n, primes
if not div:
primes.append(n)
yield n
def prime_gen_f():
fr... |
'''This script demonstrates how to build a variational autoencoder
with Keras and deconvolution layers.
Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114
Using Tensorflow queue and asynchronous training.
original implementation:
https://github.com/fchollet/keras/blob/master/examples/variation... |
def subsuma_exacta(sol,L,S,i):
if S==0:
print(sol)
return False # originalmente True
if S<0 or L==[]:
return False
sol[i]=1 # incluyo al primer numero
if subsuma_exacta(sol,L[1:],S-L[0],i+1):
return True
sol[i]=0 # incluyo al primer numero
if subsuma_exacta(sol,... |
from Tkinter import *
root = Tk()
labelframe = LabelFrame(root, text="This is a LabelFrame")
labelframe.pack(fill="both", expand="yes")
left = Label(labelframe, text="Inside the LabelFrame")
left.pack()
root.mainloop() |
"""
Created on Tue Jan 03 13:30:41 2012
@author: jharston
"""
import webapp2 as webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
import os
class beekhouryReferencesPage(webapp.RequestHandler):
def get(self):
text_file1 = open('beekhoury/beekho... |
import sys
import os
import alabaster
sys.path.insert(0, os.path.abspath('../../'))
import filelock
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode'
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'py-filelock... |
from eventlet import greenlet
from eventlet import greenpool
from eventlet import greenthread
from hotzenplotz.openstack.common import log as logging
from hotzenplotz.openstack.common import loopingcall
LOG = logging.getLogger(__name__)
def _thread_done(gt, *args, **kwargs):
""" Callback function to be passed to Gr... |
import socket
PORT = 8093
MAX_OPEN_REQUESTS = 5
SERVICE_PRICE_EUROS = 20
SERVICE_PRICE_RM = SERVICE_PRICE_EUROS/0.13
def process_client(clientsocket):
print(clientsocket)
print(clientsocket.recv(2096))
send_message = "Alvaro and Juan's Server!!\n"
send_message += "Hello from the server: %i€ needed\n" % ... |
import fontforge
import magic
import os
import os.path
import re
import StringIO
import sys
import unicodedata
from contextlib import contextmanager
from fontTools import ttLib
from bakery_lint.base import BakeryTestCase as TestCase, tags, autofix, \
TestCaseOperator
from bakery_cli.fixers import RenameFileWithSugg... |
import os
import sys
folderOne = "~/src"
if __name__ == '__main__':
#go to dir
#os.chdir(folderOne)
for filename in os.listdir(folderOne):
#os.chdir(folderOne + "\\" + filename)
#print filename
#if not os.path.isdir(folderOne + "\\" + filename):
# print filename
if... |
from element import odf_create_element
def odf_create_reference_mark(name):
"""
Arguments:
name -- unicode
"""
element = odf_create_element('text:reference-mark')
element.set_attribute('text:name', name)
return element
def odf_create_reference_mark_start(name):
"""
Arguments:
... |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^sales','app.views.sales'),
(r'^app','app.views.app'),
(r'^totalsales','app.views.totalsales'),
(r'^register','app.views.register'),
(r'^','app.views.index'),
# Example:
# (r'^foo/', include('foo.urls')),
# Uncomment t... |
"""
Handlers dealing with logs
"""
from itertools import dropwhile
import logging
import os
import re
import time
from oslo.serialization import jsonutils
import web
from nailgun import consts
from nailgun import objects
from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.v1.handlers.base import conte... |
from control.openstack import WaspSwiftConn
import swiftclient
import sys
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
... |
from pathlib import Path
from resolwe.flow.models import Data
from resolwe.test import tag_process, with_resolwe_host
from resolwe_bio.utils.test import KBBioProcessTestCase
class EnrichmentProcessorTestCase(KBBioProcessTestCase):
@with_resolwe_host
@tag_process("goenrichment")
def test_go_enrichment_dicty(... |
import unittest
import boto3
from airflow.contrib.hooks.emr_hook import EmrHook
try:
from moto import mock_emr
except ImportError:
mock_emr = None
@unittest.skipIf(mock_emr is None, 'moto package not present')
class TestEmrHook(unittest.TestCase):
@mock_emr
def test_get_conn_returns_a_boto3_connection(s... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'name': 'anac-csv-upload',
'version': '0.1',
'description': 'Uploads CSV data to brazilian ANAC',
'author': 'Leandro Lisboa Penz',
'author_email': 'lpenz@lpenz.org',
'url': 'https://github.c... |
import io
import os
import setuptools # type: ignore
version = "1.1.1"
package_root = os.path.abspath(os.path.dirname(__file__))
readme_filename = os.path.join(package_root, "README.rst")
with io.open(readme_filename, encoding="utf-8") as readme_file:
readme = readme_file.read()
setuptools.setup(
name="google-... |
import mock
import six
from heat.common import exception
from heat.common import template_format
from heat.engine.clients.os import mistral as mistral_client_plugin
from heat.engine import resource
from heat.engine import scheduler
from heat.engine import stack
from heat.engine import template
from heat.tests import co... |
"""Eager mode TF policy built using build_tf_policy().
It supports both traced and non-traced eager execution modes."""
import logging
import functools
import numpy as np
from ray.rllib.evaluation.episode import _flatten_action
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.policy.policy import Policy... |
import logging
import os
import time
import fabric.api
import fabric.operations
import cloudenvy.core
class Provision(cloudenvy.core.Command):
def _build_subparser(self, subparsers):
help_str = 'Upload and execute script(s) in your Envy.'
subparser = subparsers.add_parser('provision', help=help_str,... |
class Utils():
def __init__(self, *args, **kwargs):
super(Utils, self).__init__(*args, **kwargs)
@staticmethod
def to_int(s):
s = s.strip()
if len(s) < 2:
return int(s)
elif s[0:2] in ("0x","0X"):
return int(s,16)
else:
return int(s... |
import argparse
import fnmatch
import importlib
import inspect
import re
import sys
from docutils import nodes
from docutils.parsers import rst
from docutils.parsers.rst import directives
from docutils import statemachine
from cliff import app
from cliff import commandmanager
def _indent(text):
"""Indent by four sp... |
"""Common utility functions and classes used by multiple Python scripts."""
from __future__ import annotations
import contextlib
import errno
import getpass
import io
import os
import platform
import re
import shutil
import socket
import subprocess
import sys
import time
from core import constants
from core import pyth... |
"""settings module tests."""
import os
import random
import re
import sys
import types
import mox
import stubout
from google.apputils import app
from google.apputils import basetest
os.environ['____TESTING_SETTINGS_MODULE'] = 'yes'
from simian import settings
del(os.environ['____TESTING_SETTINGS_MODULE'])
class Setting... |
"""
DB abstraction for Cyborg
"""
from cyborg.db.api import * # noqa |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('petitions', '0011_auto_20151023_1551'),
]
operations = [
migrations.AlterField(
model_name='petition',
name='deadline',
... |
class Rect(object):
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.width = width
self.height = height
self._x_center = x + (width / 2)
self._y_center = y + (height / 2)
@property
def x_center(self):
return int(self.x +(self.width ... |
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.auth i... |
from Queue import Queue
from uuid import uuid4
import logging
import json
import httplib
logger = logging.getLogger(__name__)
from circuits import Component, Event, handler
from circuits.core.timers import Timer
from circuits.web.client import Client, Request
from bson import BSON, json_util
from arke.spool import Spoo... |
"""Tests for Keras Ranking Network."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v2 as tf
from tensorflow_ranking.python.keras import network as network_lib
def _get_feature_columns():
def _normalizer_fn(t):
return tf.math... |
import unittest
import games
class GamesTest(unittest.TestCase):
"""Unit tests for the Games utility class."""
def testScoreCmp(self):
"""Verify score comparison."""
# Format of list is:
# - score of first (or 'left') game
# - score of second (or 'right') game
# - expected result of ordered comp... |
from setuptools import setup, find_packages
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'name': 'digStylometry',
'description': 'code to get signature to do stylometric analysis',
'author': 'Rajagopal',
'url': 'https://github.com/usc-isi-i2/d... |
from keystoneclient.v3 import client as ksclient
from monascaclient.openstack.common import jsonutils
def script_keystone_client(token=None):
if token:
ksclient.Client(auth_url='http://no.where',
insecure=False,
tenant_id='tenant_id',
t... |
from __future__ import absolute_import
from django.conf.urls import include, url
from django.urls import path
from django.contrib import admin
from django.conf import settings
from django.views.generic.base import TemplateView
from . import views
admin.autodiscover()
urlpatterns = [
url(r'^$', views.domain_redirect... |
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubernetes.clie... |
import argparse
import os
import pyudev
import queue
import re
import sys
import time
from json import loads
from os_net_config import common
from os_net_config import sriov_bind_config
from oslo_concurrency import processutils
logger = common.configure_logger()
_UDEV_RULE_FILE = '/etc/udev/rules.d/80-persistent-os-net... |
from yaya.common.ns import NS, NSPattern
from yaya import config
from yaya.collection.dict import DoubleArrayTrie
from yaya.collection.hmm import HMMMatrix
from yaya.utility.singleton import singleton
__author__ = 'tony'
@singleton
class PlaceDict:
def __init__(self):
self.trie = DoubleArrayTrie.load(config... |
from .domain import JavaDomain
from .extdoc import javadoc_role
def setup(app):
app.add_domain(JavaDomain)
app.add_config_value('javadoc_url_map', dict(), '')
app.add_role('java:extdoc', javadoc_role) |
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="intList">
<xs:list itemType="xs:int"/>
</xs:simpleType>
<xs:complexType name="tSingle">
<x... |
import numpy as np
import matplotlib.pyplot as plt
def plot_decision_function(classifier, fea, gnd, title):
'''
plot the decision function in 2-d plane
classifiers: the svm models
fea: array like, shape = (smp_num, fea_num)
gnd: array like, shape = (smp_num,)
title: title of ... |
from __future__ import print_function, division
import numpy as np
from scipy.spatial.distance import cdist
from pyscf.nao.m_rsphar_libnao import rsphar
from pyscf.nao.m_log_interp import comp_coeffs_
def ao_eval(ao, ra, isp, coords):
"""
Compute the values of atomic orbitals on given grid points
Args:
... |
import unittest
from test import test_support
from test import test_urllib
import os
import socket
import StringIO
import urllib2
from urllib2 import Request, OpenerDirector, AbstractDigestAuthHandler
import httplib
try:
import ssl
except ImportError:
ssl = None
from test.test_urllib import FakeHTTPMixin
class ... |
from __future__ import print_function
import os
import pyos
import pyos.exceptions as exc
import pyos.utils as utils
pyos.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyos.set_credential_file(creds_file)
cf = pyos.cloudfiles
cont_name = pyos.utils.random_as... |
from numba.pycc import CC
from numpy import zeros
cc = CC('AMC5_yesterday_inner_compiled')
@cc.export('AMC5_yesterday_inner', '(int64, int64[:,::1], float64[::1], float64[:,:,::1])')
def AMC5_yesterday_inner(NYrs, DaysMonth, AntMoist_0, water):
result = zeros((NYrs, 12, 31))
AntMoist1 = zeros((5,))
AMC5 = 0... |
"""Autnum policy module for prngmgr."""
import re
_as_regex = re.compile(r'^AS(\d+)$')
_asdot_regex = re.compile(r'^(\d+)\.(\d+)$')
class AutNum(object):
"""AutNum policy object class."""
def __init__(self, asn=None):
"""Init new AutNum instance."""
try:
m = _as_regex.match(asn)
... |
from numpy import zeros
from gwlfe.Input.LandUse.Ag.AGSTRM import AGSTRM
from gwlfe.Input.LandUse.Ag.AGSTRM import AGSTRM_f
from gwlfe.Output.Loading.StreamBankEros import StreamBankEros
from gwlfe.Output.Loading.StreamBankEros import StreamBankEros_f
def SEDFEN(NYrs, DaysMonth, Temp, InitSnow_0, Prec, NRur, NUrb, Area... |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from optparse import make_option
from django.core.management.base import BaseCommand
from zerver.models import RealmFilter, all_realm_filters, get_realm_by_string_id
from zerver.lib.ac... |
from nova.compute import task_states
from nova import exception
from nova import i18n
from nova import image
import os
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from nova_lxd.nova.virt.lxd import session
_ = i18n._
_LE = i18n._... |
import proto # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.videointelligence.v1p1beta1",
manifest={
"Feature",
... |
from cloudbaseinit.openstack.common import log as logging
from cloudbaseinit.openstack.common.plugin import plugin
LOG = logging.getLogger(__name__)
class _CallbackNotifier(object):
"""Manages plugin-defined notification callbacks.
For each Plugin, a CallbackNotifier will be added to the
notification driver... |
from django.urls import reverse
from rest_framework import status
from rest_framework.test import (
APIRequestFactory,
APIClient,
APITestCase
)
from auth.serializers import UserProfileSerializer
class AuthTokenTests(APITestCase):
_django_user_dict = {
'username': 'TEST',
'password': 'pas... |
from collections import namedtuple
import json
UploadResults = namedtuple('UpResults', 'msg,status,success')
class IndexOp(object):
endpoint = None
def __init__(self, index='products'):
self.index = index
self.docs = []
def build_json(self):
raw = json.dumps({"subjects": [{"data": se... |
"""Deprecated.
.. warning::
This module is deprecated as of the 1.7.0 release in favor of
:py:mod:`keystoneclient.exceptions` and may be removed in the 2.0.0 release.
"""
from debtcollector import removals
from keystoneclient import exceptions
removals.removed_module('keystoneclient.apiclient',
... |
import re
import types
from django.template import Library
from django.conf import settings
numeric_test = re.compile("^\d+$")
register = Library()
@register.filter
def getattribute(value, argstr):
"""Gets an attribute of an object dynamically from a string name"""
args = argstr.split(".")
leads = args[:-1]... |
from .testutils import FullStackTests, Recording
import os
import webtest
import time
from webrecorder.models.usermanager import CLIUserManager
from webrecorder.rec.storage import get_storage
from webrecorder.models.stats import Stats
from webrecorder.utils import today_str
from mock import patch
class TestLoginMigrate... |
"""
Tests For Cells RPCAPI
"""
from oslo.config import cfg
import six
from nova.cells import rpcapi as cells_rpcapi
from nova import exception
from nova import test
from nova.tests import fake_instance
CONF = cfg.CONF
CONF.import_opt('topic', 'nova.cells.opts', group='cells')
class CellsAPITestCase(test.NoDBTestCase):
... |
import ObjectCreationParameters
class TaskParameters(ObjectCreationParameters.ObjectCreationParameters):
def __init__(self,tName,tSName,tObjt,isAssumption,tAuth,tags,cProps):
ObjectCreationParameters.ObjectCreationParameters.__init__(self)
self.theName = tName
self.theTags = tags
self.theShortCode = t... |
from nova.api.openstack import extensions
class Used_limits_for_admin(extensions.ExtensionDescriptor):
"""Provide data to admin on limited resources used by other tenants."""
name = "UsedLimitsForAdmin"
alias = "os-used-limits-for-admin"
namespace = ("http://docs.openstack.org/compute/ext/used_limits_fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.