content stringlengths 4 20k |
|---|
from webob import exc
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova.i18n import _
ALIAS = "os-server-actions"
authorize_actions = extensions.extension_authorizer('compute',
... |
from south.db import db
from django.db import models
from mysite.profile.models import *
class Migration:
def forwards(self, orm):
# Adding field 'Person.ohloh_grab_completed'
db.add_column('profile_person', 'ohloh_grab_completed', models.BooleanField(default=False))
... |
import UnitTest
from string import Template
import sys
class TemplateStringTest(UnitTest.UnitTest):
def test_substitute(self):
try:
self.assertEqual(Template('This is a test of the $first method of the $second class'
).substitute(first='substitute',second='Temp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Composition) on 2016-06-23.
# 2016, SMART Health IT.
from . import domainresource
class Composition(domainresource.DomainResource):
""" A set of resources composed into a single coherent cl... |
"""A set of utilities to work with EE types."""
# Using lowercase function naming to match the JavaScript names.
# pylint: disable-msg=g-bad-name
import datetime
import numbers
import computedobject
import encodable
# The name of the property inserted into objects created by
# ee.CustomFunction.variable_() whose ... |
"""
In mitmproxy, protocols are implemented as a set of layers, which are composed on top each other.
The first layer is usually the proxy mode, e.g. transparent proxy or normal HTTP proxy. Next,
various protocol layers are stacked on top of each other - imagine WebSockets on top of an HTTP
Upgrade request. An actual m... |
from __future__ import absolute_import, print_function, division
from llvmlite.llvmpy.core import Module, Type, Builder
from numba.cuda.cudadrv.nvvm import (NVVM, CompilationUnit, llvm_to_ptx,
set_cuda_kernel, fix_data_layout,
get_arch_option, S... |
# Lukas Schwab, 6/18/14
# github.com/lukasschwab
# <EMAIL>
#-----------------------#
# Finds the average tint of one input color, scales another input color so the tint matches
#
# Here's some math:
# Normally you would express tint like this:
# tint = (r+g+b)/3
# But here is a comparison of two, so the "/3" is irre... |
#!/sw/bin/python2.7
from PyxUtils import *
from LinFitter import *
def foilPlots():
gdat = [[0, 5454.613657, 5.315878], [1, 5236.656481, 13.680301], [2, 5011.568849, 19.121518], [3, 4779.527688, 23.611639], [4, 4538.714897, 27.468423], [5, 4288.680534, 31.241567], [6, 4027.857506, 35.217324], [7, 3754.420640, 39.238... |
import threading
from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER
from django.contrib.gis import memoryview
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_stri... |
import atexit
import logging
from pylib import android_commands
from pylib.device import device_utils
class PerfControl(object):
"""Provides methods for setting the performance mode of a device."""
_CPU_PATH = '/sys/devices/system/cpu'
_KERNEL_MAX = '/sys/devices/system/cpu/kernel_max'
def __init__(self, dev... |
"""
An Attempted Task class that would evolve organisms to revolve around a point
"""
import time
import numpy as np
from ..gene_alg_2.genetic_algorithm import GeneticAlgorithm
class OrbitalTask(object):
"""
Allows a robot to orbit around a fixed goal.
"""
def train(self, robot):
"""
... |
'''
Created on Jan 25, 2014
@author: gabriel
'''
from pymouse import PyMouse
from pykeyboard import PyKeyboard
import webbrowser
MOTION_DOWN = 0
MOTION_MOVE = 1
MOTION_UP = 2
GESTURE_TAP = 0
GESTURE_DOUBLE_TAP = 1
GESTURE_LONG_PRESS = 2
GESTURE_LONG_PRESS_DRAG = 3
GESTURE_SCROLL = 4
GESTURE_RIGHT_CLICK = 5
GESTURE_... |
import datetime
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from nova import compute
from nova import db
from nova import exception
from nova import objects
from nova.objects import instance as instance_obj
from nova import test
from nova.tests.unit.api.openstack import fakes
from nova.t... |
from __future__ import unicode_literals
__author__ = "mozman <<EMAIL>>"
from . import dxf12
from .dxfentity import DXFEntity
from .dxfattr import DXFAttr, DXFAttributes, DefSubclass
from . import const
from .const import XTYPE_2D, XTYPE_3D, XTYPE_2D_3D
from .tags import Tags
from .decode import decode
none_subclass ... |
"""
Utilities for memcache encryption and integrity check.
Data should be serialized before entering these functions. Encryption
has a dependency on the pycrypto. If pycrypto is not available,
CryptoUnavailableError will be raised.
This module will not be called unless signing or encryption is enabled
in the config. ... |
DEP_FILESYSTEM = "FILESYSTEM"
DEP_NETWORK = "NETWORK"
import cloudinit.UserDataHandler as ud
import cloudinit.util as util
import socket
class DataSource:
userdata = None
metadata = None
userdata_raw = None
cfgname = ""
# system config (passed in from cloudinit,
# cloud-config before input fr... |
from __future__ import unicode_literals
from psycopg2.extras import Inet
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
class DatabaseOperations(BaseDatabaseOperations):
def unification_cast_sql(self, output_field):
internal_type = output_field.get... |
"""
Duplicity specific but otherwise generic threading interfaces and
utilities.
(Not called "threading" because we do not want to conflict with
the standard threading module, and absolute imports require
at least python 2.5.)
"""
_threading_supported = True
try:
import thread
except ImportError:
import dumm... |
def get_historical_closes(ticker, start_date, end_date):
import pandas_datareader.data as web
p = web.DataReader(ticker, "yahoo", start_date, end_date).sort_index('major_axis')
d = p.to_frame()['Adj Close'].reset_index()
d.rename(columns={'minor': 'Ticker', 'Adj Close': 'Close'}, inplace=True)
pivot... |
from __future__ import absolute_import
# Somewhat surprisingly, it turns out that this is much slower than
# simply storing the ints in a set() type. Python's performance model
# is very different to that of C.
class IntSet(Exception):
"""Faster set-like class storing only whole numbers.
Despite the name... |
"""Utility functions for finding modules
Utility functions for finding modules on sys.path.
`find_mod` finds named module on sys.path.
`get_init` helper function that finds __init__ file in a directory.
`find_module` variant of imp.find_module in std_lib that only returns
path to module and not an open file object ... |
{
'name': 'Add multiprice to product form view',
'version': '8.0.1.0.0',
'category': 'Sales',
'depends': ['product_multiprices'],
'author': 'Elico Corp',
'license': 'AGPL-3',
'website': 'https://www.elico-corp.com',
'support': '<EMAIL>',
'data': ['views/product.xml'],
'installabl... |
"""
The Utils methods.
"""
import socket
from selenium.webdriver.common.keys import Keys
try:
basestring
except NameError:
# Python 3
basestring = str
def free_port():
"""
Determines a free port using sockets.
"""
free_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
free_so... |
from resources.lib.kodion.items import VideoItem
__author__ = 'bromix'
import re
from resources.lib import kodion
from resources.lib.kodion import utils
from resources.lib.youtube.helper import yt_context_menu
__RE_SEASON_EPISODE_MATCHES__ = [re.compile(r'Part (?P<episode>\d+)'),
r... |
"""
This module provides a :class:`~xblock.field_data.FieldData` implementation
which wraps an other `FieldData` object and provides overrides based on the
user. The use of providers allows for overrides that are arbitrarily
extensible. One provider is found in `courseware.student_field_overrides`
which allows for fi... |
import datetime
import json
import re
import sys
import sqlalchemy
from flask import request
from ggrc.settings import CUSTOM_URL_ROOT
from ggrc.utils import benchmarks
class GrcEncoder(json.JSONEncoder):
"""Custom JSON Encoder to handle datetime objects and sets
from:
`http://stackoverflow.com/questions/... |
import os.path as op
import inspect
from .base import (PYTYPE2SPEC, tmpl_replace, copy_objp_unit, ArgSpec, MethodSpec, ClassSpec,
get_objc_signature)
TEMPLATE_HEADER = """
#import <Cocoa/Cocoa.h>
#import <Python.h>
%%imports%%
@interface %%classname%%:NSObject %%protocols%%
{
PyObject *_py;
}
- (PyObject *)p... |
import fauxfactory
import pytest
from cfme import test_requirements
from cfme.automate.explorer.domain import DomainCollection
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from c... |
# -*- coding: utf-8 -*-
from __future__ import print_function
# by Siddharth Duahantha
# 28 July 2017
import sys
import argparse
COW = r""" \ ^__^
\ (oo)\_______
(__)\ )\/\\
||----w |
|| ||
"""
def get_cow(text):
"""create a strin... |
"""Gradients for operators defined in array_ops.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_util
from tensorflow.python.ops import array_ops
from tensorflo... |
from account.models import RegistrationForm
from account.utils import *
from account.forms import EditProfileForm
from django.contrib.auth.models import User
from django.template.response import TemplateResponse
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django... |
import sys
import os
#sys.path.append(os.environ['CUON_PATH'])
from cuon.Databases.SingleData import SingleData
import logging
import threading
import SingleGrave
import SingleGraveServiceNotes
class SingleGraveSpring(SingleData):
def __init__(self, allTables):
SingleData.__init__(self)
# ... |
import os
AUTHOR = 'Honza Javorek'
# ABOUT = 'This blog is about kittens and other cute animals.'
# ABOUT_IMAGE = '/images/kitty.jpg'
# ABOUT_HEADING = 'Honza'
# DEFAULT_IMAGE = '/images/default-article-image.jpg'
# SITENAME = 'My Blog'
# SITESUBTITLE = 'The best blog.'
# TWITTER_USERNAME_SITE = 'napyvo'
# TWITTER... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.ip_messaging.v2.credential import CredentialList
from twilio.rest.ip_messaging.v2.service import ServiceList
class V2(Version):
def __i... |
from oslo.config import cfg
from nova import config
from nova import ipv6
from nova.openstack.common.fixture import config as config_fixture
from nova import paths
from nova.tests import utils
CONF = cfg.CONF
CONF.import_opt('use_ipv6', 'nova.netconf')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('schedul... |
# -*- coding: utf-8 -*-
"""This module investigates the properties of paths of length two (A - B - C)."""
from typing import Dict, Iterable, List, Mapping, Tuple
from pybel import BELGraph
from pybel.constants import (
ACTIVITY, CAUSAL_RELATIONS, DEGRADATION, LINE, MODIFIER, RELATION, SOURCE, TARGET, TRANSLOCATI... |
import os
import six
from hachoir_core.error import HachoirError
from hachoir_metadata import extractMetadata
from hachoir_parser import createParser
try:
from girder.utility.model_importer import ModelImporter
except ImportError:
ModelImporter = None
class MetadataExtractor(object):
def __init__(self,... |
import re
import os
try:
import gconf
except ImportError:
from gnome import gconf
import conduit.platform
import logging
log = logging.getLogger("Settings")
class SettingsImpl(conduit.platform.Settings):
"""
Settings implementation which stores settings in GConf
"""
CONDUIT_GCONF_DI... |
from eventlet import Timeout
import mock
import trove.common.context as context
from trove.common import exception
from trove.common.rpc.version import RPC_API_VERSION
from trove.common.strategies.cluster.experimental.galera_common.guestagent \
import GaleraCommonGuestAgentStrategy
from trove import rpc
from trove... |
from database.queries.select_queries import IS_USER_IN_USERS
from database.queries.insert_queries import INSERT_USER
from settings.SharedVariables import SharedVariables
class Users:
def __init__(self):
try:
self.c = SharedVariables.database.get_cursor()
except Exception:
... |
import os, signal, logging
from functools import wraps
def dump(obj, level=0):
prefix = level*'*'+' ' if level > 0 else ''
if type(obj) == dict:
for k, v in obj.items():
if hasattr(v, '__iter__'):
print "%s%s" % (prefix, k)
dump(v, level+1)
else:... |
"""
Ruby inline shellcode injector
TODO: better randomization
Module built by @harmj0y
"""
from modules.common import shellcode
from modules.common import helpers
class Payload:
def __init__(self):
# required options
self.description = "VirtualAlloc pattern for shellcode injection"
... |
# -*- coding: utf-8 -*-
'''
Support for LVS (Linux Virtual Server)
'''
from __future__ import absolute_import
# Import python libs
# Import salt libs
import salt.utils
import salt.utils.decorators as decorators
from salt.exceptions import SaltException
__func_alias__ = {
'list_': 'list'
}
# Cache the output o... |
import l10n_cr_account_trial_balance_wizard |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from mock import MagicMock
from units.compat import unittest
from ansible.plugins.terminal import slxos
from ansible.errors import AnsibleConnectionFailure
class TestPluginTerminalSLXOS(unittest.TestCase):
""" Test class for... |
"""
Various tools to edit rests of selected music.
All use the tools in ly.rests.
"""
from __future__ import unicode_literals
import lydocument
import ly.rests
def fmrest2spacer(cursor):
ly.rests.replace_fmrest(lydocument.cursor(cursor), 's')
def spacer2fmrest(cursor):
ly.rests.replace_spacer(lydocument.... |
import json
import os
'''
Class responsible for parsing/validating the local function specs, processing the specs,
and returning something that can be saved to the DB.
Typical usage is to initialize and the read_and_validate.
Then, once a compilation report is made, you can perform a full validation.
Finally, to cr... |
"""
Fragment for rendering the course dates sidebar.
"""
from django.http import Http404
from django.template.loader import render_to_string
from django.utils.translation import get_language_bidi
from opaque_keys.edx.keys import CourseKey
from web_fragments.fragment import Fragment
from courseware.courses import get_c... |
#!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
from codecs import open
setup(
name='rental_data',
version='0.1',
description='Code for downloading data from real estate webs.',
long_description='',
url='https://github.com/davidvg/rental_data',
author='Dav... |
"""
The Sultan's Riddle
source: https://explainextended.com/2016/12/31/happy-new-year-8/
Once upon a time there was a Sultan who was looking for a vizier to help him
rule his country. It became known to him that among the multitudes of his loyal
subjects that populated his glorious empire, two were regarded as the mo... |
import math
class Decimal(float):
'''This is required for backwards compatibility with users performing operations over expected decimal types.
NOTE: previously we converted C# decimal into python Decimal, but now its converted to python float due to performance.'''
def __init__(self, obj):
self = ... |
from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase, build_parser_function
class TestMetainfo(FlexGetBase):
__yaml__ = """
tasks:
test_content_size:
mock:
- {title: 'size 10MB', description: 'metainfo content size should par... |
import datetime
import mock
from oslo_config import cfg
from oslo_utils import timeutils
from nova import context
from nova import exception
from nova.network import model as network_model
from nova import objects
from nova.objects import virtual_interface
from nova.tests.functional import integrated_helpers
from nova... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: purefa_host
version_added: '2.4'
short_description: Manage h... |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.BufAllpassN import BufAllpassN
class BufAllpassC(BufAllpassN):
r'''A buffer-based cubic-interpolating allpass delay line unit generator.
::
>>> buffer_id = 0
>>> source = ugentools.In.ar(bus=0)
>>> ugentools.BufAllpassC.ar(
... |
########################################################################
# $HeadURL$
########################################################################
""" GraphUtilities is a a collection of utility functions and classes used
in the DIRAC Graphs package.
The DIRAC Graphs package is derived from the... |
import pandas as pd
reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0)
def check_q1(ans):
expected = reviews.points.median()
return ans == expected if type(ans) == float else False
def answer_q1():
print("""reviews.points.median()""")
def check_q2(ans):
expected =... |
#!/usr/bin/env python
import unittest
from eulcore import xpath
from eulcore.xpath import ast, serialize
from testcore import main
class ParseTest(unittest.TestCase):
def test_nametest_step(self):
xp = xpath.parse('''author''')
self.assert_(isinstance(xp, ast.Step))
self.assert_(xp.axis ... |
import CTK
from Rule import RulePlugin
from util import *
URL_APPLY = '/plugin/%s/apply'
def apply (extension):
# POST info
key = CTK.post.pop ('key', None)
vsrv_num = CTK.post.pop ('vsrv_num', None)
new_val = CTK.post.pop ('tmp!%s'%(extension), None)
# New
if new_val:
next_rul... |
from weboob.tools.backend import BaseBackend
from weboob.capabilities.job import ICapJob, BaseJobAdvert
from .browser import CciBrowser
__all__ = ['CciBackend']
class CciBackend(BaseBackend, ICapJob):
NAME = 'cci'
DESCRIPTION = u'cci website'
MAINTAINER = u'Bezleputh'
EMAIL = '<EMAIL>'
LICENSE ... |
"""Contains a model definition for AlexNet.
This work was first described in:
ImageNet Classification with Deep Convolutional Neural Networks
Alex Krizhevsky, Ilya Sutskever and Geoffrey E. Hinton
and later refined in:
One weird trick for parallelizing convolutional neural networks
Alex Krizhevsky, 2014
Here... |
import numpy as np
from beyond.utils.constellation import WalkerStar, WalkerDelta
def test_walker_star():
# Iridium constellation
ws = WalkerStar(66, 6, 2)
ref_raan = [
0,
np.pi / 6,
np.pi * 2 / 6,
3 * np.pi / 6,
4 * np.pi / 6,
5 * np.pi / 6,
]
ra... |
#!/usr/bin/env python3
import os
import sys
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if ZULIP_PATH not in sys.path:
sys.path.append(ZULIP_PATH)
from scripts.lib.setup_venv import setup_virtualenv
from scripts.lib.zulip_tools import run, subprocess_text_output
OLD... |
import datetime
import iso8601
from oslo_utils import timeutils
import six
import six.moves.urllib.parse as urlparse
from webob import exc
from nova.api.openstack import extensions
from nova import exception
from nova.i18n import _
from nova import objects
authorize_show = extensions.extension_authorizer('compute',
... |
import functools
import os
import pkg_resources
import itertools
from pyprint.NullPrinter import NullPrinter
from coalib.bears.BEAR_KIND import BEAR_KIND
from coalib.collecting.Importers import iimport_objects
from coala_utils.decorators import yield_once
from coalib.output.printers.LOG_LEVEL import LOG_LEVEL
from co... |
"""Support for the GPSLogger device tracking."""
import logging
from homeassistant.components.device_tracker import (
DOMAIN as DEVICE_TRACKER_DOMAIN)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.typing import HomeAssistantType
from . import DOMAIN as GPSLOGGER_... |
#!/usr/bin/env python
'''
A script suitable for use as a git pre-commit hook to ensure your
files are flake8-compliant before committing them.
Use this by copying it to a file called $ARDUPILOT_ROOT/.git/hooks/pre-commit
AP_FLAKE8_CLEAN
'''
import os
import re
import sys
import subprocess
class PreCommitFlake8(o... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import zmq
import struct
import http.client
import urllib.parse
class ZMQTest (BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 4
port = 28332
def setup_nodes(s... |
import importlib
import os.path
import json
import pytest
import ftputil
from helpers.db import DbFixture
from helpers.application import Application
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__file... |
import json
import logging
import os
import subprocess
from ycmd import responses
from ycmd import utils
from ycmd.completers.completer import Completer
GO_FILETYPES = set( [ 'go' ] )
BINARY_NOT_FOUND_MESSAGE = ( 'Gocode binary not found. Did you build it? ' +
'You can do so by running ' ... |
#This function write node list to .inp file
#input information is the listname and filename of node list
def wirteNodeList(ListName, filePath):
Collumn_No = 16
newfilePath='%s'%filePath+'.inp'
newfile=open(newfilePath,'w')
for i in range(len(ListName)):
i = i+1
if i == len(ListName):
temp = '%6d'%ListName[i-... |
from django.db import models
from djangotoolbox import fields
import form_fields
class ListField(fields.ListField):
def formfield(self, **kwargs):
if isinstance(self.item_field, fields.EmbeddedModelField):
allowed_type_choices = (form_fields.BSON_TYPES_CHOICES['EmbeddedModel'],)
elif... |
source("../../shared/qtcreator.py")
def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
createProject_Qt_GUI(tempDir(), "DesignerTestApp")
selectFromLocator("mainwindow.ui")
dragAndDrop(waitForObject("{container=':qdesigner_internal::WidgetBox... |
from __future__ import division
import math
from .base import Layout
class Matrix(Layout):
"""
This layout divides the screen into a matrix of equally sized cells
and places one window in each cell. The number of columns is
configurable and can also be changed interactively.
"""
... |
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class CrmLeadForwardToPartner(models.TransientModel):
""" Forward info history to partners. """
_name = 'crm.lead.forward.to.partner'
@api.model
def _convert_to_assignation_line(self, lead, partner):
lead_location =... |
import os
import sys
import unittest
import doctest
import django
BASE_PATH = os.path.dirname(__file__) + 'jsonfield/'
def main():
"""
Standalone django model test with a 'memory-only-django-installation'.
You can play with a django model without a complete django app installation.
http://www.djangosn... |
from hy.models import replace_hy_obj, wrap_value
from hy.models.expression import HyExpression
from hy.models.string import HyString
from hy.errors import HyTypeError, HyMacroExpansionError
from collections import defaultdict
CORE_MACROS = [
"hy.core.bootstrap",
]
EXTRA_MACROS = [
"hy.core.macros",
]
_hy_m... |
"""Automatically download MLdata datasets."""
# Copyright (c) 2011 Pietro Berkes
# License: BSD 3 clause
import os
from os.path import join, exists
import re
import numbers
try:
# Python 2
from urllib2 import HTTPError
from urllib2 import quote
from urllib2 import urlopen
except ImportError:
# Pyt... |
#! /usr/bin/env python
from base_ai import BaseAI
import math
import numpy as np
class LazyAI(BaseAI):
def __init__(self):
super(LazyAI, self).__init__("lazy_ai")
#Les angles ou le robot peut aller (A gauche seulement dans cet AI)
self.priority_angles = [int(v.strip()) for v in self.get_... |
from sys import maxsize
class Contact:
def __init__(self, name=None, middle_name=None, last_name=None, nickname=None, title=None, company=None, address=None,
home_telephone=None, mobile_telephone=None, work_telephone=None, email=None, email2=None, email3=None, year=None, address2=None,
... |
from os import path
import sys
sys.path.insert(0, path.join(path.dirname(__file__), '../'))
import redis, redis_conn
import tfl_globals
import requests, time
from xml.dom import minidom
r = requests.get(tfl_globals.LINE_STATUS_URL)
if r.status_code != 200:
print "Could not refresh line status feed, got status code... |
"""Regression using the DNNRegressor Estimator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import imports85 # pylint: disable=g-bad-import-order
STEPS = 1000
PRICE_NORM_FACTOR = 1000
def my_dnn_regression_fn(features, la... |
from math import ceil
from django.db import IntegrityError, connection, models
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models import (
MR, A, Avatar, Base, Child, HiddenUser, HiddenUserProfile, M, M2MFrom,
... |
from datetime import datetime
import os
import re
import sys
from rogerthat.dal.profile import get_user_profile
from rogerthat.rpc import users
from rogerthat.translations import D, DEFAULT_LANGUAGE, localize, SUPPORTED_LANGUAGES
import mc_unittest
PATH_END_RELEASE = os.path.join('src-test', 'test_release_only', 'i18... |
import random
import itertools
import numpy as np
import tensorflow as tf
from read_data import DataSet
from tensorflow.contrib.rnn import BasicLSTMCell, LSTMStateTuple
from tensorflow.python.ops.rnn import dynamic_rnn
from mytensorflow import get_initializer
from rnn import get_last_relevant_rnn_output, get_sequenc... |
"""The tests for the microsoft face platform."""
import asyncio
from unittest.mock import patch
import homeassistant.components.microsoft_face as mf
from homeassistant.bootstrap import setup_component
from tests.common import (
get_test_home_assistant, assert_setup_component, mock_coro, load_fixture)
class Test... |
"""
When a location type is set from stock-tracking to not stock-tracking, find all
locations of that type and:
close the supply point case,
nullify the supply_point_id,
nullify the StockState sql_location field
When a location type is set from not stock tracking to stock tracking, find all
locations of th... |
from flask import Flask, render_template, redirect, session, request, url_for, flash
from game_map import game_engine
# CONFIGURATION
DEBUG = True
SECRET_KEY = '\xbd\x01\xe4\xcf\xa1\x0f\x8d\xcd'
app = Flask(__name__)
app.config.from_object(__name__)
class GameError(Exception):
pass
@app.route('/')
def home_pa... |
from data_collection.management.commands import BaseShpStationsShpDistrictsImporter
class Command(BaseShpStationsShpDistrictsImporter):
srid = 27700
council_id = 'E07000165'
districts_name = 'parl.2017-06-08/Version 1/POLLDISTOPEN'
stations_name = 'parl.2017-06-08/Version 1/POLLSTAOPEN.shp'
electio... |
"""Home of the `Sequential` model.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from tensorflow.python.keras import layers as layer_module
from tensorflow.python.keras.engine import base_layer
from tensorflow.python.keras.engine import in... |
# -*- coding: UTF-8 -*-
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, VpnConnection
DESCRIBE_VPNCONNECTIONS = b'''<?xml version="1.0" encoding="UTF-8"?>
<DescribeVpnConnectionsResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
<requestId>... |
from collections import Counter
from django.core.management.base import BaseCommand
from slides_manager.models import Case
import logging
logger = logging.getLogger('promort_commands')
class Command(BaseCommand):
help = 'get infos about registered laboratories'
def handle(self, *args, **opts):
log... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: purefa_user
version_added: '2.8'
short_description: Create, ... |
# encoding: utf-8
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
compat_urlparse,
)
from ..utils import (
ExtractorError,
int_or_none,
parse_duration,
unified_strdate,
)
cl... |
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.utils import InterfaceError
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_selected_pks = True
needs_datetime_string_cast = False
can_return_id_from_insert = True
has_real_datatype = True
has_native_uui... |
"""Toy models and input generation tools for testing trainer code."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import REDACTED.transformer_lingvo.lingvo.compat as tf
from REDACTED.transformer_lingvo.lingvo.core import base_input_generator
from REDACT... |
import os
import sys
from twisted.internet import defer
from buildbot import config as config_module
from buildbot import monkeypatches
from buildbot.master import BuildMaster
from buildbot.scripts import base
from buildbot.util import in_reactor
@defer.inlineCallbacks
def doCleanupDatabase(config, master_cfg):
... |
#!/usr/bin/env python3
#Use: 'binarySplitPsmcfa.py [filename]'
#This file takes a .psmcfa as an input file and then outputs to the command line a .psmcfa file, where every chromosome/contig is split into two separate contigs. Generally called by 'python binarySplitPsmcfaPrint.py originalPsmcFile.psmcfa > splitFile.ps... |
"""
Django settings for when tests are run.
"""
import os
DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'chatterbot.ext.django_chatterbot'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.