code stringlengths 1 199k |
|---|
import json
import os
import sys
import tarfile
from argparse import ArgumentParser
from copy import deepcopy
from functools import partial
from itertools import chain
from subprocess import call
RPATH = "/usr/bin/Rscript"
BIN_BASE = "/home/NucleosomeDynamics"
GENOME_PATH_NAME = "refGenome_chromSizes"
def con... |
import termcolor
def __format_highlight(text, match, color, add_keys=None):
if add_keys is None:
return termcolor.colored(text, color)
else:
match_info = [
(str(k), str(v)) for k, v in sorted(match.items()) if k in add_keys
]
output = '[{} [{}]]'.format(
t... |
from django.db import models
from django.contrib.auth.models import User
from sorl.thumbnail import ImageField
SITE_TYPE_CHOICES = (
("one-page-site", "One page site"),
("small-site", "Small site"),
("blog", "Blog"),
("online-store", "Online store"),
("custom", "Custom"),
)
class SiteRequest(models.... |
from aeon.base.device import BaseDevice
from aeon.cumulus.connector import Connector
__all__ = ['Device']
class Device(BaseDevice):
OS_NAME = 'OPX'
def __init__(self, target, **kwargs):
"""
:param target: hostname or ipaddr of target device
:param kwargs:
'user' : login user-... |
import rospy
import time
from adlink_ddsbot.msg import MultiRobots, Robot
from geometry_msgs.msg import TransformStamped
class RobotIdFilter:
def __init__(self, selfId, mapId, id_timeout, sim_mode, fake_reliability, fake_radius):
self.sub = rospy.Subscriber('swarm_poses', TransformStamped, self.poseCB, queu... |
from sympy import *
def solve(A, b, c, B, verbose=False):
m, n = A.rows, A.cols
itr = 0
AB = A.extract(B, range(n))
bB = b.extract(B, [0])
x = AB.LUsolve(bB)
ABi = AB.inv()
while True:
itr += 1
if verbose: print(itr, x.T)
l = (c.T * ABi).T
if all(e >= 0 for e ... |
import mock
import pytest
from ._testing import _make_credentials
PROJECT = "project"
INSTANCE_ID = "instance-id"
APP_PROFILE_ID = "app-profile-id"
APP_PROFILE_NAME = "projects/{}/instances/{}/appProfiles/{}".format(
PROJECT, INSTANCE_ID, APP_PROFILE_ID
)
CLUSTER_ID = "cluster-id"
OP_ID = 8765
OP_NAME = "operations... |
daemonize yes
pidfile /usr/local/redis/var/redis.pid
port 6379
loglevel notice
logfile /usr/local/redis/var/redis.log
dir /usr/local/redis/var/
requirepass 123456
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64m... |
import posixpath
from pandac.PandaModules import *
class PhysicsObject:
"""Provides a simple physics object capability - replaces all of a specific
IsA in a scene with a specific mesh and specific physics capabilities.
Initialises such objects with simulation off, so they won't move until they
itnterac... |
r"""Utilities to simplify the canonical NQ data.
The canonical NQ data contains the HTML of each Wikipedia page along with a
sequence of tokens on that page, each of which is indexed into the HTML.
Many users will not want to use the HTML at all, and this file provides
utilities to extract only the text into a new reco... |
import os
from django.db import models
from django.utils import timezone
from django.db.models.signals import pre_save
from django.db.models.signals import post_delete
from django.dispatch.dispatcher import receiver
class Mentor(models.Model):
title = models.CharField(max_length=200)
description = models.TextFi... |
"""Configuration for the job submission application"""
import os.path
from desktop.lib.conf import Config, coerce_bool
from desktop.lib import paths
from django.utils.translation import ugettext_lazy as _
REMOTE_DATA_DIR = Config(
key="remote_data_dir",
default="/user/hue/jobsub",
help=_("Location on HDFS where t... |
from __future__ import absolute_import
import cython
cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object,
Options=object, UtilNodes=object, LetNode=object,
LetRefNode=object, TreeFragment=object, EncodedString=object,
error=object, warning=object,... |
import mock
import os
import unittest
from cloudbaseinit.metadata.services import ec2service
from cloudbaseinit.openstack.common import cfg
CONF = cfg.CONF
class Ec2ServiceTest(unittest.TestCase):
def setUp(self):
self._ec2service = ec2service.EC2Service()
@mock.patch('cloudbaseinit.metadata.services.ec... |
"""Tests for the Zeitgeist activity database plugin."""
import unittest
from plaso.formatters import zeitgeist # pylint: disable=unused-import
from plaso.lib import timelib
from plaso.parsers.sqlite_plugins import zeitgeist
from tests import test_lib as shared_test_lib
from tests.parsers.sqlite_plugins import test_lib... |
"""
Simple PyOF example
"""
import OFInterfaces.PyOF as PyOF
root = PyOF.CoordinateAxes("Origin")
fm = PyOF.FrameManager(root)
myWindow = PyOF.WindowProxy(50, 50, 800, 600, 1, 1, False, False)
myWindow.setScene(fm, 0, 0)
myWindow.startThread();
myWindow.join(); |
from jacket.api.compute.validation import parameter_types
_hints = {
'type': 'object',
'properties': {
'group': {
'type': 'string',
'format': 'uuid'
},
'different_host': {
# NOTE: The value of 'different_host' is the set of server
# uuids w... |
from nailgun import objects
class NailgunClusterAdapter(object):
def __init__(self, cluster):
self.cluster = cluster
@classmethod
def create(cls, data):
cluster = objects.Cluster.create(data)
return cls(cluster)
@property
def id(self):
return self.cluster.id
@prop... |
import bdkd.datastore
import h5py
class Dataset(object):
META_MAPS='maps'
META_RAW_ALL='raw_all'
META_SHARD_SIZE='shard_size'
META_README='readme'
META_X_NAME='x_name'
META_X_SIZE='x_size'
META_X_VARIABLES='x_variables'
META_Y_NAME='y_name'
META_Y_SIZE='y_size'
META_Y_VARIABLES='... |
import abc
import six
from healing.openstack.common import log
from healing.openstack.common import jsonutils
from healing.objects import alarm_track as alarm_obj
LOG = log.getLogger(__name__)
STATE_OK = 'ok'
STATE_ALARM = 'alarm'
STATE_INSUFFICIENT = 'insufficient'
OK_HOOK = 'ok_actions'
ALARM_HOOK = 'alarm_actions'
I... |
import math
import os
import random
import re
import sys
def _getSum(arr):
sumarr = 0
for i in arr:
sumarr = sumarr + i
return sumarr
def balancedSums(arr):
x = 0
arr_sum = _getSum(arr)
for y in arr:
if (2 * x) == (arr_sum - y):
return "YES"
else:
... |
"""Model architecture factory."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
from absl import logging
from projects.vild.modeling import vild_head
from modeling.architecture import efficientnet
from modeling.architecture import fpn
from model... |
import json
from collections import Mapping, defaultdict
from aiohttp.web_exceptions import HTTPBadRequest
class Errors(Mapping):
def __init__(self, *args, **kwargs):
self._errors = args
self._child_errors = {}
for k, v in kwargs.items():
if isinstance(v, str):
v ... |
"""Tracking for bluetooth low energy devices."""
import logging
from homeassistant.helpers.event import track_point_in_utc_time
from homeassistant.components.device_tracker import (
YAML_DEVICES, CONF_TRACK_NEW, CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL,
load_config, SOURCE_TYPE_BLUETOOTH_LE
)
import homeassist... |
class Colors(object):
N = '\033[m' # native
R = '\033[31m' # red
G = '\033[32m' # green
O = '\033[33m' # orange
B = '\033[34m' # blue
def exception(message):
print("{r}[!]{n} {message}".format(message=message, r=Colors.R, n=Colors.N))
def information(message):
print('{b}[*]{n} {message}'.for... |
"""
Example for writing a Demisto role
"""
from publishers.sample.sample_demisto import demisto_classification
from streamalert.shared.rule import rule
@rule(
logs=['osquery:differential'],
outputs=['demisto:sample-integration'],
publishers=[demisto_classification],
context={
'demisto': {
... |
import time
import sys
import math
import numpy
import classifier
import load
import copy
def TrainWordEmbedding():
context_window_size = 3
embedding_dimension = 100
num_hidden_layer = 10
learning_rate = 0.01
num_epoch = 100
# TODO: This is psedo minibatch. The real matrix batch size
# is really vocabular... |
"""The different kinds of actions that AndroidEnv supports."""
import enum
class ActionType(enum.IntEnum):
"""Integer values to describe each supported action in AndroidEnv."""
TOUCH = 0
LIFT = 1
REPEAT = 2 |
from __future__ import print_function
from tornado import gen, ioloop
from opentracing.mocktracer import MockTracer
from opentracing.scope_managers.tornado import TornadoScopeManager, \
tracer_stack_context
from ..testcase import OpenTracingTestCase
from ..utils import get_logger, stop_loop_when
logger = get_lo... |
import logging
from django.conf import settings
from troveclient.v1 import client
from openstack_dashboard.api import base
from horizon.utils import functions as utils
from horizon.utils.memoized import memoized # noqa
LOG = logging.getLogger(__name__)
@memoized
def troveclient(request):
insecure = getattr(setting... |
from __future__ import unicode_literals
from django.db import models
class AuthGroup(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=160, unique=True, blank=True)
class Meta:
db_table = 'auth_group'
class AuthGroupPermissions(models.Model):
id = model... |
'''
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... |
__author__ = 'wdolowicz'
from model.group import Group
import random
import pytest
def test_delete_some_group(app, db, check_ui):
with pytest.allure.step('Given a group list'):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test"))
old_groups = db.get_group_list()
... |
import os
import sh
from sh import docker
import socket
from time import sleep
LOCAL_IP_ENV = "MY_IP"
def get_ip():
"""Return a string of the IP of the hosts interface."""
try:
ip = os.environ[LOCAL_IP_ENV]
except KeyError:
# No env variable set; try to auto detect.
s = socket.socket... |
import scrapy
from stockSpider.items import BaseInfoItem
from stockSpider.spiders.base import BaseSpider
class ListSpider(BaseSpider):
name = 'stock_list'
keys = ['num']
stock_num = 'all'
allowed_domains = []
start_urls = []
def __init__(self, **kwargs):
super(ListSpider, self).__init__(... |
import os
import tensorflow as tf
from niftynet.application.regression_application import \
RegressionApplication, SUPPORTED_INPUT
from niftynet.engine.sampler_uniform_v2 import UniformSampler
from niftynet.engine.sampler_weighted_v2 import WeightedSampler
from niftynet.engine.application_variables import NETWORK_O... |
from robofab.world import CurrentFont
from robofab.interface.all.dialogs import GetFolder, Message, OneList, AskYesNoCancel, AskString, ProgressBar
def copyFont():
tempFont = fl.font
f = Font(tempFont)
if tempFont.ot_classes:
f.ot_classes = tempFont.ot_classes
if tempFont.features:
otFeatures = tempFont.feature... |
import sys
import gtk
from Borg import Borg
from NDImplementationDecorator import NDImplementationDecorator
class MisuseCaseNodeDialog:
def __init__(self,objt,environmentName,dupProperty,overridingEnvironment,builder):
self.window = builder.get_object("MisuseCaseNodeDialog")
self.decorator = NDImplementationD... |
import pwmodel
import sys
pwm = pwmodel.NGramPw('/home/rahul/passwords/rockyou-withcount.txt.gz', limit=1000000)
pws = pwm.generate_pws_in_order(int(sys.argv[1]), filter_func=lambda x: 6 <= len(x) <= 30)
print('\n'.join(str(x) for x in pws))
print("Total generated: {}".format(len(pws)))
print("Total Prob: {}".format(su... |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify impor... |
"""Test the ceilometer entrypoint for the notification collector
"""
import pkg_resources
import unittest
from akanda.ceilometer.notifications import NetworkBandwidthNotification
class TestCeilometerNotificationEntryPoint(unittest.TestCase):
NAMESPACE = 'ceilometer.collector'
def setUp(self):
self.plugi... |
"""
Copyright 2010-2012 Asidev s.r.l.
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 writing, softwar... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import numpy as np
import time
import functools
import paddle
import paddle.fluid as fluid
from operations import *
class Cell():
def __init__(self, genotype, C_prev_prev, C_prev, C, red... |
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... |
import pcbnew
board = pcbnew.GetBoard()
nets = board.GetNetsByName()
powernet = None
for name in ["+12V", "+5V", "GND"]:
if (nets.has_key(name)):
powernet = nets[name]
layertable = {}
if hasattr(pcbnew, "LAYER_ID_COUNT"):
pcbnew.PCB_LAYER_ID_COUNT = pcbnew.LAYER_ID_COUNT
numlayers = pcbnew.PCB_LAYER_ID_... |
import time
from dtest import Tester, debug
from thrift_tests import get_thrift_client
from cql.cassandra.ttypes import CfDef, ColumnParent, CounterColumn, \
ConsistencyLevel, ColumnPath
class TestSuperCounterClusterRestart(Tester):
"""
This test is part of this issue:
https://issues.apache.org/jira... |
try:
from pbr import version as pbr_version
except:
# no pbr available
version = 'unknown'
pass
else:
version = pbr_version.VersionInfo('py2pack').release_string() |
import script_chdir
from evaluation.eval_script import evaluate_models_xval, EvalModel
from hybrid_model.dataset import get_dataset
dataset = get_dataset('ml100k')
models = []
from hybrid_model.hybrid import HybridModel
from hybrid_model.config import hybrid_config
model_type = HybridModel
config = hybrid_config
models... |
from iAS.core.dbmgt.getConnection import *
class GoogleAuthentication:
def __init__(self):
pass
GOOGLE_CLIENT_ID = '239978309496-2ccenp36sor3hg2om4d4j6om0rbt29r6.apps.googleusercontent.com'
GOOGLE_CLIENT_SECRET = 'ejOiH0X0p8OfucKI-4d25mDG'
REDIRECT_URI = '/callback' # one of the Redirect URIs f... |
from __future__ import unicode_literals
from mopidy_frontend_for_adafruit_charlcdplate import Extension, frontend as frontend_lib
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[frontend_for_adafruit_charlcdplate]' in config
assert 'enabled = true' in config
d... |
import testinfra.utils.ansible_runner
'''
import pydevd
pydevd.settrace('192.168.99.1', port=51234,
stdoutToServer=True, stderrToServer=True)
'''
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('all')
def test_pip_is_installed(PipPackage):
... |
"""
gendoct.py
Generates a file of testcases which run the Python API documentation examples through doctest
https://docs.python.org/2/library/doctest.html
This is not a test content file itself, but a test generator as well as a library, which is why
it sits in the same folder as the test files.
This module locates al... |
import numpy as np
from scattertext.CSRMatrixTools import CSRMatrixFactory
from scattertext.ParsedCorpus import ParsedCorpus
from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc
from scattertext.indexstore.IndexStore import IndexStore
class CorpusFromParsedDocuments(object):
def __init__(self,
... |
from selenium import webdriver
baseUrl = "https://forum-testing.herokuapp.com/v1.0/demo"
driver = webdriver.Firefox()
driver.get(baseUrl)
elementByXpath = driver.find_element_by_xpath("//input[@id='name']")
if elementByXpath is not None:
print("We found an element by XPATH")
elementByCss = driver.find_element_by_cs... |
import logging
from autopyfactory.interfaces import SchedInterface
class KeepNQueueLife(SchedInterface):
"""
This plugin strives to keep a certain number of jobs/pilots/VMs running, regardless
of ready/activated or input.
If config keep_running is None, then it changes the sense of input from
new jo... |
from setuptools import find_packages, setup
def find_required():
with open("requirements.txt") as f:
return f.read().splitlines()
def find_dev_required():
with open("requirements-dev.txt") as f:
return f.read().splitlines()
setup(
name="blahblah",
version="1.5.0",
description="Fake d... |
"""Read the balance of your bank accounts via FinTS."""
from collections import namedtuple
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_USERNAME, CONF_PIN, CONF_URL, CONF_NAME
import homeassistant.... |
from __future__ import print_function, division, absolute_import
from isovar import ProteinSequenceCreator, ReadCollector
from nose.tools import eq_
from testing_helpers import load_bam, load_vcf
def test_translate_variant_collection():
variants = load_vcf("data/b16.f10/b16.vcf")
samfile = load_bam("data/b16.f1... |
"""
Gibbs sampler for non-negative matrix tri-factorisation.
Optimised to draw all columns in parallel.
We expect the following arguments:
- R, the matrix
- M, the mask matrix indicating observed values (1) and unobserved ones (0)
- K, the number of row clusters
- L, the number of column clusters
- priors = { 'alpha' =... |
"""
Simple examples of convolution to do some basic filters
Also demonstrates the use of TensorFlow data readers.
We will use some popular filters for our image.
It seems to be working with grayscale images, but not with rgb images.
It's probably because I didn't choose the right kernels for rgb images.
kernels for rgb... |
import os
import logging
from pysearpc import SearpcError
from rest_framework import status
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from django.utils.trans... |
from __future__ import unicode_literals
from datetime import timedelta
from mongoengine.base import BaseField
class TimeDeltaField(BaseField):
"""A TimeDeltaField field.
Looks to the outside world like a datatime.timedelta, but stores
in the database as an integer (or float) number of seconds.
"""
d... |
from google.cloud import deploy_v1
async def sample_create_release():
# Create a client
client = deploy_v1.CloudDeployAsyncClient()
# Initialize request argument(s)
request = deploy_v1.CreateReleaseRequest(
parent="parent_value",
release_id="release_id_value",
)
# Make the reques... |
import time
import six
import pyrax
import pyrax.exceptions as exc
import pyrax.utils as utils
from functools import wraps
from pyrax.resource import BaseResource
from pyrax.manager import BaseManager
from pyrax.client import BaseClient
SATA_MIN_SIZE = 75
SSD_MIN_SIZE = 50
MAX_SIZE = 1024
RETRY_INTERVAL = 5
MIN_SIZE=75... |
import os, sys, inspect, urllib, tempfile, logging, cPickle as pickle
from collections import OrderedDict
from .ast import *
from .exceptions import *
from .parser import Parser, ParseError as GParseError
from .dispatch import overload
from .helpers import *
import ast
sys.setrecursionlimit(10000)
BUILTIN = "quark"
BUI... |
"""
iSCSI driver for NetApp E-series storage systems.
"""
import copy
import math
import socket
import time
import uuid
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
import six
from cinder import exception
from cinder.i18n import _, _LE, _LI... |
import os
import sys
import eventlet
from eventlet import wsgi
from oslo.config import cfg
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(p... |
"""
Created on Sun Aug 25 22:57:26 2013
Copyright (c) 2013 RadiaBeam Technologies. All Rights Reserved
Generated by dataParse_v4.py2013-09-18 11:05:51
by Steven Wu, Mark Harrison
"""
from __future__ import print_function, division, unicode_literals, absolute_import
import string
import PyQt4.QtGui as pygui
import PyQt... |
import os
import unittest
from nose.tools import assert_equals, assert_true
from alooma import Client
class TestAlooma(unittest.TestCase):
def setUp(self):
"""
**** **** **** ******** **** **** ****
**** Getting an Alooma API Object ****
**** **** **** ******** **** **** ****
... |
import os
def f1(a):
pass
def f2(a, b, c):
pass
def comparer():
# This enables tracing in a custom build of mine.
a = 1
o = oct
o(a)
for i in range(100000):
# g1 == g2
f1( f2 ( os.path, os.unlink, os.rename ) )
if __name__ == "__main__":
comparer() |
"""
Counting fractions in a range
https://projecteuler.net/problem=73
"""
def main():
q = []
for i in range(1, 12000):
for j in range(1, 12000 + 1):
if j > i:
temp = float(i) / j
if float(1) / 3 < temp < float(1) / 2:
q.append(temp)
pri... |
"""Constants for the Toon integration."""
DOMAIN = 'toon'
DATA_TOON = 'toon'
DATA_TOON_CONFIG = 'toon_config'
DATA_TOON_CLIENT = 'toon_client'
CONF_CLIENT_ID = 'client_id'
CONF_CLIENT_SECRET = 'client_secret'
CONF_DISPLAY = 'display'
CONF_TENANT = 'tenant'
DEFAULT_MAX_TEMP = 30.0
DEFAULT_MIN_TEMP = 6.0
CURRENCY_EUR = '... |
from openprocurement.planning.api.utils import (
save_plan,
opresource,
apply_patch,
APIResource
)
from openprocurement.api.utils import (
get_file,
update_file_content_type,
upload_file,
context_unpack,
json_view
)
from openprocurement.api.validation import (
validate_file_updat... |
import functools
import tensorflow as tf
from tensorforce import util
from tensorforce.core import parameter_modules, SignatureDict, TensorSpec, tf_function, tf_util
from tensorforce.core.optimizers.solvers import Iterative
class ConjugateGradient(Iterative):
"""
Conjugate gradient algorithm which iteratively f... |
BOT_NAME = 'weather'
SPIDER_MODULES = ['weather.spiders']
NEWSPIDER_MODULE = 'weather.spiders'
ROBOTSTXT_OBEY = True
ITEM_PIPELINES = {
'weather.pipelines.WeatherPipeline': 1,
} |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.output_reporting import OutputSurfacesList
log = logging.getLogger(__name__)
class TestOutputSurfacesList(unittest.TestCase):
def setUp(self):
self.fd, self.path = tem... |
from solution import Solution
prices = [1, 2, 3, 0, 2]
sol = Solution()
res = sol.maxProfit(prices)
print(res) |
"""Loads device inventory for use by TCLI.
Implements API defined in inventory_base in order to pull devices from CSV file.
If devices are kept in a database or other, non CSV, inventory source then this
file can be replaced by a library that handles that source.
This can be achieved by copying the file and replacing t... |
import time
import json
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
runtime_props = ctx.instance.runtime_properties
SERVICE_NAME = runtime_props['service_name']
ctx_properties = ctx.no... |
import copy
import datetime
import json
import os
import six
from bson.objectid import ObjectId
from .model_base import AccessControlledModel, ValidationException, \
GirderException
from girder import events
from girder.constants import AccessType
from girder.utility.progress import noProgress, setResponseTimeLimit... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shutil
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
from pants.backend.jvm.targets.exclude import Exclude
from pants.backend.jv... |
"""
The artifact module provides objects and functions for working with artifacts
in a maven repository
"""
import re
from .errors import ArtifactParseError
from .versioning import VersionRange
MAVEN_COORDINATE_RE = re.compile(
r'(?P<group_id>[^:]+)'
r':(?P<artifact_id>[^:]+)'
r'(:(?P<type>[^:]+)(:(?P<class... |
import copy
import mock
from oslo.config import cfg
from neutron.agent.common import config as agent_config
from neutron.agent import l3_agent
from neutron.agent.linux import interface
from neutron.common import config as base_config
from neutron.common import constants as l3_constants
from neutron.openstack.common imp... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('skyshaker', '0033_auto_20141021_2308'),
]
operations = [
migrations.RemoveField(
model_name='project',
name='owner',
),
... |
'''
Created on May 24, 2013
@author: Kai Londenberg ( Kai.Londenberg@googlemail.com )
'''
import numpy as np
from pymc3_adapter import Context
class DiscretePGM(Context):
'''
A discrete Probabilistic Graphical Model
can be a directed, undirected or hybrid directed/undirected probabilistic model.
This cl... |
from django.shortcuts import render, redirect
from django.db.models import Count
from django.views.generic.edit import CreateView
from django.views.decorators.http import require_POST
from django.conf import settings
from django.http import HttpResponseBadRequest, HttpResponse
from django.shortcuts import get_object_or... |
from optparse import OptionParser
import select
from gwide.Classes.rRNAFromConcat import *
import gwide.methods as gtm
""" Script working with concat file generated by pileupsToConcat.py script. Can work on stdin from that script. Read concat file and according to options.
Print rRNA genes in order of experiments (... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0012_classroom_is_active'),
]
operations = [
migrations.AddField(
model_name='classroom',
name='start_date',
... |
import openmdao.api as om
from pycycle.constants import THERMO_DEFAULT_COMPOSITIONS
from pycycle.thermo.cea import species_data
from pycycle.elements.flow_start import FlowStart
from pycycle.element_base import Element
class CFDStart(Element):
def initialize(self):
self.options.declare('composition', defaul... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
from six import ite... |
import time
from serenity_pypeline.logger import log
from serenity_pypeline.pipeline_engine import PipelineEngine
from tests.usage import getSerializedUsage
ITERATIONS = 1
ITERVAL = 1 # seconds
if __name__ == "__main__":
iterations = ITERATIONS
fake_input = getSerializedUsage()
engine = PipelineEngine()
... |
import io
import os
import setuptools # type: ignore
version = "1.3.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-... |
from smtplib import SMTP, SMTP_SSL
from smtplib import SMTPException
from mimetypes import guess_type
from os.path import basename
from email.utils import COMMASPACE
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.encoders import encode... |
import pytest
import ray
from ray.tests.conftest import * # noqa
NUM_REPEATS = 10
NUM_TASKS = 10
def test_basic_actors(shutdown_only):
ray.init(num_cpus=2)
for _ in range(NUM_REPEATS):
ds = ray.data.range(NUM_TASKS)
ds = ds.window(blocks_per_window=1)
assert sorted(ds.map(lambda x: x + ... |
import org.vertx.java.core.AsyncResultHandler
from core.javautils import map_from_java, map_to_java
import net.kuujo.vertigo.component.ModuleConfig
import net.kuujo.vertigo.io.selector.RoundRobinSelector
import net.kuujo.vertigo.io.selector.RandomSelector
import net.kuujo.vertigo.io.selector.HashSelector
import net.kuu... |
"""
Thomson Reuters Data Citation Index service for registry objects.
"""
"""
The TR DCI service relies on a table "registry_object_citations".
The service operates as follows:
1. Get the registry objects to look up from the database.
2. Look up the registry objects in TR DCI, updating each one's
citation data in th... |
import eventlet
from eventlet.green import urllib2
urls = [
"http://www.google.com/intl/en_ALL/images/logo.gif",
"http://us.i1.yimg.com/us.yimg.com/i/ww/beta/y3.gif",
]
def fetch(url):
return urllib2.urlopen(url).read()
pool = eventlet.GreenPool()
for body in pool.imap(fetch, urls):
print("got body", le... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import logging
from abc import ABCMeta
from abc import abstractmethod
import numpy as np
from scipy.special import gammaln
from six import add_metaclass
from six.moves import range
from treecat.... |
from __future__ import print_function, division
import unittest, numpy as np
from pyscf import gto, scf
from pyscf.nao import nao, scf as scf_nao, conv_yzx2xyz_c
mol = gto.M( verbose = 1,
atom = '''
H 0 0 0
H 0 0.757 0.587''', basis = 'cc-pvdz',)
conv = conv_yzx2xyz_c(mol)
gt... |
from __future__ import absolute_import
from django.http import Http404
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import generics, permissions
from rest_framework_bulk import ListBulkCreateAPIView
from silver.api.filters import CustomerFilter, ProviderFilter
from silver.api.serial... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.