content stringlengths 4 20k |
|---|
import collections
import os
import threading
import warnings
import numpy
from chainer import _version
from chainer import backends # NOQA
from chainer import dataset # NOQA
from chainer import datasets # NOQA
from chainer import distributions # NOQA
from chainer import function_hooks # NOQA
from chainer import... |
# -*- coding: utf-8 -*-
# Feedback script
# Problem: Mission 4 : Question de bilan final
from lib.pythia import *
from lib.french import *
class Q1Feedback (BasicFeedbackSuite):
def __init__(self):
predefined = [("AKAYAK",), ("AVABCD",), ("A",), ("AA",), ("",), ("ABCDEF",)]
BasicFeedbackSuite... |
from . import _invariant
import numpy
def get_index(x, Nmesh, compressed=True, maxlength=None):
"""
Return the scale invariant index.
Parameters
----------
x : array_like (..., d)
integer index of points. It shall range from
- Nmesh // 2 to Nmesh // 2 - 1.
Nmesh : array_like
... |
import logging
import random
from autotest.client.shared import error
from autotest.client.shared import utils
from virttest import utils_test
from virttest import utils_net
from virttest import virt_vm
from virttest import utils_misc
@error.context_aware
def run(test, params, env):
"""
Test hotplug of NIC ... |
# coding: utf-8
""" Tests for the trac plugin """
from __future__ import unicode_literals, absolute_import
import did.cli
import did.base
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Constants
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONF... |
import pygame
from pygame.locals import *
import Vec2D
from Vec2D import *
import random
import math
# own files
from Semaphore import Semaphore
from config import *
from Util import *
import Screen
import Game
import Car
import Passenger
import Track
import Line
######################################################... |
#!/usr/bin/env python
import os.path
import subprocess
import pipes
import mar_collection
def single_file_generate_default_plugin(filename, basedir, plugin_name):
cmd = "sonic-annotator -d %s %s -w csv --csv-force --csv-basedir %s " % (
plugin_name, pipes.quote(filename), basedir)
subprocess.call(cmd... |
from django.contrib import admin
from django_markdown.admin import MarkdownModelAdmin
from modeltranslation.admin import TranslationAdmin
from projects.models import Project, Repository
class ProjectAdmin(MarkdownModelAdmin, TranslationAdmin):
"""
Admin interface class for project model
"""
list_dis... |
import os
import sys
import traceback
import logging
import cx_Freeze
from cx_Freeze import Freezer
from PyQt4 import QtCore, QtGui
class Metadata(object):
def __init__(self):
object.__init__(self)
class BuildThread(QtCore.QThread):
def run(self):
self.error = None
metadata = Metada... |
from qtconsole.qt import QtGui
from ipython_genutils.py3compat import PY3, string_types
from pygments.formatters.html import HtmlFormatter
from pygments.lexer import RegexLexer, _TokenType, Text, Error
from pygments.lexers import PythonLexer, Python3Lexer
from pygments.styles import get_style_by_name
def get_tokens_... |
import tkinter as tk
import generations
def left_press(event):
widget = event.widget
x = widget.canvasx(event.x)
y = widget.canvasy(event.y)
x = int(x // widget.scale);
y = int(y // widget.scale);
widget.automaton.buf[y][x] = 3;
widget.redraw()
pass
class CellWidget(tk.Canvas):
def... |
'''
Test cached responses and requests with bodies using CurlHeader tester
'''
# 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 f... |
import collections
import ctypes
import io
import pywintypes
import struct
import sys
import time
import win32api
import win32con
import win32file
import winerror
import winioctlcon
import wmi
from ctypes import wintypes
from functools import reduce
kernel32 = ctypes.WinDLL('kernel32') # , use_last_error=True)
kerne... |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify, tanh
from lasagne.objectives import crossentrop... |
from minigl import *
import math
import array, itertools
def use_pango_font(font, start, count, will_call_prepost=False):
import pango, cairo, pangocairo
fontDesc = pango.FontDescription(font)
a = array.array('b', itertools.repeat(0, 256*256))
surface = cairo.ImageSurface.create_for_data(a, cairo.FORMA... |
#!/usr/bin/env python
import re
from os import path
from setuptools import setup, find_packages
__folder__ = path.dirname(__file__)
with open(path.join(__folder__, 'README.md')) as ld_file:
long_description = ld_file.read()
ld_file.flush()
with open(path.join(__folder__, 'pymultitor.py')) as lib_file:
r... |
'''Arsenal nodes UI.'''
# Copyright 2015 CityGrid Media, LLC
#
# 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 ap... |
import os.path
import webbrowser
import re
import json
try:
from . import api, msg, utils, reactor, shared as G, event_emitter
from .handlers import account, credentials
from .. import editor
from ..common.exc_fmt import str_e
except (ImportError, ValueError):
from floo.common.exc_fmt import str_e
... |
import argparse
import json
import requests
import sys
import nexel
# TODO: where should these settings come from? (environment variable?)
SERVER = 'http://localhost'
PORT = '8888'
# TODO: ensure parsed <account_name> and <machine_name> are URL-safe
# TODO: "nexel check snapshot health"?
# TODO: "nexel get warnings... |
import httmock
from chatexchange import Browser
from tests.mock_responses import only_httmock, favorite_with_test_fkey, TEST_FKEY
def test_update_fkey():
"""
Tests that the correct chat fkey is retrived, using a mock response
with a copy of a real response from /chats/join/favorite
"""
with only... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from natto import MeCab
#from tagutil import str2tuple
from quepy import settings
from quepy.tagger import Word
from quepy.encodingpolicy import encoding_flexible_conversion as decode
class MecabTagger(object):
"""docstring, Meca... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .brightcove import BrightcoveIE
from .discovery import DiscoveryIE
class TlcIE(DiscoveryIE):
IE_NAME = 'tlc.com'
_VALID_URL = r'http://www\.tlc\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .generic import GenericIE
from ..utils import (
determine_ext,
ExtractorError,
qualities,
int_or_none,
parse_duration,
unified_strdate,
xpath_text,
update_url_query,
)
from ..compat... |
'''
negative test for adding image: iso format and raw image
@author: SyZhao
'''
import os
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_image as zsta... |
from tornado import websocket, web, ioloop
import json
import storm
cl = [] # this is for demo purposes, never ever use a global var in production!
count=0
class IndexHandler(web.RequestHandler):
''' index http normal handler'''
def get(self):
self.render("index.html")
class SocketHandler(websocket.W... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Autor',
fields=[
('id', models.AutoField(verbos... |
<<<<<<< HEAD
<<<<<<< HEAD
import unittest
from test import support
import io # C implementation.
import _pyio as pyio # Python implementation.
# Simple test to ensure that optimizations in the IO library deliver the
# expected results. For best testing, run this under a debug-build Python too
# (to exercise asserts ... |
# -*- coding: utf-8 -*-
"""Main Controller"""
from tg import expose, flash, require, url, request, redirect
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from hubreporter.lib.base import BaseController
from hubreporter.model import DBSession, metadata
from hubreporter.controllers.error import ErrorContro... |
"""
Django settings for bosm2015 project.
Generated by 'django-admin startproject' using Django 1.8.2.
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/
"""
# Build pat... |
"""Test configs for one_hot."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests
from tensorflow... |
#!/usr/bin/env python3
import traceback
from inspect import signature
from .token import Token, PseudoRuntimeError, PseudoTypeError, PseudoBreak, PseudoContinue, PseudoReturn
from .expr import Expression, VariableReference
from .context import Context
class Statement:
def __init__(self):
self.context = N... |
import urllib
import sickbeard
from sickbeard import logger, common
from sickbeard.notifiers.xbmc import XBMCNotifier
from sickbeard.exceptions import ex
from xml.dom import minidom
class PLEXNotifier(XBMCNotifier):
def notify_snatch(self, ep_name):
if sickbeard.PLEX_NOTIFY_ONSNATCH:
self._... |
from __future__ import division
from __future__ import print_function
from astropy.io import fits
from copy import deepcopy
from emirdrp.core import EMIR_NBARS
from emirdrp.core import EMIR_MINIMUM_SLITLET_WIDTH_MM
from emirdrp.core import EMIR_MAXIMUM_SLITLET_WIDTH_MM
class LongSlit(object):
"""Auxiliary class... |
from datetime import datetime
import geojson
from django.contrib.gis.geos import GEOSGeometry
_max_length = None
def _get_max_lengths(field_map):
from ..models import Submission
res = {}
for field in field_map:
res[field] = Submission._meta.get_field(field).max_length
return res
def parse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
rel_file = lambda *args: os.path.join(os.path.dirname(os.path.abspath... |
"""
Baxter RSDK Gripper Action Server
"""
import argparse
import rospy
from dynamic_reconfigure.server import Server
from baxter_interface.cfg import (
GripperActionServerConfig
)
from gripper_action.gripper_action import (
GripperActionServer,
)
def start_server(gripper):
print("Initializing node... "... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, json
import json, time, threading, argparse
proj_path = "/root/ops"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ops.settings")
sys.path.append(proj_path)
os.chdir(proj_path)
from django.core.wsgi import get_wsgi_application
application = get_wsgi_a... |
import re
from puncover import collector
class BacktraceHelper():
def __init__(self, collector):
self.collector = collector
derive_functions_symbols_pattern = re.compile(r"\b(\w+)\b")
def derive_function_symbols(self, text):
result = []
for f in self.derive_functions_symbols_patt... |
# Necessary imports. Provides library functions to ease writing tests.
from lib import prebuild, testcase, SUBMITTY_INSTALL_DIR
import subprocess
import os
import glob
import shutil
import traceback
############################################################################
# COPY THE ASSIGNMENT FROM THE SAMPLE ASSI... |
# -*- coding: utf-8 -*-
"""
mediatum - a multimedia content repository
Copyright (C) 2013 Arne Seifert <<EMAIL>>
Copyright (C) 2007 Matthias Kramm <<EMAIL>>
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... |
#! /usr/bin/python
from model import *
# Utils ----------------------------------------------------------------------
def create_random_mat(shape, listidx=None):
"""
This function create a random sparse index matrix with a given shape. It
is useful to create negative triplets.
:param shape: shape of... |
from pyasn1.type import constraint
from pyasn1.type import univ
from pyasn1_modules import rfc5280
MAX = float('inf')
# Extended Key Usage Values
id_kp_eapOverLAN = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.14')
id_kp_eapOverPPP = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.13')
# Wireless LAN SSID Extension
id_pe_wl... |
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from rest_framework import exceptions, HTTP_HEADER_ENCODING
from rest_framework.authentication import BaseAuthentication
from django.contrib.auth import authenticate
import base64
from Hindlebook.models import Node
def get... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from GitSearch.Indexer.NewJavaParser import parse
from GitSearch.MyUtils import remove_unified_stop_lists
import codecs
def Generator(code):
file_content = code
print '1. Origianl Query : ', file_content
ast = parse(file_content, resolve=False)
query = add... |
## -*- coding: utf-8 -*-
__author__ = 'Atsushi Shibata <<EMAIL>>'
__docformat__ = 'plaintext'
__licence__ = 'BSD'
import logging
from google.appengine.api import mail
def get_controller_class(cnt, plugin = ''):
"""
A function to obtain controller associated to given content object.
When the argument pl... |
"""
Third Party Auth REST API views
"""
from collections import namedtuple
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.db.models import Q
from django.http import Http404
from django.urls import reverse
from edx_rest_fram... |
import os
from dvc.git_wrapper import GitWrapperI, GitWrapper
from dvc.config import ConfigI, Config
from dvc.exceptions import DvcException
from dvc.path.factory import PathFactory
from dvc.cli import parse_args
from dvc.data_cloud import DataCloud
class SettingsError(DvcException):
def __init__(self, msg):
... |
from __future__ import absolute_import
from django.core.exceptions import ValidationError
import pytest
from pytest_pootle.factories import VirtualFolderDBFactory
from pootle_store.constants import OBSOLETE, TRANSLATED
from pootle_store.models import Unit
from virtualfolder.models import VirtualFolder, VirtualFolde... |
from alad_support import *
def write_sequential_results_to_csv(results, opts):
"""
:param results: SequentialResults
:param opts:
:return:
"""
prefix = opts.get_alad_metrics_name_prefix()
num_seen_file = os.path.join(opts.resultsdir, "%s-num_seen.csv" % (prefix,))
baseline_file = os.p... |
from gizela.util.Error import Error
from gizela.data.ObsBase import ObsBase
from gizela.data.CovMat import CovMat
from gizela.text.TextTable import TextTable
from gizela.data.obs_table import obs_none_table
class ObsClusterBaseError(Error): pass
class ObsClusterBase(object):
"""
Abstract base class for clus... |
import sys
import time
import logging
try:
import curses
except ImportError:
curses = None
class LogFormatter(logging.Formatter):
def __init__(self, console, *args, **kwargs):
#logging.Formatter.__init__(self, *args, **kwargs)
logging.Formatter.__init__(self, "%(asctime)s - %(name)s - %(levelname)s - %(me... |
# -*- coding: utf-8 -*-
"""The artifact knowledge base object.
The knowledge base is filled by user provided input and the pre-processing
phase. It is intended to provide successive phases, like the parsing and
analysis phases, with essential information like e.g. the timezone and
codepage of the source data.
"""
fro... |
import h5py
import theano
import theano.tensor as T
import os.path as osp
import numpy as np
from layers import split_state, MLP, BasicLSTM, Embedding, Attention
class Model(object):
"""
Region Attention model
"""
def __init__(self, name='ra', nimg=2048, na=512, nh=512, nw=512, nout=8843, npatch=30, ... |
"""Command line options for subtools that use the builder component."""
import os
from dex.tools import Context
from dex.utils import is_native_windows
def _find_build_scripts():
"""Finds build scripts in the 'scripts' subdirectory.
Returns:
{ script_name (str): directory (str) }
"""
try:
... |
import xlwt
import numpy as np
import pandas as pd
path = 'Target.txt'
text = open(path,'r')
clean = text.read().split('nike_ship1')
book = xlwt.Workbook()
sheet1 = book.add_sheet('rejected')
k = 0
for i in range(1, len(clean)):
item = clean[i].split('\n')
item_num = (len(clean[i].split('\n')))
... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from skimage import transform
from skimage.transform import estimate_transform
source = np.array([(129, 72),
(302, 76),
(90, 185),
(326, 193)])
target = np.array([[0, 0... |
from msrest.serialization import Model
class ReplicationUsage(Model):
"""Replication usages of a vault.
:param monitoring_summary: Summary of the replication monitoring data for
this vault.
:type monitoring_summary: :class:`MonitoringSummary
<azure.mgmt.recoveryservices.models.MonitoringSummary... |
#!/usr/bin/env python3
import numpy as np
import sys, os, os.path, time, gc, glob, random
from astropy.table import Table
from astropy.io import ascii
import photutils as ph
import astropy.io.fits as fits
import astropy.stats as stats
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
# Start timing... |
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.audio import CapAudio, BaseAudio, Album, Playlist, decode_id
from weboob.capabilities.collection import CapCollection, CollectionNotFound
from .browser import GroovesharkBrowser
from weboob.tools.value import ValueBackendPassword, Value
__... |
import os
import re
import optparse
import glob
import tarfile
import time
import datetime
import ConfigParser
import logging.handlers
from optparse import OptionParser
from sendemail import sendmail
import subprocess
#########################
# Read configuration data
#########################
confpath = os.path.dir... |
#!/usr/bin/env python
"""
Project Euler Problem 19
========================
You are given the following information, but you may prefer to do some
research for yourself.
• 1 Jan 1900 was a Monday.
• Thirty days has September,
April, June and November.
All the rest have thirty-one,
... |
""" Contains the base class for driver-enabled devices."""
# driver_enabled.py
# Mission Pinball Framework
# Written by Brian Madden & Gabe Knuth
# Released under the MIT License. (See license info at the end of this file.)
# Documentation and more info at http://missionpinball.com/mpf
from mpf.devices.driver import ... |
from __future__ import unicode_literals
from copy import deepcopy
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User as AuthUser
from django.contrib.redirects.admin import RedirectAdmin
from django... |
import json
import sys
import unittest
import httpretty
import requests
if '..' not in sys.path:
sys.path.insert(0, '..')
from sortinghat import api
from sortinghat.command import CMD_SUCCESS
from sortinghat.cmd.autogender import AutoGender, genderize
from tests.base import TestCommandCaseBase
GENDERIZE_API_U... |
import django.db.models.deletion
import stdimage.models
from django.conf import settings
from django.db import migrations, models
import course_discovery.apps.course_metadata.utils
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... |
# test importing of invalid .mpy files
import sys, uio
try:
uio.IOBase
import uos
uos.mount
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
class UserFile(uio.IOBase):
def __init__(self, data):
self.data = data
self.pos = 0
def read(self):
ret... |
from __future__ import absolute_import, print_function, unicode_literals
# Stdlib Imports
import abc
# First Party Imports
import sickbeard
class Indexer(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
self.name = 'Generic'
self.slug = 'generic'
sel... |
## \file
## \ingroup tutorial_roofit
## \notebook
## Addition and convolution: options for plotting components of composite p.d.f.s.
##
## \macro_code
##
## \date February 2018
## \author Clemens Lange, Wouter Verkerke (C++ version)
import ROOT
# Set up composite pdf
# --------------------------------------
# Declar... |
"""Added CA related tables
Revision ID: 2d21598e7e70
Revises: 3d36a26b88af
Create Date: 2015-03-11 15:47:32.292944
"""
# revision identifiers, used by Alembic.
revision = '2d21598e7e70'
down_revision = '3d36a26b88af'
from alembic import op
import sqlalchemy as sa
def upgrade():
ctx = op.get_context()
con ... |
import gtk
from base import Session
from umit.pm import backend
from umit.pm.core.i18n import _
from umit.pm.gui.widgets.expander import AnimatedExpander
from umit.pm.gui.pages.packetpage import PacketPage
from umit.pm.gui.pages.sequencepage import SequencePage
class SequenceSession(Session):
session_id = 0
... |
from django.core.urlresolvers import reverse
from django.test import TestCase
from survey.models import Survey, Questionnaire
from . import create_surveys, create_questionnaires, login
class SurveyTestCase(TestCase):
@classmethod
def setUpTestData(cls):
cls.client = login(user="survey-user", email="<... |
import os
import unittest
from sensor_parser.parser import FieldError, InputError, parser_sensor2dict
class TestParser(unittest.TestCase):
def setUp(self):
path = os.path.abspath(__file__)
path = os.path.dirname(path)
self.name_file = os.path.join(path, 'data/sensor_data.txt')
sel... |
import logging
import pymongo
import twisted
from mogo import connect
from twisted.application import internet
from twisted.application.service import IService
from twisted.internet import reactor, ssl
from twisted.python.log import PythonLoggingObserver
from ..common.db_common import Db, create_index
from .. import ... |
import codecs
import os
from os import walk
import json
from itertools import chain
from itertools import count
try:
from itertools import imap
except ImportError:
imap = map
from itertools import repeat
from itertools import starmap
from functools import partial
from operator import itemgetter
from iter_k... |
#!/usr/bin/env python2
from __future__ import absolute_import, print_function
import argparse
import os
import re
import sys
import yaml
from jinja2 import exceptions as jinja_exceptions
from jinja2 import Environment, FileSystemLoader, StrictUndefined
from .alerts import AlertClient
from .exceptions import (ItemAlr... |
import sys, os, pango, linuxcnc, hashlib
datadir = os.path.abspath(os.path.dirname(__file__))
KEYWORDS = ['','T', 'P', 'X', 'Y', 'Z', 'A', 'B', 'C', 'U', 'V', 'W', 'D', 'I', 'J', 'Q', ';']
try:
import gobject,gtk
except:
print('GTK not available')
sys.exit(1)
class ToolEdit(gtk.VBox):
__gtype_name__ = ... |
from __future__ import unicode_literals
import uuid
from datetime import datetime, timedelta
from enum import Enum
import couch
from dateutil import parser
from passlib.hash import pbkdf2_sha256
from tornado.gen import coroutine, Return
from tornado.options import options, define
from voluptuous import All, Extra, In... |
import json
import string
from oslo_config import cfg
from oslo_log import log as logging
import requests
from cinder import exception
from cinder.i18n import _
from cinder.volume import configuration
from cinder.volume.targets import nvmeof
from cinder.volume import volume_utils
spdk_opts = [
cfg.StrOpt('spdk_r... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint
from pyknyx.api import Device, FunctionalBlock
from pyknyx.core.ets import ETS
class DevFB(FunctionalBlock):
# Datapoints (= Group Objects) definition
DP_01 = dict(name="dp_1", dptId="1.001", default="Off", access="outp... |
#!/usr/bin/env python
"""Large sum
Problem 13
Published on 22 March 2002 at 06:00 pm [Server Time]
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309... |
from modules.OsmoseTranslation import T_
from .Analyser_Osmosis import Analyser_Osmosis
sql10 = """
SELECT
id,
ST_AsText(ST_Centroid(ST_LongestLine(bbox, bbox))),
type
FROM
(
SELECT
relations.id,
relations.tags->'type' AS type,
CASE
WHEN ST_Envelope(ST_Collect(li... |
"""
Unit tests for user messages.
"""
import ddt
from django.contrib.messages.middleware import MessageMiddleware
from django.test import RequestFactory, TestCase
from common.test.utils import normalize_repr
from openedx.core.djangolib.markup import HTML, Text
from common.djangoapps.student.tests.factories import Us... |
from eth_utils import (
int_to_big_endian,
big_endian_to_int,
)
from rlp.exceptions import DeserializationError, SerializationError
class BigEndianInt(object):
"""A sedes for big endian integers.
:param l: the size of the serialized representation in bytes or `None` to
use the shortest... |
from gnuradio import gr, gru, blks2
from gnuradio import eng_notation
import copy
import sys
# /////////////////////////////////////////////////////////////////////////////
# receive path
# /////////////////////////////////////////////////////////////////////////////
class receive_path(gr... |
"""Data Equivalence Tests"""
from __future__ import print_function
#
# License: BSD (3-clause)
import inspect
import os.path as op
import shutil
import warnings
from nose.tools import assert_equal, assert_raises, assert_true
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,... |
#!/usr/bin/env python
""" evdev.py
This is a Python interface to the Linux input system's event device.
Events can be read from an open event file and decoded into spiffy
python objects. The Event objects can optionally be fed into a Device
object that represents the complete state of the device being monitored.
Copy... |
class oxcSERVERvmnetwork:
def vm_remove_interface(self, vm_ref, vif_ref):
res = self.connection.VIF.unplug(self.session_uuid, vif_ref)
if "Value" in res:
self.track_tasks[res['Value']] = vm_ref
self.vif_plug.append(res['Value'])
res = self.connection.VIF.destroy(self... |
from base_poi import poiModule
import cairo
from datetime import *
import math
def getModule(*args, **kwargs):
return Placenames(*args, **kwargs)
class Placenames(poiModule):
"""Lookup nearest town or village"""
def __init__(self, *args, **kwargs):
poiModule.__init__(self, *args, **kwargs)
... |
import deepify.utils.configuration as configuration
import datetime as dt
import json
import re
class Wrapper():
"""
<Wrapper> class.
"""
def __init__(self):
"""
Constructor without parameters...
"""
# As would be defined in the browser.cfg
self.name = "W... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
# TODO: put package requirements here
]
test_requirements = [
# TOD... |
import json
from tempest.api_schema.response.compute.v2_1 import quotas as schema
from tempest.common import service_client
class QuotasClientJSON(service_client.ServiceClient):
def show_quota_set(self, tenant_id, user_id=None):
"""List the quota set for a tenant."""
url = 'os-quota-sets/%s' % ... |
#!/usr/bin/python
import common
import unittest
# This has to be done very early.
from autotest_lib.client.common_lib import global_config
global_config.global_config.override_config_value(
'HOSTS', 'default_protection',
'NO_PROTECTION')
from autotest_lib.client.common_lib import host_protections
from autote... |
from django.forms.utils import flatatt
from django.forms.widgets import DateTimeInput
from django.utils import translation
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
# From https://github.com/nkunihiko/django-bootstrap3-datetimepicker
# Options: http://eonasdan.githu... |
import re
import threading
from multiprocessing.dummy import Pool as ThreadPool
import urllib2
import time
class ProxyIPTester:
def __init__(self, timeout):
self.__store = r'verified.txt'
self.__read = r'ip.txt'
self.__original_ips = []
self.__verified_ips = []
self.__test_u... |
"""
Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option... |
import os
import json
from digoie.conf.storage import __elastic_search_dir__, __reverb_input_dir__, ES_RAW_EXT, REVERB_INPUT_EXT
def parse_name(raw):
print 'parse names from json...'
# input_filename = 'names' + ES_RAW_EXT
# input_path = os.path.join(__elastic_search_dir__, input_filename)
# output_fi... |
import RPi.GPIO as GPIO
import ConfigParser
class RaspGpio:
_gpiostate={4:"N/A",GPIO.IN:"IN",GPIO.OUT:"OUT"}
_comment={}
IN=GPIO.IN
OUT=GPIO.OUT
HIGH=GPIO.HIGH
LOW=GPIO.LOW
_init=False
def __init__(self, configfile):
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
self.loadconf(configfile)
def init... |
"""
Defines the user interface. Three APIs are exposed to user: get_value,
set_value, get_value_over_time
"""
from urllib.parse import urlencode
import asyncio
import aiohttp
class ConnectError(Exception):
"""A connection error exception"""
pass
class OobController(object):
"""The OobController class t... |
{
"name" : "Multi level procuration",
"version" : "1.0",
"author" : "Therp BV",
"website": "http://www.therp.nl",
"complexity": "normal",
"sequence": 990,
"description": """Multi level procuration offers multiple validation of
purchase order with varying limits and cost centers
""",
... |
"""Runs YCSB against Cloud Bigtable.
Cloud Bigtable (https://cloud.google.com/bigtable/) is a managed NoSQL database
with an HBase-compatible API.
Compared to hbase_ycsb, this benchmark:
* Modifies hbase-site.xml to work with Cloud Bigtable.
* Adds the Bigtable client JAR.
* Adds alpn-boot-7.0.0.v20140317.jar t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.