code stringlengths 1 199k |
|---|
"""
Sales module objects.
"""
from django.core.urlresolvers import reverse
from django.db import models
from treeio.core.models import Object, User, ModuleSetting
from treeio.identities.models import Contact
from treeio.finance.models import Transaction, Currency, Tax
from datetime import datetime, timedelta, time
from... |
from msrest.serialization import Model
class OperationDisplay(Model):
"""Display metadata associated with the operation.
:param provider: Service provider: Microsoft Network.
:type provider: str
:param resource: Resource on which the operation is performed.
:type resource: str
:param operation: ... |
import datetime as dt
import numpy as np
import pandas as pd
import QSTK.qstkutil.DataAccess as da
import QSTK.qstkutil.qsdateutil as du
def get_orders_list(s_file_path):
l_columns = ["year", "month", "day", "sym", "type", "num"]
df_orders_list = pd.read_csv(s_file_path, sep=',', header=None)
df_orders_list... |
"""
libG(oogle)Reader
Copyright (C) 2010 Matt Behrens <askedrelic@gmail.com> http://asktherelic.com
Python library for working with the unofficial Google Reader API.
Unit tests for oauth and ClientAuthMethod in libgreader.
"""
try:
import unittest2 as unittest
except:
import unittest
from libgreader import Goo... |
from .model import NetworkModel
from .view import NetworkView
from PyQt5.QtWidgets import QAction, QMenu
from PyQt5.QtGui import QCursor, QDesktopServices
from PyQt5.QtCore import pyqtSlot, QUrl, QObject
from duniterpy.api import bma
from duniterpy.documents import BMAEndpoint
class NetworkController(QObject):
"""
... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='Unirest',
version='1.1.7',
author='Mashape',
author_email='opensource@mashape.com',
packages=['unirest'],
url='https://github.com/Mashape/unirest-python',
license='LICENSE',
descri... |
import sys
import utils
sys.modules['piston.utils'] = utils
from piston.resource import Resource
class CsrfExemptResource(Resource):
"""A Custom Resource that is csrf exempt"""
def __init__(self, handler, authentication=None):
super(CsrfExemptResource, self).__init__(handler, authentication)
sel... |
"""
Django settings for pdc project.
Generated by 'django-admin startproject' using Django 1.8.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
import sys... |
bind = 'unix:/var/run/gunicorn.sock'
workers = 4
user = 'root'
loglevel = 'debug'
errorlog = '-'
logfile = '/var/log/gunicorn/debug.log'
timeout = 300
secure_scheme_headers = {
'X-SCHEME': 'https',
}
x_forwarded_for_header = 'X-FORWARDED-FOR' |
from msrest.paging import Paged
class USqlViewPaged(Paged):
"""
A paging container for iterating over a list of USqlView object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[USqlView]'}
}
def __init__(self, *arg... |
"""
libguestfs tools test utility functions.
"""
import logging
from autotest.client import os_dep, utils
from autotest.client.shared import error
import propcan
class LibguestfsCmdError(Exception):
"""
Error of libguestfs-tool command.
"""
def __init__(self, details=''):
self.details = details
... |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen, ConfigList
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigSubsection, ConfigBoolean, getConfigListEntry, ConfigSelection, ConfigYesNo, Config... |
import psutil, re, operator, time, sys
sampleTime=.5 # seconds
cmdPattern=r'.*cc1plus.* (\S+/)?([^/ ]+\.cpp).*'
cmdKeyGroup=2
maxMem={}
while True:
try:
for p in psutil.process_iter():
m=re.match(cmdPattern,' '.join(p.cmdline))
if not m: continue
key=m.group(cmdKeyGroup)
mem=p.get_memory_info()[1] # tupl... |
"""Service layer (domain model) of practice app
""" |
from enigma import eListboxPythonMultiContent, gFont, eEnv, getBoxType
from boxbranding import getMachineBrand, getMachineName
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.MenuList import MenuList
from Components.MultiContent import M... |
"""
Digital Signature Standard (DSS), as specified in `FIPS PUB 186-3`__.
A sender signs a message in the following way:
>>> from Cryptodome.Hash import SHA256
>>> from Cryptodome.PublicKey import ECC
>>> from Cryptodome.Signature import DSS
>>>
>>> message = b'I give my permissi... |
import os, sys, threading, subprocess, getopt, signal
path = [ ".", "..", "../..", "../../..", "../../../.." ]
head = os.path.dirname(sys.argv[0])
if len(head) > 0:
path = [os.path.join(head, p) for p in path]
path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
if... |
"""Contains filter-related code."""
def validate_filter_rules(filter_rules, all_categories):
"""Validate the given filter rules, and raise a ValueError if not valid.
Args:
filter_rules: A list of boolean filter rules, for example--
["-whitespace", "+whitespace/braces"]
all_catego... |
import numpy as np
from hyperspy._signals.signal2d import Signal2D
from hyperspy.decorators import interactive_range_selector
from hyperspy.exceptions import WrongObjectError
from hyperspy.model import BaseModel, ModelComponents, ModelSpecialSlicers
class Model2D(BaseModel):
"""Model and data fitting for two dimens... |
"""
Test of basic project saving and loading
"""
import mantidplottests
from mantidplottests import *
import shutil
import numpy as np
import re
from PyQt4 import QtGui, QtCore
class MantidPlotProjectSerialiseTest(unittest.TestCase):
def setUp(self):
self._project_name = "MantidPlotTestProject"
self... |
"""
Test cases for module Winapp
"""
import os
import shutil
import sys
import unittest
sys.path.append('.')
from bleachbit.Winapp import Winapp, detectos, detect_file, section2option
from bleachbit.Windows import detect_registry_key
import common
if 'nt' == os.name:
import _winreg
else:
def fake_detect_registr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.utils.vars import merge_hash
class AggregateStats:
''' holds stats about per-host activity during playbook runs '''
def __init__(self):
self.processed = {}
self.failures = {}
self.ok ... |
import sys
import logging
from . import config as Config
config = Config.Config()
loggers = {}
if config.debug_logging == "1":
for logger_name in config.loggers:
# Enable logging
logger = logging.getLogger(logger_name)
logger.setLevel(int(config.debug_level))
log_hdlr = logging.Strea... |
import frappe
from frappe import _
from frappe.utils import flt
def get_context(context):
context.no_cache = 1
context.show_sidebar = True
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
if hasattr(context.doc, "set_indicator"):
context.doc.set_indicator()
context.parents = frappe.f... |
"""
services-wrapper A small tool which wraps around check-services.php and tries to
guide the services process with a more modern approach with a
Queue and workers.
Based on the original version of poller-wrapper.py by Job Snijders
Author: Neil Lathwood <neil@librenms.org>
... |
from lib.testdata import CourseTestCase
from exercise.cache.content import CachedContent
from exercise.cache.points import CachedPoints
from .models import Threshold
class ThresholdTest(CourseTestCase):
class MockCachedPoints:
def __init__(self, total_data):
self.data = total_data
def to... |
from django.contrib import admin
from django.contrib import messages
from django.conf.urls import patterns
from django.utils.translation import ugettext as _
from django.db.models import Count
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_t... |
import table_designer |
"""
Django admin dashboard configuration.
"""
from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModelAdmin
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, ... |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('grades.exceptions', 'lms.djangoapps.grades.exceptions')
from lms.djangoapps.grades.exceptions import * |
from spack import *
class RLeaflet(RPackage):
"""Create and customize interactive maps using the 'Leaflet' JavaScript
library and the 'htmlwidgets' package. These maps can be used directly from
the R console, from 'RStudio', in Shiny apps and R Markdown documents."""
homepage = "http://rstudio.github.io... |
from spack import *
class Saws(AutotoolsPackage):
"""The Scientific Application Web server (SAWs) turns any C or C++
scientific or engineering application code into a webserver,
allowing one to examine (and even modify) the state of the
simulation with any browser from anywhere."""
homepage... |
from spack import *
class RGdsfmt(RPackage):
"""R Interface to CoreArray Genomic Data Structure (GDS) Files.
This package provides a high-level R interface to CoreArray Genomic Data
Structure (GDS) data files, which are portable across platforms with
hierarchical structure to store multiple sca... |
"""Test suite for the profile module."""
import sys
import pstats
import unittest
from difflib import unified_diff
from io import StringIO
from test.support import run_unittest
import profile
from test.profilee import testfunc, timer
class ProfileTest(unittest.TestCase):
profilerclass = profile.Profile
methodna... |
from suds.sax.element import Element
from suds.sax.parser import Parser
def basic():
xml = "<a>Me && <b>my</b> shadow's <i>dog</i> love to 'play' and sing "la,la,la";</a>"
p = Parser()
d = p.parse(string=xml)
a = d.root()
print('A(parsed)=\n%s... |
"""Tests for recent commit controllers."""
from __future__ import annotations
from core import feconf
from core.platform import models
from core.tests import test_utils
(exp_models,) = models.Registry.import_models([models.NAMES.exploration])
class RecentCommitsHandlerUnitTests(test_utils.GenericTestBase):
"""Test ... |
import unittest
from robotide.controller.filecontrollers import ResourceFileControllerFactory
class ResourceFileControllerFactoryTestCase(unittest.TestCase):
def setUp(self):
namespace = lambda:0
project = lambda:0
self._resource_file_controller_factory = ResourceFileControllerFactory(namesp... |
import demowlcutils
from demowlcutils import ppxml, WLC_login
from pprint import pprint as pp
from jnpr.wlc import WirelessLanController as WLC
wlc = WLC(host='a', user='b', password='c')
r = wlc.RpcMaker( target='vlan', name='Jeremy') |
from org.apache.hadoop.fs import Path
from org.apache.hadoop.io import *
from org.apache.hadoop.mapred import *
from org.apache.hadoop.abacus import *
from java.util import *;
import sys
class AbacusMapper(ValueAggregatorMapper):
def map(self, key, value, output, reporter):
ValueAggregatorMapper.map(self, k... |
import Axon
from Axon.Ipc import producerFinished
class Chooser(Axon.Component.component):
"""Chooses items out of a set, as directed by commands sent to its inbox
Emits the first item at initialisation, then whenever a command is received
it emits another item (unless you're asking it to step beyond the... |
from share.transform.chain import * # noqa
class AgentIdentifier(Parser):
uri = IRI(ctx)
class WorkIdentifier(Parser):
uri = IRI(ctx)
class Tag(Parser):
name = ctx
class ThroughTags(Parser):
tag = Delegate(Tag, ctx)
class Person(Parser):
given_name = ParseName(ctx.creator).first
family_name = P... |
"""Test zha sensor."""
from unittest import mock
import pytest
import zigpy.zcl.clusters.general as general
import zigpy.zcl.clusters.homeautomation as homeautomation
import zigpy.zcl.clusters.measurement as measurement
import zigpy.zcl.clusters.smartenergy as smartenergy
from homeassistant.components.sensor import DOM... |
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 'VoterFile.voter_file_content'
db.add_column('helios_voterfile', 'voter_file_content', self.gf('django.db.models.fields.... |
from __future__ import absolute_import
from __future__ import print_function
from django.core.management.base import BaseCommand
import sys
from zerver.lib.actions import do_deactivate_realm
from zerver.models import get_realm
class Command(BaseCommand):
help = """Script to deactivate a realm."""
def add_argume... |
""" Support import export formats."""
from __future__ import absolute_import as _abs
from .... import symbol
from .... import ndarray as nd
from ....base import string_types
from .import_helper import _convert_map as convert_map
class GraphProto(object): # pylint: disable=too-few-public-methods
"""A helper class fo... |
import requests
import json
from pyhpeimc.plat.device import *
HEADERS = {'Accept': 'application/json', 'Content-Type':
'application/json', 'Accept-encoding': 'application/json'}
"""
This section deals with HPE IMC Custom View functions
"""
def get_custom_views(auth: object, url: object, name: object = None, header... |
import functools
import itertools
import socket
import ssl
import time
import uuid
import eventlet
import greenlet
import kombu
import kombu.connection
import kombu.entity
import kombu.messaging
from oslo.config import cfg
from trove.openstack.common import excutils
from trove.openstack.common.gettextutils import _ # ... |
input = """
:- not b.
b :- a, not a.
a v c.
"""
output = """
""" |
'''Extract the net parameters from the pytorch file and store them
as python dict using cPickle. Must install pytorch.
'''
import torch.utils.model_zoo as model_zoo
import numpy as np
from argparse import ArgumentParser
import model
try:
import cPickle as pickle
except ModuleNotFoundError:
import pickle
URL_PRE... |
''' author@esilgard '''
import sys, os, codecs
import output_results, make_text_output_directory, metadata
from datetime import datetime
import global_strings as gb
'''
initial script of the Argos/NLP engine do deal with command line parsing and module outputs
should exit with a non-zero status for any fatal errors and... |
from oslo_log import log
from neutron.agent import agent_extensions_manager as agent_ext_manager
from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
LOG = log.getLogger(__name__)
L2_AGENT_EXT_MANAGER_NAMESPACE = 'neutron.agent.l2.extensions'
def register_opts(conf):
agent_ext_mgr_config.... |
from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSMetaData (TestCase):
def testConstants(self):
self.assertIsInstance(NSMetadataQueryDidStartGatheringNotification, unicode)
self.assertIsInstance(NSMetadataQueryGatheringPro... |
import pydev_log
import traceback
import pydevd_resolver
from pydevd_constants import * #@UnusedWildImport
from types import * #@UnusedWildImport
try:
from urllib import quote
except:
from urllib.parse import quote #@UnresolvedImport
try:
from xml.sax.saxutils import escape
def makeValidXmlValue(s):
... |
from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class AbsTests(TranspileTestCase):
def test_abs_not_implemented(self):
self.assertCodeExecution("""
class NotAbsLike:
pass
x = NotAbsLike()
try:
print(abs(x))
excep... |
from __future__ import absolute_import
import six
from base64 import b64encode
from django.core.urlresolvers import reverse
from sentry.models import UserAvatar
from sentry.testutils import APITestCase
class UserAvatarTest(APITestCase):
def test_get(self):
user = self.create_user(email='a@example.com')
... |
import json
import httplib
from conpaas.core import https
def _check(response):
code, body = response
if code != httplib.OK: raise Exception('Received http response code %d' % (code))
data = json.loads(body)
if data['error']: raise Exception(data['error'])
else: return data['result']
def check_agent_process(h... |
from __future__ import absolute_import, unicode_literals
import datetime
import pytest
from case import MagicMock, call, patch, skip
from kombu import Connection
from kombu.five import Empty
def _create_mock_connection(url='', **kwargs):
from kombu.transport import mongodb # noqa
class _Channel(mongodb.Channel... |
"""
.. _plot_montage:
Plotting sensor layouts of EEG systems
======================================
This example illustrates how to load all the EEG system montages
shipped in MNE-python, and display it on fsaverage template.
""" # noqa: D205, D400
import os.path as op
import mne
from mne.channels.montage import get_b... |
import os
import posixpath
import re
from collections import defaultdict
def uniform_path_format(native_path):
"""Alters the path if needed to be separated by forward slashes."""
return posixpath.normpath(native_path.replace(os.sep, posixpath.sep))
def parse(filename):
"""Searches the file for lines that start wi... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify that the Entry() global function and environment method work
correctly, and that the former does not try to expand construction
variables.
"""
import TestSCons
test = TestSCons.TestSCons()
test.write('SConstruct', """
env = Environment(FOO = 'fff'... |
import optparse
import os
import shutil
import sys
import unittest
from itertools import izip
from . import util
from . import stats
def clean_dir(path):
if os.path.exists(path):
shutil.rmtree(path)
def makedirs(path):
if not os.path.exists(path):
os.makedirs(path)
def make_clean_dir(path):
... |
import argparse
import errno
import hashlib
import os
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
get_zip_name
from lib.util import electron_gyp, execute, get_electron_version, \
... |
"""
Add an excerpt field to the page.
"""
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from feincms import extensions
class Extension(extensions.Extension):
def handle_model(self):
self.model.add_to_class(
... |
"""
Transforms needed by most or all documents:
- `Decorations`: Generate a document's header & footer.
- `Messages`: Placement of system messages stored in
`nodes.document.transform_messages`.
- `TestMessages`: Like `Messages`, used on test runs.
- `FinalReferences`: Resolve remaining references.
"""
__docformat__ =... |
from __future__ import unicode_literals, division, absolute_import
import logging
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import plugin
from flexget.event import event
try:
# NOTE: Importing other plugins is discouraged!
from flexget.components.parsing.parser... |
"""
Dtella - Google Spreadsheets Puller Module
Copyright (C) 2008 Dtella Labs (http://dtella.org)
Copyright (C) 2008 Paul Marks (http://pmarks.net)
$Id$
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 Foundatio... |
from invenio.legacy.dbquery import run_sql, IntegrityError
MAX_DB_RETRY = 10
class SequenceGenerator(object):
seq_name = None
def __init__(self):
assert self.seq_name
def _value_exists(self, value):
"""
Checks if the value exists in the storage
@param value: value to be check... |
from gi.repository import GLib
import abc
import collections
import queue
import threading
import traceback
from .debug import debug
class WorkerThread(threading.Thread):
__metaclass__ = abc.ABCMeta
__sentinel = object()
def __init__(self, callback, chunk_size=1, *args, **kwargs):
super().__init__(*... |
import ilastik.ilastik_logging
ilastik.ilastik_logging.default_config.init()
import unittest
import numpy
import vigra
from lazyflow.graph import Graph
from ilastik.applets.objectClassification.opObjectClassification import \
OpRelabelSegmentation, OpObjectTrain, OpObjectPredict, OpObjectClassification
from ilastik... |
import sys
import os
from urlparse import urlparse
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from xml.sax.handler import feature_namespaces
from xml.sax.xmlreader import InputSource
try:
from cStringIO import StringIO as _StringIO
except:
from StringIO import StringIO as _String... |
from docutils.parsers.rst import Directive, directives
from docutils import nodes
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from sphinx.util import compat
compat.make_admonition = BaseAdmonition
from sphinx import addnodes
from sphinx.locale import _
class bestpractice(nodes.Admonition, nod... |
class PyAzureMgmtDeploymentmanager(PythonPackage):
"""Microsoft Azure Deployment Manager Client Library for Python."""
homepage = "https://github.com/Azure/azure-sdk-for-python"
pypi = "azure-mgmt-deploymentmanager/azure-mgmt-deploymentmanager-0.2.0.zip"
version('0.2.0', sha256='46e342227993fc9acab1dda4... |
from spack import *
class Yajl(CMakePackage):
"""Yet Another JSON Library (YAJL)"""
homepage = "http://lloyd.github.io/yajl/"
url = "https://github.com/lloyd/yajl/archive/2.1.0.zip"
version('develop', git='https://github.com/lloyd/yajl.git', branch='master')
version('2.1.0', '5eb9c16539bf354b93... |
"""Test suite for abdt_branch."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import unittest
import phlgit_branch
import phlgit_push
import phlgit_revparse
import phlgitu_fixture
import phlgitx_refcache
import abdt_branch
import abdt_branchtest... |
from extractors.extract_website import ExtractWebsite
from datawakestreams.extractors.extractor_bolt import ExtractorBolt
class WebsiteBolt(ExtractorBolt):
name ='website_extractor'
def __init__(self):
ExtractorBolt.__init__(self)
self.extractor = ExtractWebsite() |
"""Spout for Apache Pulsar: """
import os
import tempfile
import pulsar
import heronpy.api.src.python.api_constants as api_constants
from heronpy.api.src.python.spout.spout import Spout
from heronpy.streamlet.src.python.streamletboltbase import StreamletBoltBase
def GenerateLogConfContents(logFileName):
return """
lo... |
"""
Internal client library for making calls directly to the servers rather than
through the proxy.
"""
import socket
from httplib import HTTPException
from time import time
from urllib import quote as _quote
from eventlet import sleep, Timeout
from swift.common.bufferedhttp import http_connect
from swiftclient import ... |
import sys
from Boxing import Box, dump_exception, load_exception
from ModuleNetProxy import RootImporter
from Lib import raise_exception, AttrFrontend
FRAME_REQUEST = 1
FRAME_RESULT = 2
FRAME_EXCEPTION = 3
class Connection(object):
"""
the rpyc connection layer (protocol and APIs). generally speaking, the only... |
from oslo_config import cfg
from nova.tests.functional.api_sample_tests import api_sample_base
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
ADMIN_API = True
exten... |
from __future__ import print_function
import time
import argparse
import grpc
from jaeger_client import Config
from grpc_opentracing import open_tracing_client_interceptor
from grpc_opentracing.grpcext import intercept_channel
import command_line_pb2
def run():
parser = argparse.ArgumentParser()
parser.add_argu... |
import cherrypy
import os
import six
from girder.constants import PACKAGE_DIR
def _mergeConfig(filename):
"""
Load `filename` into the cherrypy config.
Also, handle global options by putting them in the root.
"""
cherrypy._cpconfig.merge(cherrypy.config, filename)
# When in Sphinx, cherrypy may ... |
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import time
import unittest
import grpc
from apache_beam.portability.api.beam_provision_api_pb2 import (ProvisionInfo,
GetProvisionInfoResponse)
from apache_beam.portability... |
import multiprocessing
import os
import signal
import unittest
from datetime import timedelta
from time import sleep
from dateutil.relativedelta import relativedelta
from numpy.testing import assert_array_almost_equal
from airflow import DAG, exceptions, settings
from airflow.exceptions import AirflowException
from air... |
"""Image processing and decoding ops.
See the @{$python/image} guide.
@@decode_bmp
@@decode_gif
@@decode_jpeg
@@decode_and_crop_jpeg
@@encode_jpeg
@@extract_jpeg_shape
@@decode_png
@@encode_png
@@is_jpeg
@@decode_image
@@resize_images
@@resize_area
@@resize_bicubic
@@resize_bilinear
@@resize_nearest_neighbor
@@resize_i... |
"""
author: Lalit Jain, lalitkumarjj@gmail.com
modified: Chris Fernandez, chris2fernandez@gmail.com
last updated: 05/27/2015
A module for replicating the 25 total arms with 8 arms shown at a time tuple bandits pure exploration
experiments from the NEXT paper.
Usage:
python experiment_tuple_n25k8.py
"""
import os, sys
s... |
"""This code example updates a single placement to allow for AdSense targeting.
To determine which placements exist, run get_all_placements.py.
"""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
from googleads import dfp
PLACEMENT_ID = 'INSERT_PLACEMENT_ID_HERE'
def main(client, placement_id):
# Initi... |
try:
import unittest2 as unittest
except ImportError:
import unittest # noqa
import sys
from datetime import datetime, timedelta, date, tzinfo
from decimal import Decimal as D
from uuid import uuid4, uuid1
from cassandra import InvalidRequest
from cassandra.cqlengine.columns import TimeUUID
from cassandra.cqle... |
import os
from mi.logging import log
from mi.dataset.parser.zplsc_c import ZplscCParser
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.driver.zplsc_c.resource import RESOURCE_PATH
__author__ = 'Rene Gelinas'
MODULE_NAME = 'mi.dataset.parser.zplsc_c'
CLASS_NAME = 'ZplscCRecoveredDataPartic... |
import asyncio
import inspect
import warnings
from asgiref.sync import sync_to_async
class RemovedInDjango41Warning(DeprecationWarning):
pass
class RemovedInDjango50Warning(PendingDeprecationWarning):
pass
RemovedInNextVersionWarning = RemovedInDjango41Warning
class warn_about_renamed_method:
def __init__(s... |
from OpenGL import GL
import numpy
from depths import DepthOffset
from pymclevel import BoundingBox
from config import config
from albow.translate import _
class EditorTool(object):
surfaceBuild = False
panel = None
optionsPanel = None
toolIconName = None
worldTooltipText = None
previewRenderer ... |
import ast
import os.path
import platform
import re
import sys
class Config(object):
'''A Config contains a dictionary that species a build configuration.'''
# Valid values for target_os:
OS_ANDROID = 'android'
OS_CHROMEOS = 'chromeos'
OS_LINUX = 'linux'
OS_MAC = 'mac'
OS_WINDOWS = 'windows'
# Valid val... |
"""
For a detailed gene table and a summary gene table
"""
from collections import defaultdict
filename = 'detailed_gene_table_v75'
detailed_out = open(filename, 'w')
file = 'summary_gene_table_v75'
summary_out = open(file, 'w')
detailed_out.write("\t".join(["Chromosome","Gene_name","Is_hgnc","Ensembl_gene_id","Ensembl... |
import re
import chardet
import sys
RE_CHARSET = re.compile(br'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
RE_PRAGMA = re.compile(br'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
RE_XML = re.compile(br'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
CHARSETS = {
'big5': 'big5hkscs',
'gb2312': 'gb18030',
... |
import argparse
import sys
import paths
sys.path.append(paths.PTP_DIR)
import loader
import os
import tracelog
def export(filename, directory, trace, lib):
p = loader.load_project(filename)
if trace and lib:
target = "libtraced"
elif trace:
target = "traced"
elif lib:
target = "l... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ansible.constants as C
from ansible.errors import AnsibleParserError, AnsibleError, AnsibleAssertionError
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils._text import to_text
from ansibl... |
from module.plugins.internal.XFSAccount import XFSAccount
class OpenloadCo(XFSAccount):
__name__ = "OpenloadCo"
__type__ = "account"
__version__ = "0.02"
__status__ = "testing"
__description__ = """Openload.co account plugin"""
__license__ = "GPLv3"
__authors__ = [("Walter Pur... |
import logging
import re
import subprocess
from unittest import skipIf
from odoo import tools
from . import lint_case
RULES = ('{'
'"no-undef": "error",'
'"no-restricted-globals": ["error", "event", "self"],'
'"no-const-assign": ["error"],'
'"no-debugger": ["error"],'
'"no-dupe-c... |
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
from .common import *
import os... |
"""setup.py: setuptools control."""
import ez_setup
ez_setup.use_setuptools()
from os.path import dirname, abspath, join
from setuptools import setup
BASE_DIR = join(dirname(abspath(__file__)), 'orka/orka.py')
import orka
requires = ['kamaki','paramiko','requests','PyYAML']
setup(
name = "orka",
packages = ["or... |
from sys import version_info
from functools import reduce
from operator import mul
from flask_babel import gettext
if version_info[0] == 3:
unicode = str
keywords = ('min',
'max',
'avg',
'sum',
'prod')
def answer(query):
parts = query.query.split()
if len(part... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.