content stringlengths 4 20k |
|---|
#!/usr/bin/env python
from flexbe_core.core.exceptions import StateError
def _remove_duplicates(input_list):
output_list = list()
for entry in input_list:
if entry not in output_list:
output_list.append(entry)
return output_list
class State(object):
def __init__(self, *args, **k... |
"""
The agent plugin.
"""
from cli.exceptions import CLIException
from cli.mesos import get_agents
from cli.plugins import PluginBase
from cli.util import Table
PLUGIN_NAME = "agent"
PLUGIN_CLASS = "Agent"
VERSION = "Mesos CLI Agent Plugin"
SHORT_HELP = "Interacts with the Mesos agents"
class Agent(PluginBase):
... |
__author__ = 'Nick Flanders'
frequencies = dict(A_0 = 9,
A_1 = 21,
A_2 = 33,
A_3 = 45,
A_4 = 57,
A_5 = 69,
A_6 = 81,
A_7 = 93,
A_8 = 105,
A_9 = 117,
Ab_0 = 8,
Ab_1 = 20,
Ab_2 = 32,
Ab_3 = 44,
Ab_4 = 56,
Ab_5 = 68,
Ab_6 = 80,
Ab_7 = 92,
Ab_8 = 104,... |
import asyncio
import json
import os
import random
import aiohttp
import discord
from discord.ext import commands
class Memes:
"""
idk, it does meme stuff
"""
def __init__(self, bot):
self.IMGUR_API_LINK = "https://api.imgur.com/3/image"
self.bot = bot
self.config = bot.confi... |
# -*- coding: utf-8 -*-
# This file is placed into the public domain.
# Calculates the current version number. If possible, this is the
# output of “git describe”, modified to conform to the versioning
# scheme that setuptools uses. If “git describe” returns an error
# (most likely because we're in an unpacked copy of... |
"""
This module provides the profile object and support functions for loading and
saving user preferences between sessions. The preferences are saved on disk as
a cPickle, because of this no objects that cannot be resolved in the namespace
of this module prior to starting the mainloop must not be put in the Profile as
... |
from __future__ import unicode_literals
import json
from django.core.files.storage import get_storage_class
from django.http import HttpResponse, HttpResponseForbidden
from django.views.generic import View
from .forms import UploadForm
class UploadView(View):
"""Base view class for accepting file uploads."""
... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import TestSCons
def match_normcase(lines, matches):
if not isinstance(lines, list):
lines = lines.split("\n")
if not isinstance(matches, list):
matches = matches.split("\n")
if len(lines) != len(matches):
ret... |
import multiprocessing
import os.path
import sys
from requestbuilder import Arg
from requestbuilder.exceptions import ArgumentError
from requestbuilder.mixins import FileTransferProgressBarMixin
from euca2ools.bundle.util import open_pipe_fileobjs
from euca2ools.bundle.util import waitpid_in_thread
from euca2ools.com... |
from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor
from .common import InfoExtractor
class ComedyCentralIE(MTVServicesInfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www\.)?cc\.com/
(video-clips|episodes|cc-studios|video-collections|shows(?=/[^/]+/(?!full-episodes)))
... |
import unittest
import deps2submodules
class Deps2SubmodulesCollateDepsTest(unittest.TestCase):
def testBasic(self):
arg = ({
'src/monkeypatch': 'http://git.chromium.org/monkepatch.git@abc123',
'src/third_party/monkeyfood':
'http://git.chromium.org/monkeyfood@def456',
}, {}) # No OS-... |
from django.db import connection
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_object_permissions = False
supports_anonymous_user = True
# TODO: Model, login attribute name... |
# pylint: disable=W0201
from statsmodels.compat.python import iteritems, string_types, range
import numpy as np
from statsmodels.tools.decorators import cache_readonly
import pandas as pd
from . import var_model as _model
from . import util
from . import plotting
FULL_SAMPLE = 0
ROLLING = 1
EXPANDING = 2
def _get_... |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from colorama import init
from colorama import Fore, Back, Style
im... |
"""Tests for FSNS datasets module."""
import collections
import os
import tensorflow as tf
from tensorflow.contrib import slim
from datasets import fsns
from datasets import unittest_utils
from tensorflow.compat.v1 import flags
FLAGS = flags.FLAGS
def get_test_split():
config = fsns.DEFAULT_CONFIG.copy()
confi... |
#!/usr/bin/python3
import numpy as np
from pathlib import Path
import os
import requests
from collections import deque
import multiprocessing
from amscommon import read_config
import datetime
import cv2
import iproc
import time
import syslog
import sys
MORPH_KERNEL = np.ones((10, 10), np.uint8)
def main(orig_video_fi... |
import mock
import unittest
import pytest
from addons.base.tests.models import OAuthAddonNodeSettingsTestSuiteMixin
from addons.base.tests.models import OAuthAddonUserSettingTestSuiteMixin
from addons.box.models import NodeSettings
from addons.box.tests import factories
pytestmark = pytest.mark.django_db
class Te... |
import boto.ec2
from boto.sdb.db.property import StringProperty, IntegerProperty
from boto.manage import propget
InstanceTypes = ['m1.small', 'm1.large', 'm1.xlarge',
'c1.medium', 'c1.xlarge', 'm2.xlarge',
'm2.2xlarge', 'm2.4xlarge', 'cc1.4xlarge',
't1.micro']
class ... |
#!/usr/bin/env python
import sys
import yaml
def emit_func_bit(name, field, params):
bit_params = dict(name=name, field=field, word=int(params[0]), bit=int(params[1]))
print("""static inline bool ata_get_%(name)s_%(field)s(const unsigned char *buf) {
ata_word_t val = ata_get_word(buf, %(word)d);
return val & (1 <... |
## @package BlobWeightedSum
# Module caffe2.python.layers.blob_weighted_sum
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import schema
from caffe2.python.layers.layers import ModelLayer
class Bl... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import grpc
from pyhelm import tiller
from pyhelm import chartbuilder
H... |
#!/usr/bin/python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); yo... |
"""Constants used by insteon component."""
DOMAIN = "insteon"
INSTEON_ENTITIES = "entities"
CONF_IP_PORT = "ip_port"
CONF_HUB_USERNAME = "username"
CONF_HUB_PASSWORD = "password"
CONF_HUB_VERSION = "hub_version"
CONF_OVERRIDE = "device_override"
CONF_PLM_HUB_MSG = "Must configure either a PLM port or a Hub host"
CONF... |
import logging
from archivekit.ingest import Ingestor
from aleph.core import archive, celery
from aleph.processing.pipeline import make_pipeline # noqa
log = logging.getLogger(__name__)
@celery.task()
def ingest_url(collection_name, url, package_id=None, meta={}):
collection = archive.get(collection_name)
... |
import io
class ResettableIO(io.RawIOBase):
"""
Raw I/O implementation the input and output stream is resettable.
"""
def set_input_bytes(self, b):
self._input_bytes = b
self._input_offset = 0
self._size = len(b)
def readinto(self, b):
"""
Read up to len(b... |
# -*- coding: utf-8 -*-
import logging
import json
import sys
import requests
import pywikibot
from pywikibot import page
commons = pywikibot.Site('commons', 'commons')
tree = {}
nbCalls = 0
frequency = 50
# Logger logging on console and in debug
LOG = logging.getLogger("categories")
LOG_LEVEL = logging.DEBUG
console... |
"""
This script makes a dataset of two million approximately whitened patches,
extracted at random uniformly from the CIFAR-100 train dataset.
This script is intended to reproduce the preprocessing used by Adam Coates
et. al. in their work from the first half of 2011 on the CIFAR-10 and
STL-10 datasets.
"""
from __fut... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import socket
SUPPORTED_TRANSPORTS = ['tcp', 'udp', 'sctp', 'icmp', 'icmpv6']
SUPPORTED_PRIORITIES = ['low', 'medium', 'high']
SUPPORTED_ATTRIBUTES = ['local_ip', 'remote_ip', '... |
"""
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... |
"""
* Buttons and bodies
*
* by Ricard Marxer
*
* This example shows how to create bodies.
* It also demonstrates the use of bodies as buttons.
"""
from fisica import Fisica, FWorld, FBox, FCircle, FPoly
boxButton = None
circleButton = None
polyButton = None
world = None
buttonColor = color(0x15, 0x... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import subprocess
import time
from distutils import util
from ansible.errors import AnsibleError, AnsibleAssertionError
from ansible.module_utils._text import to_bytes, to_native, to_text
from ansible.utils.encrypt impo... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.playbook.block import Block
from ansible... |
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class Error(Model):
"""Error
:param status:
:type status: int
:param message:
:type message: str
"""
_attribute_map = {
'status': {'key': 'status', 'type': 'int'},
'message': {'key': ... |
from keras import backend as K
from keras.objectives import categorical_crossentropy
if K.image_dim_ordering() == 'tf':
import tensorflow as tf
lambda_rpn_regr = 1.0
lambda_rpn_class = 1.0
lambda_cls_regr = 1.0
lambda_cls_class = 1.0
epsilon = 1e-4
def rpn_loss_regr(num_anchors):
def rpn_loss_regr_fixed_num(y_t... |
HOSTS = [
"<EMAIL>",
"<EMAIL>",
]
'''
workspace configuration
'''
#root dir for workspace, can be set as any director with real user account
ROOT_DIR = "/home/paddle"
'''
network configuration
'''
#pserver nics
PADDLE_NIC = "eth0"
#pserver port
PADDLE_PORT = 7164
#pserver ports num
PADDLE_POR... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
try:
from pyVmomi import vim
except ImportError:
pass
from ansible.modul... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from yaml.constructor import SafeConstructor, ConstructorError
from yaml.nodes import MappingNode
from ansible.module_utils._text import to_bytes
from ansible.parsing.vault import VaultLib
from ansible.parsing.yaml.objects import ... |
__metaclass__ = type
import os
import re
from jhbuild.errors import FatalError, BuildStateError, CommandError
from jhbuild.modtypes import \
Package, DownloadableModule, register_module_type
from jhbuild.commands.sanitycheck import inpath
__all__ = [ 'WafModule' ]
class WafModule(Package, DownloadableModule):
... |
from bs4 import BeautifulSoup
import bs4
import requests
import re
import sys
import json
from urlparse import urljoin, urlparse
from Queue import Queue
email_regex = re.compile(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)")
phone_regex = re.compile(r"(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8... |
"""
A word stemmer based on the Lancaster stemming algorithm.
Paice, Chris D. "Another Stemmer." ACM SIGIR Forum 24.3 (1990): 56-61.
"""
import re
from api import StemmerI
class LancasterStemmer(StemmerI):
"""
Lancaster Stemmer
>>> from nltk.stem.lancaster import LancasterStemmer
>>> st = La... |
# coding: utf8
"""
tinycss.token_data
------------------
Shared data for both implementations (Cython and Python) of the tokenizer.
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
from __future__ import unicode_literals
import re
import sys
import operator
i... |
#!/usr/bin/env python3
import math
def calc_sqr_distance(a, b):
vx = a[0] - b[0]
vy = a[1] - b[1]
return vx * vx + vy * vy
def find_nearest_distance(uv, max_size, random_points):
xf, xi = math.modf(uv[0])
yf, yi = math.modf(uv[1])
min_sqr_distance = float("inf")
for y_offset in [-1... |
#!/usr/bin/python
from config import GLOBAL_SECTION
from utility import select_class, degToRad
FITNESS_SECTION = 'Fitness'
from math import pi,log, sqrt
def parse_config(config):
classes = [('HeurFitness', HeurFitness),('GPUFitness', GPUFitness),('ProjectFitness', ProjectFitness),('DummyFitness',DummyFitness)]
... |
"""
Parser and evaluator for FormulaResponse and NumericalResponse
Uses pyparsing to parse. Main function as of now is evaluator().
"""
import math
import operator
import numbers
import numpy
import scipy.constants
import functions
from pyparsing import (
Word, Literal, CaselessLiteral, ZeroOrMore, MatchFirst, O... |
import pytest
from bs4 import BeautifulSoup
from django.utils.encoding import force_text
from shuup.admin.modules.contacts.views.detail import ContactDetailView
from shuup.admin.modules.contacts.views.edit import ContactEditView
from shuup.apps.provides import override_provides
from shuup.testing.factories import cre... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from collections import OrderedDict
from error_handler import ReportError
from doxycomment import ExtractCommentBlocks,\
IsCommentBlockStart, IsCommentBlockEnd,\
IsInCommentBlock, GetCommentBlock,\
SplitLine, BlockHandler
def ProcessRegister(lineArr... |
from subprocess import Popen,PIPE
import sys
import json
#List openvz hosts
vzhosts = ['vzhost1','vzhost2','vzhost3']
#Add openvz hosts to the inventory and Add "_meta" trick
inventory = {'vzhosts': {'hosts': vzhosts}, '_meta': {'hostvars': {}}}
#default group, when description not defined
default_group = ['vzguest']... |
from abc import (
ABCMeta,
abstractmethod,
abstractproperty,
)
from cachetools import LRUCache
from numpy import around, hstack
from pandas.tslib import normalize_date
from six import with_metaclass
from zipline.lib._float64window import AdjustedArrayWindow as Float64Window
from zipline.lib.adjustment im... |
# -*- coding: utf-8 -*-
from functools import wraps
from celery import chain
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.db.models.query import QuerySet
from django_object_actions import DjangoObjectActions
# Register your models here.
from appliances.models import (
... |
"""Tests for tensorflow.python.ops.control_flow_util_v2."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import test_util
fr... |
"""The game model for a game where a ball has to be kept in the air.
The same is similar to breakout except that there are no blocks to break at
the top of the screen i.e. the objective is simply to keep the ball in the air
using a paddle as long as possible.
"""
import abc
import enum
import random
from typing impor... |
from bokeh.plotting import figure, hplot, output_file, show
from bokeh.models import ColumnDataSource, LinearColorMapper, HoverTool
from bokeh.models.actions import Callback
from bokeh.models.widgets import Slider
from bokeh.io import vform
import colorsys
# for plot 2: create colour spectrum of resolution N and brig... |
# -*- coding: utf-8 -*-
"""
The Pygments reStructuredText directive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a Docutils_ 0.5 directive that renders source code
(to HTML only, currently) via Pygments.
To use it, adjust the options below and copy the code into a module
that you i... |
DEFAULT_TIMEOUT = 10 # seconds
LONG_TIMEOUT = 60 # seconds
import os
import mozinfo
from wptmanifest.parser import atoms
atom_reset = atoms["Reset"]
enabled_tests = set(["testharness", "reftest", "wdspec"])
class Result(object):
def __init__(self, status, message, expected=None, extra=None):
if stat... |
"""Loader for the Labeled Faces in the Wild (LFW) dataset
This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:
http://vis-www.cs.umass.edu/lfw/
Each picture is centered on a single face. The typical task is called
Face Veri... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from units.compat.mock import patch
from ansible.modules.network.ingate import ig_unit_information
from units.modules.utils import set_module_args
from .ingate_module import TestIngateModule, load_fixture
class TestUni... |
from django.conf import settings
from django.contrib.auth import get_user_model, authenticate, login as auth_login
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.views import login
from django.views.generic import (
ListView,
DetailView,
CreateView,
UpdateView,
For... |
from entities.entities import Device, User
from helper.device_helper import DeviceHelper
from my_stats_messages.my_stats_messages import *
import logging
class UserHelper():
def __init__(self):
logging.info("constructor calling.")
def link_device(self, user, device):
user.devices.append(devic... |
"""
Awful module for the conversion from python types to qvariant, for make the wizard compatible with older version of pyqt (<= 4.4.3)
"""
from PyQt4.QtCore import *
import pickle
def getString(qvariant):
if type(qvariant) == str or type(qvariant) == unicode:
string = qvariant
else:
string = ... |
import tkinter as tk
from tkinter import filedialog
from tkinter import *
from tkinter import TOP, E
from Server import home_gui
class SettingsPage(tk.Frame):
def __init__(self, frame, gui):
# parameter: frame
# parameter: gui
"""
Init the frame.
"""
tk.Frame.__i... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_cpu_class
from units.modules.utils import set_module_args
from .nvos_module import TestNvosModule, load_fixture
class TestCpuClassMo... |
from usrpm import usrp_prims
# Copy everything that starts with FR_ or bmFR_ from the usrp_prims
# name space into our name space. This is effectively a python binding for
# the contents of firmware/include/fpga_regs_common.h and fpga_regs_standard.h
for name in dir(usrp_prims):
if name.startswith("FR_") or name... |
from vt_manager.models.VirtualMachine import VirtualMachine
from vt_manager.models.VTServer import VTServer
from vt_manager.models.Action import Action
from vt_manager.models.expiring_components import ExpiringComponents
from vt_manager.communication.sfa.util.xrn import Xrn, hrn_to_urn, get_leaf
from vt_manager.contr... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.network.nxos.nxos import load_config, run_commands
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansible... |
#Created by Dmytro Konobrytskyi, 2013 (github.com/Akson)
class Backend(object):
def __init__(self, parentNode):
self._parentNode = parentNode
def Delete(self):
"""
This method is called when a parent node is deleted.
"""
pass
def GetParameters(self):
"""... |
import pygame
from Vector import *
from LineSegment import *
class Barrier_Lines(pygame.sprite.Group):
def __init__(self):
pygame.sprite.Group.__init__(self)
self.lines = []
def new_line(self, pos1, pos2):
line = Line(pos1, pos2)
self.lines.append(line)... |
# -*- coding: utf-8 -*-
import imp
import sys
from pygments.style import Style
from pygments.token import *
# extracted from getbootstrap.com
class OdooStyle(Style):
background_color = '#ffffcc'
highlight_color = '#fcf8e3'
styles = {
Whitespace: '#BBB',
Error: 'bg:#FAA #A00',
Key... |
from __future__ import print_function, division
from re import match
from sympy import sympify
def mathematica(s):
return sympify(parse(s))
def parse(s):
s = s.strip()
# Begin rules
rules = (
# Arithmetic operation between a constant and a function
(r"\A(\d+)([*/+-^])(\w+\[[^\]]+[^... |
import os
from django.template import Context, Engine, TemplateDoesNotExist
from django.test import SimpleTestCase
from .utils import ROOT
RECURSIVE = os.path.join(ROOT, 'recursive_templates')
class ExtendsBehaviorTests(SimpleTestCase):
def test_normal_extend(self):
engine = Engine(dirs=[os.path.join(... |
"""
iri2uri
Converts an IRI to a URI.
"""
__author__ = "Joe Gregorio (<EMAIL>)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
__history__ = """
"""
import urlparse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characters we need t... |
# *- python -*
# import modules
import io, sys, getopt
import thot_smt_preproc as smtpr
##################################################
def print_help():
print >> sys.stderr, "thot_train_detok_model -r <string> [-t <string>] [-n <int>]"
print >> sys.stderr, " -o <string> [-v] [--help... |
import time
from collections import defaultdict
from openerp.osv import osv
from openerp.report import report_sxw
class report_rappel(report_sxw.rml_parse):
_name = "account_followup.report.rappel"
def __init__(self, cr, uid, name, context=None):
super(report_rappel, self).__init__(cr, uid, name, con... |
import glob
from optparse import OptionParser
import subprocess
import os
import os.path
import shutil
import sys
version = 'build-all.py, version 0.01'
build_dir = '../all-kernels'
make_command = ["vmlinux", "modules"]
make_env = os.environ
make_env.update({
'ARCH': 'arm',
'CROSS_COMPILE': 'arm-none-... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in bel... |
from unittest import skip
from django.contrib.auth.models import User
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from contentstore.tests.utils import AjaxEnabledTestClient
class InternationalizationTest(ModuleStoreTestCase):
"""
Tests to validate Internationalization.
"""
... |
REQ_IF_NONE_MATCH = "If-None-Match"
REQ_IF_MODIFIED_SINCE = "If-Modified-Since"
# ##############################################################################
# Response Header #
# (Lower Case) ... |
from msp430 import *
class SQ100LightSensor(SealSensor):
def __init__(self):
super(SQ100LightSensor, self).__init__("SQ100Light")
self.useFunction.value = "sq100LightRead()"
self.readFunction.value = "sq100LightRead()"
self.extraConfig = SealParameter("""
USE_ADS1115=y
CONST_ADS_INT... |
"""Support to emulate keyboard presses on host machine."""
from pykeyboard import PyKeyboard # pylint: disable=import-error
import voluptuous as vol
from homeassistant.const import (
SERVICE_MEDIA_NEXT_TRACK,
SERVICE_MEDIA_PLAY_PAUSE,
SERVICE_MEDIA_PREVIOUS_TRACK,
SERVICE_VOLUME_DOWN,
SERVICE_VOLU... |
########################################################################
# $HeadURL$
########################################################################
""" Legend encapsulates a graphical plot legend drawing tool
The DIRAC Graphs package is derived from the GraphTool plotting package of the
CMS/Phed... |
#!/usr/bin/env python
import os,glob,os.path,math
from enrico import utils
from enrico.gtfunction import Observation
from enrico.fitmaker import FitMaker
from enrico.plotting import plot_sed_fromconfig
from enrico import Loggin
import SummedLikelihood
from enrico.xml_model import XmlMaker
from enrico.extern.configobj i... |
# This contains most of the executable examples from Guido's descr
# tutorial, once at
#
# http://www.python.org/2.2/descrintro.html
#
# A few examples left implicit in the writeup were fleshed out, a few were
# skipped due to lack of interest (e.g., faking super() by hand isn't
# of much interest anymore), and a f... |
"""
I/O classes provide a uniform API for low-level input and output. Subclasses
will exist for a variety of input/output mechanisms.
"""
__docformat__ = 'reStructuredText'
import sys
try:
import locale
except:
pass
import re
import codecs
from docutils import TransformSpec
from docutils._compat import b
c... |
import os
import multiprocessing
import random
import signal
import time
import tempfile
from helpers import unittest, with_config
import luigi.rpc
import luigi.server
from luigi.scheduler import CentralPlannerScheduler
from tornado.testing import AsyncHTTPTestCase
class ServerTestBase(AsyncHTTPTestCase):
def ... |
"""Library of dtypes (Tensor element types)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.framework import types_pb2
class DType(object):
"""Represents the type of the elements in a `Tensor`.
The followin... |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.conf import settings
RELATIONSHIP_CACHE = getattr(settings, 'RELATIONSHIP_CACHE', 60*60*24*7)
RELATIONSHIP_CACHE_KEYS = {
'FRIENDS': 'friends',
... |
# Python test set -- built-in functions
import test.test_support, unittest
import sys
import pickle
import itertools
import warnings
warnings.filterwarnings("ignore", "integer argument expected",
DeprecationWarning, "unittest")
# pure Python implementations (3 args only), for comparison
def p... |
import json
import logging
import os
import os.path
import shutil
from django.conf import settings
from django.http import HttpResponse, HttpRequest
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from fine_uploader.forms import UploadFile... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
try:
import boto.ec2
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
import random
import string
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(
name=dict(required=True),
key_material=dict(required... |
import ceilometerclient.exc as ceilometer_exceptions
from cinderclient import exceptions as cinder_exceptions
import glanceclient.exc as glance_exceptions
from keystoneclient import exceptions as keystone_exceptions
from neutronclient.common import exceptions as neutron_exceptions
from novaclient import exceptions as n... |
"""Support for Daikin AirBase zones."""
import logging
from homeassistant.helpers.entity import ToggleEntity
from . import DOMAIN as DAIKIN_DOMAIN
_LOGGER = logging.getLogger(__name__)
ZONE_ICON = "mdi:home-circle"
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Old w... |
from PyQt4.QtCore import SIGNAL
from weboob.capabilities.video import ICapVideo
from weboob.tools.application.qt import QtMainWindow, QtDo
from weboob.tools.application.qt.backendcfg import BackendCfg
from weboob.applications.qvideoob.ui.main_window_ui import Ui_MainWindow
from .video import Video
from .minivideo im... |
r"""Demonstrates multiclass MNIST TF Boosted trees example.
This example demonstrates how to run experiments with TF Boosted Trees on
a MNIST dataset. We are using layer by layer boosting with diagonal hessian
strategy for multiclass handling, and cross entropy loss.
Example Usage:
python tensorflow/contrib... |
import sublime
import os, shlex
import subprocess
class Git:
def __init__(self, cwd):
self._cwd = cwd
self._git = "git"
s = sublime.load_settings("GitRebase.sublime-settings")
if s.get('git_command'):
self._git = s.get('git_command')
def log(self, limit = None):
git_command = "log --one... |
import pythoncom
import pywintypes
from win32com.ifilter import ifilter
from win32com.ifilter.ifiltercon import *
from win32com import storagecon
class FileParser:
# Property IDs for the Storage Property Set
PIDS_BODY = 0x00000013
# property IDs for HTML Storage Property Set
PIDH_DESC... |
from django.test import TestCase
from regressiontests.select_related_regress.models import *
class SelectRelatedRegressTests(TestCase):
def test_regression_7110(self):
"""
Regression test for bug #7110.
When using select_related(), we must query the
Device and Building tables usin... |
"""Test correct treatment of hex/oct constants.
This is complex because of changes due to PEP 237.
"""
import unittest
from test import test_support
class TestHexOctBin(unittest.TestCase):
def test_hex_baseline(self):
# A few upper/lowercase tests
self.assertEqual(0x0, 0X0)
self.assertE... |
#!/usr/bin/env python
"""
This software is licensed under the Apache 2 license, quoted below.
Copyright 2014 Xiao Wang <<EMAIL>, http://fclef.wordpress.com/about>
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
t... |
#!/usr/bin/env python
from setuptools import setup
setup(
name="xmlutils",
version="1.1",
description="A set of utilities for processing XML documents and converting to other formats",
author="Kailash Nadh",
author_email="<EMAIL>",
url="http://nadh.in/code/xmlutils.py",
packages=['xmlutils'],
download_url="ht... |
"""Tests for square-free decomposition algorithms and related tools. """
from sympy.polys.sqfreetools import (
dup_sqf_p, dmp_sqf_p,
dup_sqf_norm, dmp_sqf_norm,
dup_sqf_part, dmp_sqf_part,
dup_sqf_list, dup_sqf_list_include,
dmp_sqf_list, dmp_sqf_list_include,
dup_gff_list, dmp_gff_list)
from ... |
from __future__ import print_function
import errno
import os
import random
import select
import signal
import sys
import time
import traceback
from gunicorn.errors import HaltServer, AppImportError
from gunicorn.pidfile import Pidfile
from gunicorn.sock import create_sockets
from gunicorn import util
from gunicorn i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.