code stringlengths 1 199k |
|---|
import argparse
from os import path
from unittest.mock import patch
from unittest.mock import call
import pytest
from runners.mdb import MdbNsimBinaryRunner, MdbHwBinaryRunner
from conftest import RC_KERNEL_ELF, RC_BOARD_DIR
TEST_DRIVER_CMD = 'mdb'
TEST_NSIM_ARGS='test_nsim.args'
TEST_TARGET = 'test-target'
TEST_BOARD_... |
"""Tests for the Entity Registry."""
import asyncio
import pytest
from homeassistant.const import EVENT_HOMEASSISTANT_START, STATE_UNAVAILABLE
from homeassistant.core import CoreState, callback, valid_entity_id
from homeassistant.helpers import entity_registry
import tests.async_mock
from tests.async_mock import patch
... |
"""Base Estimator class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import collections
import copy
import os
import tempfile
import numpy as np
import six
from google.protobuf import message
from tensorflow.contrib import layers
from tensor... |
"""Git implementation of _version.py."""
import errno
import os
import re
import subprocess
import sys
def get_keywords():
"""Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, ... |
import pandas as pd
import numpy as np
from sklearn import linear_model
from collections import defaultdict, Iterable
from itertools import chain, combinations
import operator
FEW_PREDICATE_PRIORITY = -1
MANY_RESULTS_PRIORITY = .1
SCORE_PRIORITY = 0
MAX_RESULTS = 10
DO_FILTER = True
QUERY_LIMIT = 100000
import psycopg2... |
from urllib.parse import quote
from atlassian import Jira
jira = Jira(url="http://localhost:8080", username="admin", password="admin")
EMAIL_SUBJECT = quote("Jira access to project {project_key}")
EMAIL_BODY = quote(
"""I am asking for access to the {project_key} project in Jira.
To give me the appropriate permissi... |
"""Input layer code (`Input` and `InputLayer`).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import context
from tensorflow.python.framework import tensor_shape
from tensorflow.python.keras._impl.keras import backend as K
f... |
input = """
3 1 3 0 0
1 2 0 0
5 4 3 2 0 3 2 2 2
5 5 3 2 0 3 2 2 2
0
2 a
3 b
0
B+
0
B-
1
0
1"""
output = """
{a}
{a, b}
""" |
from helpers import unittest
import luigi.rpc
from luigi.scheduler import CentralPlannerScheduler
import central_planner_test
import luigi.server
from server_test import ServerTestBase
class RPCTest(central_planner_test.CentralPlannerTest, ServerTestBase):
def get_app(self):
conf = self.get_scheduler_config... |
from pyramid.httpexceptions import HTTPMovedPermanently, HTTPNotFound
from pyramid.view import view_config
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound
from warehouse.accounts.models import User
from warehouse.cache.origin import origin_cache
from warehouse.packaging.models import ... |
"""Contains the logic for `aq add_switch`."""
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.commands.add_network_device import CommandAddNetworkDevice
class CommandAddSwitch(CommandAddNetworkDevice):
required_parameters = ["switch", "model", "rack", "type", "ip", "inte... |
import rospy
from std_srvs.srv import Empty
from std_srvs.srv import EmptyResponse
def handle_service(req):
rospy.loginfo('called!')
return EmptyResponse()
def service_server():
rospy.init_node('service_server')
s = rospy.Service('call_me', Empty, handle_service)
print "Ready to serve."
rospy.sp... |
__author__ = 'noe'
import copy
import numpy as np
from pyemma.msm.models.msm import MSM
from pyemma.util.annotators import shortcut
from pyemma.util.units import TimeUnit
class EstimatedMSM(MSM):
r"""Estimates a Markov model from discrete trajectories.
Parameters
----------
dtrajs : list containing ndar... |
import gc
import os
import pickle
import logging
import sys
import nose
import angr
from nose.plugins.attrib import attr
from angr.state_plugins.history import HistoryIter
l = logging.getLogger("angr.tests")
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
target_ad... |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'penne_core.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass |
from django.contrib.auth.models import Permission
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from wagtail.images import get_image_model
from wagtail.images.tests.utils import get_test_image_file
from wagtail.tests.utils import WagtailTestUtils
Image ... |
"""
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
from nipype.interfaces.base import (CommandLineInputSpec, Co... |
from ClockedObject import ClockedObject
from m5.params import *
from m5.proxy import *
class BasePrefetcher(ClockedObject):
type = 'BasePrefetcher'
abstract = True
size = Param.Int(100,
"Number of entries in the hardware prefetch queue")
cross_pages = Param.Bool(False,
"Allow prefetche... |
import os
import datetime as dt
import warnings
try:
from importlib import reload
except ImportError:
try:
from imp import reload
except ImportError:
pass
import numpy as np
from numpy.testing import assert_almost_equal
import pandas as pd
import unittest
import pytest
try:
from numba im... |
import 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 'Gloss.comp'
db.delete_column('dictionary_gloss', 'comp')
# Changing field 'Gloss.initial_secondary_loc'
... |
from __future__ import absolute_import
import re
import json
import tornado.web
import tornado.auth
from tornado import httpclient
from tornado.options import options
from celery.utils.imports import instantiate
from ..views import BaseHandler
class GoogleAuth2LoginHandler(BaseHandler, tornado.auth.GoogleOAuth2Mixin):
... |
"""reindent [-d][-r][-v] [ path ... ]
-d (--dryrun) Dry run. Analyze, but don't make any changes to files.
-r (--recurse) Recurse. Search for all .py files in subdirectories too.
-B (--no-backup) Don't write .bak backup files.
-v (--verbose) Verbose. Print informative msgs; else only names of changed files.... |
import os
import sys
from flask import Flask
PROJECT_DIR, PROJECT_MODULE_NAME = os.path.split(
os.path.dirname(os.path.realpath(__file__))
)
FLASK_JSONRPC_PROJECT_DIR = os.path.join(PROJECT_DIR, os.pardir)
if os.path.exists(FLASK_JSONRPC_PROJECT_DIR) \
and not FLASK_JSONRPC_PROJECT_DIR in sys.path:
sys.... |
from unittest import main
from amgut.test.tornado_test_base import TestHandlerBase
class TestAddSampleOverview(TestHandlerBase):
def test_get_overview_not_authed(self):
response = self.get(
'/authed/add_sample_overview')
self.assertEqual(response.code, 404)
self.assertTrue(
... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requirements here
]
test_requirements = [
# TODO: put package test requirement... |
"""
Serial port support for Windows.
Requires PySerial and pywin32.
"""
import serial
from serial import PARITY_NONE, PARITY_EVEN, PARITY_ODD
from serial import STOPBITS_ONE, STOPBITS_TWO
from serial import FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS
import win32file, win32event
from twisted.internet import abstract
from s... |
from twisted.python.log import msg as _log
import logging
__all__ = ["debug", "info", "warn", "error", "crit"]
def debug(msg, *args):
return _log(msg, *args, level=logging.DEBUG)
def info(msg, *args):
return _log(msg, *args, level=logging.INFO)
def warn(msg, *args):
return _log(msg, *args, level=logging.WAR... |
"""Module for working with EOS MLAG resources
The Mlag resource provides configuration management of global and interface
MLAG settings on an EOS node.
Parameters:
config (dict): The global MLAG configuration values
interfaces (dict): The configured MLAG interfaces
Config Parameters:
domain_id (str): The do... |
"""Sets options for MOSEK.
"""
try:
from pymosek import mosekopt
except ImportError:
pass
from pypower._compat import PY2
from pypower.util import feval
if not PY2:
basestring = str
def mosek_options(overrides=None, ppopt=None):
"""Sets options for MOSEK.
Inputs are all optional, second argument mus... |
def patch_well_known_namespaces(etree_module):
from owslib.namespaces import Namespaces
ns = Namespaces()
"""Monkey patches the etree module to add some well-known namespaces."""
for k,v in ns.get_namespaces().iteritems():
etree_module.register_namespace(k, v)
try:
from lxml import etree
... |
import os
import glob
from menpo import menpo_src_dir_path
"""
This short script finds all GLSL shader files in the
menpo/rasterize/c/shaders/
directory and creates a header of string literals.
Shader files are considered as all files in the shader subdirectory.
For example,
menpo/rasterize/c/shaders/myshader.frag
gene... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('rapidsms', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Message',
fields=[
('id', models.AutoF... |
"""
Class and functions related to reserialization of requests/responses.
These are all to be considered private. You should not need to use them
directly except for special circumstances.
"""
import gzip
import logging
import re
from collections import OrderedDict
from werkzeug import http_date, cached_property
from .... |
from lettuce import *
from django.contrib.auth.models import User
from survey.features.page_objects.accounts import LoginPage
from survey.features.page_objects.aggregates import AggregateStatusPage, DownloadExcelPage
from survey.features.page_objects.households import NewHouseholdPage
from survey.features.page_objects.... |
from __future__ import absolute_import, print_function
import json
import logging
import sentry
from datetime import timedelta
from django.conf import settings
from django.utils import timezone
from hashlib import sha1
from uuid import uuid4
from sentry.app import tsdb
from sentry.http import safe_urlopen, safe_urlread... |
import sys
from setuptools import setup, find_packages
install_requires = [
'catkin-pkg >= 0.2.2',
'setuptools',
'empy',
'python-dateutil',
'PyYAML',
'rosdep >= 0.10.25',
'rosdistro >= 0.4.0',
'vcstools >= 0.1.22',
]
if sys.version_info[0] == 2 and sys.version_info[1] <= 6:
install_r... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
import base64
import codecs
import os
import random
from mock import patch
from bokeh.util.string import decode_utf8
from bokeh.util.session_id import ( generate_session_id,
gene... |
from __future__ import print_function
import argparse
import json
import os
import pprint
import string
import subprocess
import tempfile
parser = argparse.ArgumentParser(description='Process some cmdline flags.')
parser.add_argument('--gn', dest='gn_cmd', default='gn')
args = parser.parse_args()
def GenerateJSONFromGN... |
from __future__ import annotations
from typing import Any, Mapping, Optional, Sequence, Union
from pydantic import BaseModel, Extra, Field, root_validator, validator
from datadog_checks.base.utils.functions import identity
from datadog_checks.base.utils.models import validation
from . import defaults, validators
class ... |
import json
from django import forms
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
from wagtail.admin.staticfiles import versioned_static
from wagtail.admin.widgets import AdminChooser
from wagtail.core.models import Task
class AdminTaskChooser(AdminChooser):... |
import numpy as np
from copy import deepcopy
from menpo.base import Copyable
from menpo.transform.base import Alignment, Invertible, Transform
class TriangleContainmentError(Exception):
r"""
Exception that is thrown when an attempt is made to map a point with a
PWATransform that does not lie in a source tri... |
'''
'''
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
from tornado import gen
from abc import ABCMeta, abstractmethod
from ..util.future import with_metaclass
from ..util.tornado import yield_for_all_futures
from ..document import Document
class ServerContext(with_metaclass(ABC... |
import sensor, image, time, pyb
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
for i in range(10):
x = (pyb.rng() % (2*img.w... |
import original.mcpi.minecraft as minecraft
import modded.mcpi.minecraft as minecraftmodded
import original.mcpi.block as block
import time
def runTests(mc, extended=False):
#Hello World
mc.postToChat("Hello Minecraft World, testing starts")
#get/setPos
#get/setTilePos
pos = mc.player.getPos()
t... |
u"""
.. module:: models
"""
import logging
import os
import uuid
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models import F
from django.utils import timezone
logger = logging.getLogger('volontulo.models')
class Organization(models.Model):
... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "starter.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
mysterious_variable = 42 |
"""hug/_version.py
Defines hug version information
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the r... |
from __future__ import unicode_literals
from datetime import datetime
import json
import traceback
import frappe
import os
import uuid
import rq
MONITOR_REDIS_KEY = "monitor-transactions"
MONITOR_MAX_ENTRIES = 1000000
def start(transaction_type="request", method=None, kwargs=None):
if frappe.conf.monitor:
frappe.loc... |
import socket
import urllib3
import etcd
from etcd.tests.unit import TestClientApiBase
try:
import mock
except ImportError:
from unittest import mock
class TestClientApiInternals(TestClientApiBase):
def test_read_default_timeout(self):
""" Read timeout set to the default """
d = {
... |
from __future__ import print_function
__test__ = False
if __name__ == '__main__':
import MySQLdb as m
from eventlet import patcher
from eventlet.green import MySQLdb as gm
patcher.monkey_patch(all=True, MySQLdb=True)
patched_set = set(patcher.already_patched) - set(['psycopg'])
assert patched_se... |
import apscheduler
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'APScheduler'
copyright = u'Alex Grönholm'
version = apscheduler.version
release = apscheduler.release
exclude_trees = ['_build', 'build', '.tox', '.git... |
import unittest
from flask_security import RoleMixin, UserMixin, AnonymousUser
from flask_security.datastore import Datastore, UserDatastore
class Role(RoleMixin):
def __init__(self, name):
self.name = name
class User(UserMixin):
def __init__(self, email, roles):
self.email = email
self.... |
import pytest
from spacy.tokens import Doc
def test_noun_chunks_is_parsed_sv(sv_tokenizer):
"""Test that noun_chunks raises Value Error for 'sv' language if Doc is not parsed."""
doc = sv_tokenizer("Studenten läste den bästa boken")
with pytest.raises(ValueError):
list(doc.noun_chunks)
SV_NP_TEST_EX... |
'''
Python version of check_aqc_08_gradient_check.f.
Details of the original code are:
c/ DATE: JANUARY 28 2016
c/ AUTHOR: Viktor Gouretski
c/ AUTHOR'S AFFILIATION: Integrated Climate Data Center, University of Hamburg, Hamburg, Germany
c/ PROJECT: International Quality Controlled Ocean DataBase (IQuOD)
... |
from msrest.serialization import Model
class ResourceNameAvailabilityRequest(Model):
"""Resource name availability request content.
:param name: Resource name to verify.
:type name: str
:param type: Resource type used for verification. Possible values include:
'Site', 'Slot', 'HostingEnvironment'
... |
'''
It contains:
Motor Cortex = neurons, iaf_psc_exp glutamatergic
Striatum = neurons, iaf_psc_exp GABAergic
GPe: globus pallidus external = neurons, iaf_psc_exp GABAergic
GPi: globus pallidus internal = neurons, iaf_psc_exp GABAergic
STN: ... |
"""QGIS Unit tests for QgsVectorFileWriter.
.. note:: 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 2 of the License, or
(at your option) any later version.
"""
from builtins import n... |
"""Interface for Git API client classes."""
from abc import ABCMeta
class GitAPI:
"""Interface for Git API client classes."""
__metaclass__ = ABCMeta
@property
def repo_id(self):
raise NotImplementedError
@property
def auth_headers(self):
raise NotImplementedError
def get_rep... |
"""
Invenio import helper functions.
Usage example:
autodiscover_modules(['invenio'], '.+_tasks')
An import difference from pluginutils is that modules are imported in their
package hierarchy, contrary to pluginutils where modules are imported as
standalone Python modules.
"""
import imp
import re
from werkzeug impor... |
import os
import sys
import time
from spacewalk.common import usix
try:
# python 2
from ConfigParser import ConfigParser
except ImportError:
# python3
from configparser import ConfigParser
from spacewalk.common.rhnConfig import CFG
from spacewalk.server import rhnSQL, rhnUser
sys.path.insert(
0,
... |
import sys, os, string
VERSION = string.split("$Revision: 1.3 $")[1] #extract CVS version
if os.name == 'nt': #sys.platform == 'win32':
from serialwin32 import *
elif os.name == 'posix':
from serialposix import *
elif os.name == 'java':
from serialjava import *
else:
raise Exception("Sorry: no imple... |
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 field 'Subscription.last_activation_at'
db.add_column('chargify_subscription', 'last_activation_at', self.gf('django.db.models... |
import os
import time
from Tools.CList import CList
from Tools.HardwareInfo import HardwareInfo
from SystemInfo import SystemInfo
from Components.Console import Console
import Task
def readFile(filename):
file = open(filename)
data = file.read().strip()
file.close()
return data
def getProcMounts():
try:
mounts =... |
from django.conf import settings
from django.db import models
if settings.TESTING:
class TestModel(models.Model):
value = models.IntegerField(null=True)
value2 = models.IntegerField(null=True)
class TestModelChild(models.Model):
value = models.IntegerField(null=True)
value2 = mod... |
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class RabbitMQ(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""RabbitMQ messaging service
"""
plugin_name = 'rabbitmq'
profiles = ('services',)
files = ('/etc/rabbitmq/rabbitmq.conf',)
packages = ('rabbitmq-server',)
... |
"""Autocomplete with the standard library"""
import re
import rlcompleter
RE_INCOMPLETE_INDEX = re.compile('(.*?)\[[^\]]+$')
TEMP = '__tEmP__' # only \w characters are allowed!
TEMP_N = len(TEMP)
def is_dict(obj):
"""Returns whether obj is a dictionary"""
return hasattr(obj, 'keys') and hasattr(getattr(obj, 'k... |
from itertools import chain
import bpy
from sverchok.node_tree import SverchCustomTreeNode
class SvDeleteLooseNode(bpy.types.Node, SverchCustomTreeNode):
'''Delete vertices not used in face or edge'''
bl_idname = 'SvDeleteLooseNode'
bl_label = 'Delete Loose'
bl_icon = 'OUTLINER_OB_EMPTY'
def sv_init... |
'''
gimbal control module
Andrew Tridgell
January 2015
'''
import sys, os, time
from MAVProxy.modules.lib import mp_module
from MAVProxy.modules.lib import mp_util
from MAVProxy.modules.mavproxy_map import mp_slipmap
from pymavlink import mavutil
from pymavlink.rotmat import Vector3, Matrix3, Plane, Line
from math impo... |
"""
This is a loopback test which uses the MCP23S17 to test the quick2wire.spi.SPIDevice class.
Note: this test does *not* depend on the quick2wire.mcp23s17 module, so that it can be
released independently
"""
from quick2wire.spi import *
import pytest
IODIRA=0x00
IODIRB=0x01
GPIOA=0x12
GPIOB=0x13
MCP23S17_BASE_ADDRESS... |
from __future__ import (absolute_import, division, print_function)
import unittest
from mantid.kernel import PropertyManager, PropertyManagerDataService
class PropertyManagerDataServiceTest(unittest.TestCase):
def test_add_existing_mgr_object(self):
name = "PropertyManagerDataServiceTest_test_add_existing_m... |
import argparse
import multiprocessing
import os
import pickle
import threading
import numpy as np
from scipy.stats import ortho_group
from htmresearch_core.experimental import computeBinSidelength
def create_bases(k, s):
assert(k>1)
B = np.zeros((k,k))
B[:2,:2] = np.array([
[1.,0.],
[0.,1.]... |
import unittest
class TestQualityAction(unittest.TestCase):
# quality action has no code
pass |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter
class table__f_e_a_t(BaseTTXConverter):
pass |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: vmware_guest
short_description: Manages virtual machines in vC... |
from __future__ import absolute_import
from custodia.log import getLogger
logger = getLogger(__name__)
class InvalidMessage(Exception):
"""Invalid Message.
This exception is raised when a message cannot be parsed
or validated.
"""
def __init__(self, message=None):
logger.debug(message)
... |
'''
Crash Information
Represents information about a crash. Specific subclasses implement
different crash data supported by the implementation.
@author: Christian Holler (:decoder)
@license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed... |
import os
import shutil
from mock import Mock
from configman import ConfigurationManager
from nose.tools import eq_, ok_, assert_raises
from socorro.external.fs.crashstorage import (
FSLegacyDatedRadixTreeStorage,
FSTemporaryStorage
)
from socorro.external.crashstorage_base import (
CrashIDNotFound,
Mem... |
"""
Django models related to course groups functionality.
"""
import json
import logging
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models, transaction
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from opaq... |
from UM.Job import Job
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.SceneNode import SceneNode
from UM.Application import Application
from UM.Mesh.MeshData import MeshData
from UM.Message import Message
from UM.i18n import i18nCatalog
from cura import LayerData
from cura import Laye... |
"""Module containing the trivial predictor OPF model implementation. """
import itertools
from nupic.data import field_meta
from nupic.frameworks.opf import model
from nupic.frameworks.opf import opf_utils
from opf_utils import InferenceType
try:
import capnp
except ImportError:
capnp = None
if capnp:
from nupic.... |
from __future__ import unicode_literals
import frappe
from frappe.desk.reportview import get_match_cond
from frappe.model.db_query import DatabaseQuery
def get_filters_cond(doctype, filters, conditions):
if filters:
if isinstance(filters, dict):
filters = filters.items()
flt = []
for f in filters:
if is... |
""" Abaxis VetScan VS2
"""
from datetime import datetime
from bika.lims.exportimport.instruments.resultsimport import \
AnalysisResultsImporter, InstrumentCSVResultsFileParser
class AbaxisVetScanCSVParser(InstrumentCSVResultsFileParser):
def __init__(self, csv):
InstrumentCSVResultsFileParser.__init__(s... |
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../../configuration")
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
from scripts import *
from buildsite import *
from process import *
from tools import *
from directories import *
printLog(log, "")
printLog(... |
class PyAzuremlTrainAutomlClient(Package):
"""The azureml-train-automl-client package contains functionality for
automatically finding the best machine learning model and its parameters,
given training and test data."""
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
ur... |
from spack import *
class Spades(CMakePackage):
"""SPAdes - St. Petersburg genome assembler - is intended for both
standard isolates and single-cell MDA bacteria assemblies."""
homepage = "http://cab.spbu.ru/software/spades/"
url = "http://cab.spbu.ru/files/release3.10.1/SPAdes-3.10.1.tar.gz"
... |
from spack import *
class RNmf(RPackage):
"""Provides a framework to perform Non-negative Matrix Factorization (NMF).
The package implements a set of already published algorithms and seeding
methods, and provides a framework to test, develop and plug new/custom
algorithms. Most of the built-in algorithm... |
from django.core import validators
from django.utils.translation import ugettext_lazy as _
class MaxValueMultiFieldValidator(validators.MaxLengthValidator):
clean = lambda self, x: len(','.join(x))
code = 'max_multifield_value'
class MaxChoicesValidator(validators.MaxLengthValidator):
message = _(u'You must... |
"""Test suite for our JSON utilities.
"""
import json
from base64 import decodestring
import nose.tools as nt
from IPython.testing import decorators as dec
from ..jsonutil import json_clean, encode_images
from ..py3compat import unicode_to_str, str_to_bytes
def test():
# list of input/expected output. Use None for... |
import os
import sys
import time
import random as rnd
import subprocess as comm
import cv2
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.pyplot as plt
import pickle as pickle
import math
import MultiNEAT as NEAT
import pygame
from pygame.locals import *
from pygame.color import *
impo... |
import collections
import itertools
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import strutils
import six
from heat.common import exception
from heat.common.i18n import _
from heat.engine import constraints as constr
PARAMETER_KEYS = (
TYPE, DEFAULT, NO_ECHO, ALLOWED... |
from optparse import make_option
import os
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.importlib import import_module
import horizon
class Command(TemplateCommand):
args = "[name] [dashboard name] [optional destination directory... |
"""Windows application environment."""
import logging
from . import appenv
_LOGGER = logging.getLogger(__name__)
class WindowsAppEnvironment(appenv.AppEnvironment):
"""Windows Treadmill application environment.
:param root:
Path to the root directory of the Treadmill environment
:type root:
... |
import numpy as np
import tvm
from tvm import relay
from tvm.contrib import graph_executor
from tvm.relay.frontend.mxnet_qnn_op_utils import (
dequantize_mxnet_min_max,
quantize_mxnet_min_max,
get_mkldnn_int8_scale,
get_mkldnn_uint8_scale,
quantize_conv_bias_mkldnn_from_var,
)
def test_mkldnn_dequan... |
input = """
a :- not b.
a :- not c.
c :- not d.
d :- not b.
"""
output = """
{a, d}
""" |
'''
'''
from __future__ import division
from builtins import range
__docformat__ = 'restructuredtext'
__version__ = '$Id: pil.py 163 2006-11-13 04:15:46Z Alex.Holkner $'
from ctypes import *
from pyglet.com import IUnknown
from pyglet.gl import *
from pyglet.image import *
from pyglet.image.codecs import *
from pyglet.... |
import serial # type: ignore
from serial.tools import list_ports # type: ignore
import contextlib
import logging
log = logging.getLogger(__name__)
RECOVERY_TIMEOUT = 10
DEFAULT_SERIAL_TIMEOUT = 5
DEFAULT_WRITE_TIMEOUT = 30
class SerialNoResponse(Exception):
pass
def get_ports_by_name(device_name):
'''Returns ... |
"""Session Handling for SQLAlchemy backend.
Initializing:
* Call set_defaults with the minimal of the following kwargs:
sql_connection, sqlite_db
Example:
session.set_defaults(sql_connection="sqlite:///var/lib/nova/sqlite.db",
sqlite_db="/var/lib/nova/sqlite.db")
Recommended ways to u... |
r"""
werkzeug.contrib.securecookie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements a cookie that is not alterable from the client
because it adds a checksum the server checks for. You can use it as
session replacement if all you have is a user id or something to mark
a logged in user.
... |
"""This module is deprecated. Please use `airflow.providers.amazon.aws.operators.sagemaker_model`."""
import warnings
from airflow.providers.amazon.aws.operators.sagemaker_model import SageMakerModelOperator # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.operators.sagema... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.