content stringlengths 4 20k |
|---|
from . import analytic_resource_plan_line
from . import purchase_request |
from ctypes import c_uint64
BGFX_STATE_RGB_WRITE = c_uint64(0x0000000000000001)
BGFX_STATE_ALPHA_WRITE = c_uint64(0x0000000000000002)
BGFX_STATE_DEPTH_WRITE = c_uint64(0x0000000000000004)
BGFX_STATE_DEPTH_TEST_LESS = c_uint64(0x0000000000000010)
BGFX_STATE_DEPTH_TEST_LEQUAL = c_uint64(0x0000000000000020)
BGFX_STATE_D... |
#!/usr/bin/env python
import sys;
sys.path.insert(0, "..")
import settings
import subprocess
import os
import argparse
parser = argparse.ArgumentParser(description='imalse-doc')
parser.add_argument('-b', '--build', default='html',
help="""
Please use \`make <target>' where <target> is one of
| html to ... |
import logging
import sys
import serial
import time
#Setup Debug Logging
#From https://inventwithpython.com/blog/2012/04/06/stop-using
# -print-for-debugging-a-5-minute-quickstart-guide-to-pythons-logging-module/
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(a... |
import numpy as np
import cv2
import logging
import urllib.request
import base64
from threading import Thread, Event
logger = logging.getLogger('universe')
class IPCamera:
def __init__(self, url):
self.stream = urllib.request.urlopen(url)
self.b = bytearray()
def read(self):
max = 10... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Zato
from zato.admin.web.forms.security.rbac.role_perm... |
"""Implements the graph generation for computation of gradients."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_grad # py... |
def graphWalker(node, getChildren, toEvaluate, backPack = None):
"""
A generator that (lazily, recursively) applies an operation to a directed graph structure.
@param node the graph node where we start
@param getChildren a callable f such that f(node) returns the child nodes of node
@param toEv... |
from abstract import Provider
from datetime import timedelta, datetime
import re
TIMEDELTA_REGEX = re.compile('vor ((?P<hours>\d+)h )?(?P<minutes>\d+)min')
class Schwarzkappler(Provider):
provider_name = 'schwarzkappler.info'
update_intervall = timedelta(minutes=1)
last_updated = None
url = 'http://sc... |
from .views import (
library_view,
image_view,
AddPhotoView,
EditPhotoView,
DeletePhotoView,
album_view,
AddAlbumView,
EditAlbumView,
DeleteAlbumView,
tag_view,
)
from django.conf.urls import url
urlpatterns = [
url('library/$', library_view, name='library'),
url(r'p... |
import typing
import pytest
import abjad
values: typing.List[typing.Tuple] = []
values.extend(
[
(-24, -12, "-P8"),
(-23, -11, "-M7"),
(-22, -10, "-m7"),
(-21, -9, "-M6"),
(-20, -8, "-m6"),
(-19, -7, "-P5"),
(-18, -6, "-d5"),
(-17, -5, "-P4"),
... |
{
'name': 'Dominican Republic - Accounting',
'version': '1.0',
'category': 'Localization/Account Charts',
'description': """
This is the base module to manage the accounting chart for Dominican Republic.
==============================================================================
* Chart of Accounts.... |
import pygameui as ui
from osci.StarMapWidget import StarMapWidget
from osci import gdata, res, client, sequip
from ige.ospace.Const import *
from ige.ospace import *
from ige import GameException
from ConfirmDlg import ConfirmDlg
class ConstrUpgradeDlg:
def __init__(self, app):
self.app = app
self.confirmDlg = ... |
from chaco.tools.api import DragTool
from enable.enable_traits import Pointer
from traits.api import Enum, CArray
# ============= standard library imports ========================
# ============= local library imports ==========================
normal_pointer = Pointer('normal')
hand_pointer = Pointer('hand')
class... |
import json
import os
import pstats
import shutil
import sys
import tempfile
import unittest
from io import StringIO
from subprocess import Popen, PIPE
from scrapy.utils.test import get_testenv
class CmdlineTest(unittest.TestCase):
def setUp(self):
self.env = get_testenv()
self.env['SCRAPY_SETTI... |
"""
EasyBuild support for installing VSC-tools Python packages, implemented as an easyblock
@author: Kenneth Hoste (UGent)
"""
import os
from easybuild.easyblocks.generic.versionindependendpythonpackage import VersionIndependendPythonPackage
# EasyBuild provides its own 'vsc' namespace, that shouldn't be mixed with... |
from __future__ import absolute_import
from .celery_broker import app
import time
import json
import traceback
# import next.logging_client.LoggerHTTP as ell
from next.database_client.DatabaseAPI import DatabaseAPI
db = DatabaseAPI()
from next.logging_client.LoggerAPI import LoggerAPI
ell = LoggerAPI()
import next.ut... |
from setuptools import setup
import os
from os import path
import shutil
if path.isfile('README.md'):
shutil.copyfile('README.md', 'README')
if path.isdir('sample'):
if path.exists('sample/site'):
shutil.rmtree('sample/site')
if path.exists('sample/config.nib'):
os.unlink('sample/config.nib')
s... |
import copy
import unittest
from nirikshak.common import exceptions
from nirikshak.common import plugins
from nirikshak.tests.unit import base
from nirikshak.workers import base as worker_base
class WorkBaseTest(unittest.TestCase):
def setUp(self):
super(WorkBaseTest, self).setUp()
self.sample_j... |
"""
Django settings for shop project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bu... |
"""A light weight utilities to train TF2 models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import REDACTED
from __future__ import print_function
import time
import REDACTED
from absl import logging
import tensorflow as tf
from typing import Callable, Dict, Optional, T... |
# -*- coding: utf-8 -*-
from odoo.tests import TransactionCase
from odoo.modules import get_module_resource
class TestImportPain002(TransactionCase):
def import_file_pain002(self):
test_file_path = get_module_resource('l10n_ch_import_pain002',
'test_files',
... |
# -*- coding: utf-8 -*-
"""
(c) 2017 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <<EMAIL>>
"""
from __future__ import unicode_literals, absolute_import
import os # noqa: E402
import flask # noqa: E402
def reload_config():
""" Reload the configuration. """
config = flask.config.Config(
... |
# -*- coding: utf-8 -*-
#: settings for liquidluck
#: site information
#: all variables can be accessed in template with ``site`` namespace.
#: for instance: {{site.name}}
site = {
"name": "Yufei's translation", # your site name
"url": "http://trans.thxminds.com", # your site url
# "prefix": "blog",
}
#... |
#!/usr/bin/python3
# TODO: configuration file for binaries
# TODO: passwd, groups, libnsl, libnss etc for user mapping
# TODO: maybe more devices like /dev/tty
import sys
import os
import re
import argparse
from pwd import getpwnam
from subprocess import call, check_output, CalledProcessError
VERSION = '%(prog)s v... |
#!/bin/env python3
# https://stackoverflow.com/a/32427177/1386750
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Define constants:
r2d = 180 / np.pi
d2r = np.pi / 180
# Choose projection:
vpAlt = 15.0 * d2r
vpAz = -20.0 * d2r
#vpAlt = 90.0 * d2r
#vpAz = 0.0 * d2r
... |
from sandbox.api.v1 import utils as api_utils
rest = api_utils.Rest('v1_0', __name__)
# TODO(sbauza): Create _api interface
# Leases operations
@rest.get('/shopping')
def shopping_list():
return api_utils.render(_api.get_shopping_list())
@rest.post('/shopping')
def shopping_create(data):
return api_utils... |
# -*- coding:utf-8 -*-
import sys
import unittest
from PyQt4.QtGui import QApplication
from PyQt4.QtTest import QTest
from PyQt4.QtCore import Qt
from main import MainWindow
app = QApplication(sys.argv)
class MainWindowTest(unittest.TestCase):
def setUp(self):
self.form = MainWindow()
def test_sc... |
"""
Views for the Projects App
"""
import datetime
import subprocess
import sys
from django.http import StreamingHttpResponse, HttpResponseRedirect
from django.db.models.aggregates import Count
from django.contrib import messages
from django.views.generic import CreateView, UpdateView, DetailView, View, DeleteView, R... |
# Django settings for productgallery project.
PROJECT_FOLDER = 'INSERT_PROJECT_FOLDER'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or... |
import datetime
import sys
import six
import testtools
from neutronclient.common import exceptions
from neutronclient.common import utils
class TestUtils(testtools.TestCase):
def test_string_to_bool_true(self):
self.assertTrue(utils.str2bool('true'))
def test_string_to_bool_false(self):
sel... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import it... |
"""Unit tests for the WebAlert engine."""
__revision__ = \
"$Id$"
from invenio.config import CFG_SITE_URL
from invenio.importutils import lazy_import
from invenio.testutils import make_test_suite, run_test_suite, InvenioTestCase
RecordHTMLParser = lazy_import('invenio.htmlparser:RecordHTMLParser')
class TestW... |
import argparse
import requests
from lxml import html
class Book(object):
def __init__(self, title, subtitle, price):
self.title = title
self.subtitle = subtitle
self.price = price
def __repr__(self):
return self.title + " : " + self.subtitle + " : Rs." + self.price
def __... |
'''
Netns management overview
=========================
Pyroute2 provides basic namespaces management support.
Here's a quick overview of typical netns tasks and
related pyroute2 tools.
Move an interface to a namespace
--------------------------------
Though this task is managed not via `netns` module, it
should be ... |
# -*- coding: utf-8 -*-
{
'name': "Bestja: UCW",
'summary': "Installation configuration for UCW",
'description': "Installation configuration for Uniwersyteckie Centrum Wolontariatu",
'author': "Laboratorium EE",
'website': "http://www.laboratorium.ee",
'version': '0.1',
'category': 'Specific... |
# -*- coding: utf-8
"""Module to read and write serialized+compressed anvio objects"""
import gzip
import cPickle
from anvio.errors import DictIOError
__author__ = "A. Murat Eren"
__copyright__ = "Copyright 2015, The anvio Project"
__credits__ = []
__license__ = "GPL 3.0"
__maintainer__ = "A. Murat Eren"
__email__ ... |
'''
Created on 16 Jul 2012
@author: Qasim
Run a single village.
'''
import sys
import os.path
import logging
import atd_bot
import dna
_BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
V_LOC = os.path.join(_BASE_PATH, "atd_data", "village.txt")
PLANET_LOC = os.path.join(_BASE_PATH, "atd_dat... |
import polyaxon_sdk
from marshmallow import fields, validate
from polyaxon.polyflow.optimization import V1Optimization
from polyaxon.schemas.base import BaseCamelSchema, BaseConfig, BaseOneOfSchema
from polyaxon.schemas.fields.ref_or_obj import RefOrObject
class MedianStoppingPolicySchema(BaseCamelSchema):
kind... |
import os
import sqlite3
import cPickle
from graphserver.core import State, Graph, Combination
from graphserver import core
from sys import argv
import sys
class GraphDatabase:
def __init__(self, sqlite_filename, overwrite=False):
if overwrite:
if os.path.exists(sqlite_filename):
... |
#!/usr/bin/python
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from apricot import skipForTicket
from avocado.core.exceptions import TestFail
from pool_test_base import PoolTestBase
class DmgSystemReformatTest(PoolTestBase):
# pylint: disable=too-many-ancest... |
"""Total variation denoising using PDHG.
Solves the optimization problem
min_{x >= 0} 1/2 ||x - g||_2^2 + lam || |grad(x)| ||_1
Where ``grad`` the spatial gradient and ``g`` is given noisy data.
For further details and a description of the solution method used, see
https://odlgroup.github.io/odl/guide/pdhg_gui... |
from __future__ import absolute_import
import os
import numpy
import pytest
from pytest import approx
from . import tmpfiles
import segyio
import segyio._segyio as _segyio
def test_binary_header_size():
assert 400 == _segyio.binsize()
def test_textheader_size():
assert 3200 == _segyio.textsize()
def t... |
from __future__ import unicode_literals
from django.test import TestCase
from mock import patch, call
from mongoengine import ConnectionError
from audit_tools.audit.db import mongodb_connect
@patch('audit_tools.audit.db.mongoengine')
class DBTestCase(TestCase):
def setUp(self):
pass
def test_mongod... |
## @file Filing0
# @brief Processing CSV files.
# @author weaves
#
# @details
# This class uses no special API.
#
# @note
#
# @see
#
from __future__ import print_function
import logging
import random
import numpy as np
import pandas as pd
from pandas import *
class Filing0(object):
"""Given a file handle, appl... |
#!/usr/bin/python
#########################################################################################################################
#This script was written by Nathan Whelan.
# THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF... |
#!/usr/bin/env python3
# Call addr2line as needed to resolve addresses in a stack trace. The addresses
# will be replaced if they can be resolved into file and line numbers. The
# executable must include debugging information to get file and line numbers.
#
# Two ways to call:
# 1) Execute binary as a subprocess: st... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MediaType'
db.create_table('medialibrary_mediatype', (
('id', self.gf('django.db... |
#!/usr/bin/python2
import cv
import time
import numpy as np
import logging
import random241arg as arg
import random241sensor as sensor
import random241osc as osc
showStream = False
stop_key = 0
capture = True
camNumber = 1
time_delta = 60 * 60 / 2
logging.basicConfig(filename='random241.log',
form... |
import __builtin__
import os
from compiler import ast
from compiler import parse
from pyflakes import messages
class Binding(object):
"""
@ivar used: pair of (L{Scope}, line-number) indicating the scope and
line number that this binding was last used
"""
def __init__(self, name, sourc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A simple ThreadPool library.
"""
from Queue import Queue
from threading import Event, Thread
class ThreadPool(object):
def __init__(self, max_thread=10):
self.max_thread = max_thread
self.task_queue = Queue()
self.threads = []
fo... |
from django.utils import unittest
import settings
import os
import shutil
import time
import urllib
from urlopen import throttle
from urlopen import cache
from urlopen import cache_and_throttle
from models import Cache
from models import Throttle
from models import Access
class WebCacheTestCase(unittest.TestCase):
... |
import itertools
import stat
from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH
from portage.tests import TestCase
from portage import os
from portage import _encodings
from portage import _unicode_decode, _unicode_encode
import py_compile
class CompileModulesTestCase(TestCase):
def testCompileModules(se... |
#!/usr/bin/env python
from PyQt4 import QtCore, QtGui
from ui_mainform import Ui_MainWindow
from utils import Utils
from cache import ScaleCache
from mapper import Mapper
import rtmidi_python as rtmidi
class MainForm(QtGui.QMainWindow):
NOTE_OFF = 0x80
NOTE_ON = 0x90
def __init__(self, parent=None... |
from pyramid.view import view_config
from dace.objectofcollaboration.principal.util import has_role
from dace.processinstance.core import (
ValidationError, Validator)
from pontus.view import BasicView
from novaideo import _
class DocAnonymousValidator(Validator):
@classmethod
def validate(cls, context... |
from hashlib import md5
from django.contrib.auth.models import User
from rest_framework import serializers
from .models import Post, Tag
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tag
fields = ('id', 'name', 'colour', 'posts')
class TagForTopicSerializer(serializers.... |
"""
This module contains signals / handlers related to programs.
"""
import logging
from django.dispatch import receiver
from openedx.core.djangoapps.credentials.helpers import is_learner_records_enabled_for_org
from openedx.core.djangoapps.signals.signals import (
COURSE_CERT_AWARDED,
COURSE_CERT_CHANGED,
... |
#!/usr/bin/env python
import os.path
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
def read(filename):
return open(os.path.join(os.path.dirname(__file_... |
#!/usr/bin/python
'''
Simulator of hardware bitcoin wallet.
This is not the most elegant Python code I've ever wrote.
It's purpose is to demonstrate features of hardware wallet
implemented on microcontroller with very limited resources.
I tried to avoid any dynamic language features, so rewriting
... |
"""
Create a table of distributions of sequence lengths from one or more fasta files
"""
import os
import sys
import argparse
from roblib import stream_fasta
__author__ = 'Rob Edwards'
def count_len(fastaf, verbose=False):
"""
Count the sequence lengths and return a dict of len:count
:param fastaf: fast... |
#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.
Note:
CpG Islands are determined by ObEx = (Observed CpG) / (Expected CpG) ,
def... |
"""
Support for MySensors binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.mysensors/
"""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DOMAIN, BinarySe... |
from collections.deque import deque
from uasyncio.core import sleep
class QueueEmpty(Exception):
"""Exception raised by get_nowait()."""
class QueueFull(Exception):
"""Exception raised by put_nowait()."""
class Queue:
"""A queue, useful for coordinating producer and consumer coroutines.
If maxsiz... |
from funcy import ContextDecorator
from django.db.models import Manager
from django.db.models.query import QuerySet
# query
def cached_as(*samples, **kwargs):
return lambda func: func
cached_view_as = cached_as
def install_cacheops():
if not hasattr(Manager, 'get_queryset'):
Manager.get_queryset = la... |
#!/usr/bin/env python3
import os;
import re;
import Data;
import Filefunc;
import Service;
# Groups all the different service data files together into one big one
# And use them to automatically produce the trains
services = {};
attrs = {}; # the attributes of those services
# the list of files we got data from
sou... |
#!/usr/bin/python
"""**************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of the examples of the Qt Toolkit.
**
** You may use this file ... |
from Utility import logger
class Executor:
def __init__(self):
self.NLUQueue = None
def initialize(self,instructID):
director,env,start,dest,txt,set = instructID.split('_')
if self.NLUQueue:
self.NLUQueue.put(('Director',director))
self.NLUQueue.put(('Start ... |
import github.GithubObject
class Clones(github.GithubObject.NonCompletableGithubObject):
"""
This class represents a popular Path for a GitHub repository.
The reference can be found here https://developer.github.com/v3/repos/traffic/
"""
def __repr__(self):
return self.get__repr__({
... |
import socket
HTTP_PORT = 80
BUFFER_SIZE = 262144
LOOPBACK_ADDR = '127.0.0.1'
MAX_NUM_CONNECTIONS = 1
def messageInHTML(aMessageTitle, aMessage):
""" format aMesssageTitle and aMessage in html format
"""
return """<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import json
import logging
import math
import pprint
import sys
import time
from gevent.pool import Pool
from lymph.client import Client
from lymph.exceptions import Timeout
from lymph.cli.base import Command, handle_request_errors
from lymph.core import t... |
from __future__ import absolute_import
import base64
import codecs
import unittest
import bokeh.util.session_id
from bokeh.util.string import decode_utf8
from bokeh.util.session_id import ( generate_session_id,
generate_secret_key,
check_session_... |
"""
GCMS
(c) 2017 Alpeware LLC
"""
import config
import httplib2
import logging
import re
import string
import webapp2
from urllib import urlencode
from google.appengine.api import taskqueue
from google.appengine.api import memcache
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
NAME_RE = r... |
from tempest.api.compute.keypairs import test_keypairs
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
class KeyPairsV22TestJSON(test_keypairs.KeyPairsV2TestJSON):
min_microversion = '2.2'
max_microversion = 'latest'
def _check_keypair_type(self, keypair, keypair_type):... |
from quantum.db import db_base_plugin_v2
from quantum.db import l3_db
class Fake1(db_base_plugin_v2.QuantumDbPluginV2,
l3_db.L3_NAT_db_mixin):
supported_extension_aliases = ['router']
def fake_func(self):
return 'fake1'
def create_network(self, context, network):
session = co... |
#!python2
import json
import sys
import numpy as np
from kmodes import kmodes
syms = np.genfromtxt(sys.argv[1], dtype=str, delimiter=',')[:, 0]
X = np.genfromtxt(sys.argv[1], dtype=object, delimiter=',')[:, 3:]
X[:, 0] = X[:, 0].astype(float)
kmode = kmodes.KModes(n_clusters=int(sys.argv[2]), init='Huang', n_init=10... |
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import sys
from multiprocessing import Process
ERR_SLEEP = 15
MAX_NONCE = 1000000L
settings = {}
pp = pprint.PrettyPrinter(indent=4)
class BitcoinRPC:
OBJID = 1
def __init__(self, host, port, username, passwo... |
"""
Logging middleware for the Swift proxy.
This serves as both the default logging implementation and an example of how
to plug in your own logging format/method.
The logging format implemented below is as follows:
client_ip remote_addr datetime request_method request_path protocol
status_int referer user_agent... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A helper script to convert compat 1.0 scripts to the new core 2.0 framework.
NOTE: Please be aware that this script is not able to convert your codes
completely. It may support you with some automatic replacements and it gives
some warnings and hints for converting. Pleas... |
"""Default url shortener backend for Objectapp"""
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from objectapp.settings import PROTOCOL
def backend(gbobject):
"""Default url shortener backend for Objectapp"""
return '%s://%s%s' % (PROTOCOL, Site.objects.get_current... |
step = dict(S = (1, 0), N = (-1, 0), E = (0, 1), W = (0, -1))
def get_start(maze):
for i, row in enumerate(maze):
for j, cell in enumerate(row):
if maze[i][j] == '0':
return (i, j)
def is_finish(x, y, maze):
return maze[x][y] == '1'
def is_wall(x, y, maze):
return maze... |
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render_to_response, redirect, render
from django.template import RequestContext
from lighthouse.codeGen.templates import BTOGenerator
def index(request):
userSc = ''
scrOut = ''
try:
... |
"""
@file test_adc_ads7955.py
"""
##
# @addtogroup soletta sensor
# @brief This is sensor test based on soletta app
# @brief test adc sensor ads7955 on Galileo
##
import os
import time
from oeqa.utils.helper import shell_cmd
from oeqa.oetest import oeRuntimeTest
from oeqa.runtime.sensor.EnvirSetup import EnvirSetup
fr... |
from simplex import Literal, Expression, Variable, LinearProgram, Array
from unittest import TestCase
from fractions import Fraction as F
def getLP():
lp = LinearProgram()
lp.variables = {'x_1': Variable('x_1'), 'x_2': Variable('x_2')}
lp.bounds = [
Expression(-3, -1, [Literal(1, 'x_1')]),
... |
import bpy, bmesh
import logging
from array import array
class dsf_geom_define (object):
"""utility class for inserting mesh data into blender.
"""
log = logging.getLogger ('dsf_geom_define')
@classmethod
def create_vertex_groups (self, geom):
"""convert the face-groups to a map of vertex-groups.
""... |
PROJECT_ID = "GOOGLE_CLOUD_PROJECT"
PUBSUB_TOPIC = "TOPIC"
# Default Values
MAX_CONTENT_MB = 5 * 1000000
PUBSUB_TIMEOUT_MS = 10 * 60 * 1000
# Exception Messages
UNSUPPORTED_METHOD = "HTTP ERROR: {method} Request Unsupported"
NO_DATA_MESSAGE = "HTTP ERROR: POST Request Missing Data"
MESSAGE_TOO_BIG = "HTTP ERROR: Requ... |
#!/usr/bin/env python3
"""
Implement message filtering based on a routing table from MetPX-Sundew.
Make it easier to feed clients exactly the same products with sarracenia,
that they are used to with sundew.
the pxrouting option must be set in the configuration before the on_message
plugin is configured, ... |
""" myhdl's distutils distribution and installation script. """
import sys
requiredVersion = (2, 6)
requiredVersionStr = ".".join([str(i) for i in requiredVersion])
versionError = "ERROR: myhdl requires Python %s or higher" % requiredVersionStr
# use version_info to check version
# this was new in 2.0, so first see... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time-stamp: <2014-01-31 11:11:39 karl.voit>
from memacs.filenametimestamps import FileNameTimeStamps
PROG_VERSION_NUMBER = u"0.3"
PROG_VERSION_DATE = u"2013-12-15"
PROG_SHORT_DESCRIPTION = u"Memacs for file name time stamp"
PROG_TAG = u"filedatestamps"
PROG_DESCRIPTION ... |
"""
Tests for enrollment refund capabilities.
"""
import logging
import unittest
from datetime import datetime, timedelta
import ddt
import httpretty
import pytz
# Explicitly import the cache from ConfigurationModel so we can reset it after each test
from config_models.models import cache
from django.conf import s... |
from msrest.serialization import Model
class VirtualMachineScaleSetNetworkProfile(Model):
"""Describes a virtual machine scale set network profile.
:param network_interface_configurations: The list of network
configurations.
:type network_interface_configurations:
list[~azure.mgmt.compute.v2016... |
from PIL import Image
from PIL import ImageDraw
import math, random, sys, codecs
from database import GamesDatabase
from imglib import createImages
from imglib import compareImages
from imglib import drawSpiral
from sklearn.decomposition import PCA
from shapely.geometry import Point
import pandas as pd
import ... |
from __future__ import unicode_literals
import logging
from optparse import OptionParser
import os
import subprocess
import sys
import pkg_resources
logger = logging.getLogger(__name__)
def post_install(argv=None):
if argv:
sys.argv = argv
parser = OptionParser(
usage='Usage: %prog [option... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import aspen
from psycopg2 import IntegrityError
from gratipay.billing.payday import Payday
class PaydayRunner(object):
"""The Gratipay application can start a weekly payday process.
"""
def __ini... |
import pygame
import time
pygame.init()
width, height = 800, 600
backgroundColor = 0, 0, 0
screen = pygame.display.set_mode((width, height))
screen.fill(backgroundColor)
e = 0.99 # air resistance coefficient
g = -9.81 # gravity coefficient
class Ball:
def __init__(self, x, y, vx, vy):
self.x = x
... |
import gtk
from char import Char
import webbrowser
import tryton.common as common
class URL(Char):
"url"
def __init__(self, field_name, model_name, attrs=None):
super(URL, self).__init__(field_name, model_name, attrs=attrs)
self.tooltips = common.Tooltips()
self.button = gtk.Button()... |
# -*- coding: utf-8 -*-
u"""
Copyright 2013-2014 Olivier Cortès <<EMAIL>>.
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or... |
#!/usr/bin/env python
"""derpbox_agent.py: module containing DerpBoxAgent and other related classes"""
import argparse
import json
import threading
from time import sleep, time as get_time
import requests
from watchdog.observers import Observer
from derpbox_synchronizer import DerpboxSynchronizer
from eventhandlers i... |
"""Tests for templates module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gast
from tensorflow.python.autograph.pyct import anno
from tensorflow.python.autograph.pyct import origin_info
from tensorflow.python.autograph.pyct import parser
fro... |
#!/usr/bin/python
import os
import sys
import fcntl
import termios
import threading
fd = sys.stdin.fileno()
oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO
termios.tcsetattr(fd, termios.TCSANOW, newattr)
oldflags = fcntl.fcntl(fd, fcntl.F_G... |
# Proximal
import sys
sys.path.append('../../')
from proximal.utils.utils import *
from proximal.halide.halide import *
from proximal.lin_ops import *
import numpy as np
from scipy import signal
from scipy import ndimage
import matplotlib.pyplot as plt
from PIL import Image
from scipy.misc import lena
##############... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.