content stringlengths 4 20k |
|---|
from __future__ import division
from builtins import object
import pytest
try:
import cupy as cp
try:
cp.cuda.Device(0).compute_capability
except cp.cuda.runtime.CUDARuntimeError:
pytest.skip("GPU device inaccessible", allow_module_level=True)
except ImportError:
pytest.skip("cupy not i... |
"""Hosts an interface for the BIG-IP Monitor Resource.
This module references and holds items relevant to the orchestration of the F5
BIG-IP for purposes of abstracting the F5-SDK library.
"""
#
# Copyright (c) 2017,2018, F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may n... |
__author__ = 'Matteo'
__doc__ = '''Get data off SMBL and get data from KEGG.'''
N = "\n"
T = "\t"
# N="<br/>"
from urllib.request import urlopen
from urllib.error import HTTPError
import re
import pickle
import csv
from collections import OrderedDict
from itertools import chain
def keggmaster(rxn,main=True):
try:... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
edgebundlingProviderPlugin.py
---------------------
Date : January 2018
Copyright : (C) 2018 by Anita Graser
Email : <EMAIL>
****************************... |
from __future__ import division
PKG = 'px4'
import rospy
from geometry_msgs.msg import Quaternion, Vector3
from mavros_msgs.msg import AttitudeTarget
from mavros_test_common import MavrosTestCommon
from pymavlink import mavutil
from six.moves import xrange
from std_msgs.msg import Header
from threading import Thread
... |
import unittest
import pytest
from airflow.utils.module_loading import import_string
class TestModuleImport(unittest.TestCase):
def test_import_string(self):
cls = import_string('airflow.utils.module_loading.import_string')
assert cls == import_string
# Test exceptions raised
wi... |
# coding=utf-8
import unittest
"""980. Unique Paths III
https://leetcode.com/problems/unique-paths-iii/description/
On a 2-dimensional `grid`, there are 4 types of squares:
* `1` represents the starting square. There is exactly one starting square.
* `2` represents the ending square. There is exactly one endin... |
import time
import datetime
import lib.twitterService as twitterService
import lib.dbService as db
import lib.alertsClass as alerts
global cKey
cKey = ''
global cSecret
cSecret = ''
global atKey
atKey = ''
global atSecret
atSecret = ''
global szName
szName = ''
def is_protected(user):
# Check whether a user'... |
"""
Utilities for grades related tests
"""
from contextlib import contextmanager
from datetime import datetime
from mock import patch
from courseware.model_data import FieldDataCache
from courseware.module_render import get_module
from xmodule.graders import ProblemScore
@contextmanager
def mock_passing_grade(grade... |
# -*- coding: utf8 -*-
"""Converts Redis users, posts and comments to MongoDB documents.
This is only needed if moving from Pjuu <0.6 to >=0.6.
.. note: Before running this script ensure you have an up to date Redis backup
this may corrupt your data.
:license: AGPL v3, see LICENSE for more details
:copyrig... |
"""CAP Cli."""
from __future__ import absolute_import, print_function
import json
import uuid
import click
from flask_cli import with_appcontext
from invenio_db import db
from invenio_pidstore.errors import PIDDoesNotExistError
from invenio_pidstore.models import PersistentIdentifier
from cap.modules.deposit.api im... |
"""empty message
Revision ID: 262b2bc3b66
Revises: 251fe790aa83
Create Date: 2015-03-05 16:34:18.598057
"""
# revision identifiers, used by Alembic.
revision = '262b2bc3b66'
down_revision = '251fe790aa83'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... |
import math
#Single Block
list = [[0,0]]
sum_x = 0
sum_y = 0
for i in list:
sum_x += i[0]
sum_y += i[1]
sum_x /= len(list)
sum_y /= len(list)
print "SingleBlock: Grav. (", sum_x, ", ", sum_y, ")"
d_sum_x = 0
d_sum_y = 0
for i in list:
d_sum_x += (i[0]-sum_x)*(i[0]-sum_x)
d_sum_y += (i[1]-sum_y)*(i[1]-s... |
import logging
import os
import sys
from aemu_target import AemuTarget
from device_target import DeviceTarget
from qemu_target import QemuTarget
from common import GetHostArchFromPlatform
def AddCommonArgs(arg_parser):
"""Adds command line arguments to |arg_parser| for options which are shared
across test and ex... |
import logging
import traceback
import sys
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import cpc.util
import apperror
import function
import run
import network_function
log=logging.getLogger(__name__)
class AtomicFunctionError(apperror.ApplicationError):
pass
... |
"""
sentry.options.defaults
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from sentry.logging import LoggingFormat
from sentry.options import (
FLAG_IMMUTAB... |
"""
simple-cps run.py
"""
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.node import Controller, RemoteController
from minicps.mcps import MiniCPS
from topo import SimpleTopo
import sys
import time
import subprocess
from utils import IP
from mininet.link import Intf
class SimpleCPS(Mi... |
import os
from fabric import api as fabric_api
from cloudify.workflows import local
from cloudify_cli import constants as cli_constants
from cosmo_tester.framework.util import create_rest_client
from cosmo_tester.test_suites.test_blueprints.hello_world_bash_test \
import AbstractHelloWorldTest
from cosmo_tester.... |
from zope import schema
from zope.component import getMultiAdapter
from zope.formlib import form
from zope.interface import implements
from plone.app.portlets.portlets import base
from plone.memoize import ram
from plone.memoize.compress import xhtml_compress
from plone.memoize.instance import memoize
from pl... |
r'''
Copyright 2014 Google Inc. All rights reserved.
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 applicable law or agreed to i... |
from __future__ import print_function
import argparse
import sys
from monolithe.specifications.directory_manager import FolderManager, RepositoryManager
from monolithe.generators import SDKGenerator
def main(argv=sys.argv):
"""
"""
parser = argparse.ArgumentParser(description="Generates a SDK according ... |
from __future__ import absolute_import, division, print_function, unicode_literals
from django.core.checks import Warning
from django.test import SimpleTestCase
from django.test.utils import override_settings
from gargoyle.checks import check_switch_defaults
from gargoyle.constants import GLOBAL
class CheckSwitchDe... |
""" Steps for setting up a test database with imports and updates.
There are two ways to state geometries for test data: with coordinates
and via scenes.
Coordinates should be given as a wkt without the enclosing type name.
Scenes are prepared geometries which can be found in the scenes/data/
dir... |
"""
Display Activation Contours
===========================
Load a statistical overlay as a "topographic" contour map.
"""
print __doc__
import os.path as op
from surfer import Brain
"""
Bring up the visualization.
Contour maps looks best with the "low_contrast" cortex
colorscheme, so we will pass that as an optio... |
import logging
from .bibdatabase import BibDatabase
logger = logging.getLogger(__name__)
__all__ = ['BibTexWriter']
def to_bibtex(parsed):
"""
Convenience function for backwards compatibility.
"""
return BibTexWriter().write(parsed)
class BibTexWriter(object):
"""
Writer to convert a :clas... |
from gcp_common import BaseTest
from c7n_gcp.filters.metrics import GCPMetricsFilter
class TestGCPMetricsFilter(BaseTest):
def test_metrics(self):
session_factory = self.replay_flight_data("filter-metrics")
p = self.load_policy(
{
"name": "test-metrics",
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
# GET THE ROOT DIRECTORY ######################################################
parser = argparse.ArgumentParser(description='An os.walk() snippet.')
parser.add_argument("root_dir_args", nargs=1, metavar="DIRECTORY", help="The directory to exp... |
import hashlib
from modules.cmds.cmdmodule import CmdModule
# Module to manage adding and removing users. ###
class CmdModuleUsermanage(CmdModule):
def __init__(self, log, irc):
super().__init__(log, irc)
self.ranklist = ""
for x in self.irc.perms.levels:
self.ranklist = x +... |
from __future__ import unicode_literals
__author__ = "mozman <<EMAIL>>"
from itertools import islice
from .tags import TagGroups, DXFStructureError, Tags, binary_encoded_data_to_bytes
class AcDsDataSection(object):
name = 'acdsdata'
def __init__(self):
# Standard_ACIS_Binary (SAB) data stor... |
from setuptools import setup
PACKAGE = 'inputfieldtrap'
VERSION = '0.11'
setup(
name = PACKAGE,
version = VERSION,
packages = ['inputfieldtrap'],
author = '?',
author_email = '',
description = 'Non-logged in users who fill anything in the robot trap hidden input field get blocked. Applies to w... |
import logging
from django import template
from django.template.defaultfilters import title
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext as _
from horizon import api
from horizon import tables
from horizon.dashboards.nova.instances_and_volumes.instances.tables impor... |
import urllib, urllib2
import re, os, cookielib
import time as time_
class RealDebrid:
def __init__(self, cookie_file, username, password):
self.cookie_file = cookie_file
self.username = username
self.password = password
def GetURL(self, url):
print 'DebridRoutines ... |
import tempfile
import time
class ViewCollection:
views = {} # Todo: these aren't really views but handlers. Refactor/Rename.
git_times = {}
git_files = {}
buf_files = {}
compare_against = "HEAD"
@staticmethod
def add(view):
key = ViewCollection.get_key(view)
... |
from matplotlib.animation import FuncAnimation
import mpl_toolkits.axes_grid1
import matplotlib.widgets
class Player(FuncAnimation):
def __init__(self, fig, func, frames=None, init_func=None, fargs=None,
save_count=None, mini=0, maxi=100, pos=(0.2, 0.98), **kwargs):
self.i = 0
sel... |
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
import os
import platform
import shutil
import tempfile
import unittest
import urllib
import pykka
from mopidy import core
from mopidy.internal import deprecation
from mopidy.m3u import actor
from mopidy.m3u.translator import playlist_uri_to... |
from typing import Optional
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.ec2 import EC2Hook
from airflow.utils.decorators import apply_defaults
class EC2StartInstanceOperator(BaseOperator):
"""
Start AWS EC2 instance using boto3.
:param instance_id: id of the AWS EC2 i... |
from e3pipe.dst.E3InputFile import E3InputFile
class E3TextTupleBase(E3InputFile):
""" Class encapsulating a file containing a text tuple.
The main purpose of this class is to be able to iterate on a text tuple file
getting out structured objects rather than text lines.
"""
ROW_DESCRIPTOR = Non... |
from seecr.test import SeecrTestCase, CallTrace
from weightless.core import consume
from meresco.components import Schedule
from meresco.distributed.updateperiodiccall import UpdatePeriodicCall
class UpdatePeriodicCallTest(SeecrTestCase):
def testUpdateSchedule(self):
class MockState():
paus... |
from hone_lib import *
from math import *
import time
K = 0.2
totalBudget = 100000 # Kbps
def query():
q = (Select(['app','srcHost', 'srcIP','srcPort','dstIP','dstPort','BytesSentOut','StartTimeSecs','ElapsedSecs','StartTimeMicroSecs','ElapsedMicroSecs']) *
From('HostConnection') *
Where([('app'... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import platform
from subprocess import Popen, PIPE
from ..bundle import FILENAME_BUNDLE
from ..secrets import FILENAME_SECRETS
HOST_OS = {
"Darwin": 'macos',
"Linux": 'linux',
}
def host_os():
return HOST_OS[platform.system()]
def make_... |
import argparse
import os
import sys
from typing import Any, List
from ast_parser.core import cli
def _generate_list_region_tags_parser(main_parser: Any) -> None:
"""Helper function that creates a parser for list_region_tags
Args:
main_parser: the root-level parser object to add list_region_tags'
... |
# -*- coding: utf8 -*-
from django.contrib import admin
from django.db import models
from perelachaise.models import NodeOSM, Monument, Personnalite, ImageCommons
class NodeOSMAdmin(admin.ModelAdmin):
"""
Classe d'administration de NodeOSM
"""
# ================
# Liste des objets
# ====... |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.urlresolvers import reverse
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWa... |
import numpy as np
import uncertainties.unumpy as unp
import math
#Geschwindigkeitsauswertung mit Fehlerrechnun
l_1=unp.uarray(13e-2,1e-3)
#Hier nicht wichtig
g,u=np.genfromtxt('zeiten.txt',unpack=True)
well=np.genfromtxt('wellenlaenge.txt', unpack=True)
n_0=np.genfromtxt('ruhefrequenz.txt',unpack=True)
for a in u... |
"""
Acceptance tests for Library Content in LMS
"""
import ddt
from flaky import flaky
from nose.plugins.attrib import attr
import textwrap
from unittest import skip
from .base_studio_test import StudioLibraryTest
from ...fixtures.course import CourseFixture
from ..helpers import UniqueCourseTest, TestWithSearchIndexM... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import oscar.models.fields
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0001_initial'),
('contenttypes', '0001_initial'),
]
operations = [
migration... |
"""
Utility base TestCase classes for testing manage views.
"""
from datetime import datetime
from . import base
class ListViewTestCase(base.FormViewTestCase, base.ListViewTestCase):
"""Base class for testing manage list views."""
# subclasses should specify these:
perm = None # required manag... |
import os.path
import logging
import subprocess
import shutil
import json
from gii.core import *
from mock import _MOCK
_MATERIAL_EXT = '.material'
_MATERIAL_TYPE = 'material'
##----------------------------------------------------------------##
##----------------------------------------------------------------##
cl... |
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db=Database()
class ORMGroup(db.Entity):
_table_='group_list'
id=PrimaryKey(int, column='group_id')
name=Option... |
from sqlalchemy import schema, orm
from . properties import Property
from . statements import ClassMutator
"""
This module provides support for defining the fields (columns) of your
entities. This module sole reason of existence is to keep existing Elixir
model definitions working. Do not use it when writing new cod... |
from datetime import datetime
import pytest
from pandas import (
DatetimeIndex,
offsets,
to_datetime,
)
import pandas._testing as tm
from pandas.tseries.holiday import (
AbstractHolidayCalendar,
Holiday,
Timestamp,
USFederalHolidayCalendar,
USLaborDay,
USThanksgivingDay,
get_c... |
# Django settings for tentwatch project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/home/hackanooga/t... |
from mock import patch
import unittest
import slack
import slack.im
import slack.http_client
slack.api_token = 'my_token'
class TestImList(unittest.TestCase):
@patch.object(slack.http_client, 'get')
def test_list(self, http_get_mock):
slack.im.list()
http_get_mock.assert_called_with('im.list... |
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import random
import scipy as sc
from scipy import stats
import os
import sys
from scipy.stats.distributions import t
import statsmodels.stats.api as sms
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmo... |
#python
import k3d
import sys
import testing
setup = testing.setup_mesh_writer_test(["FrozenMesh", "K3DMeshWriter"], "K3DMeshReader", "mesh.serialization.k3d")
mesh = setup.source.create_mesh()
primitive = mesh.primitives().create("test")
array_types = [ "k3d::bool_t", "k3d::color", "k3d::double_t", "k3d::imaterial... |
#coding=utf-8
import os
import asyncio
from aiohttp import web
import jinja2
import aiohttp_jinja2
_CUR_PATH = os.path.dirname(os.path.realpath(__file__))
# async def template(template):
# def inner(view):
# def response( *args, **kwargs ):
# request = args[0]
# request, context = yield from view(request)... |
from electrum_gmc.i18n import _
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import os.path
import time
import traceback
import sys
import threading
import platform
if platform.system() == 'Windows':
MONOSPACE_FONT = 'Lucida Console'
elif platform.system() == 'Darwin':
MONOSPACE_FONT = 'Monaco'
else:
... |
import pytest
from datadog_checks.base import AgentCheck
from .common import (
COMMANDS_COUNTERS_METRICS,
CONNECTION_POOL_METRICS,
GLOBAL_METRICS,
MEMORY_METRICS,
QUERY_RULES_TAGS_METRICS,
USER_TAGS_METRICS,
)
from .conftest import _assert_all_metrics, _assert_metadata, get_check
@pytest.mar... |
"""Engine for generating reports"""
# System imports:
import ftplib
import glob
import os.path
import shutil
import socket
import sys
import syslog
import threading
import time
import traceback
# 3rd party imports:
import configobj
# Weewx imports:
import weeutil.weeutil
from weeutil.weeutil import to_bool
import we... |
data = (
'ja', # 0x00
'ju', # 0x01
'ji', # 0x02
'jaa', # 0x03
'jee', # 0x04
'je', # 0x05
'jo', # 0x06
'jwa', # 0x07
'ga', # 0x08
'gu', # 0x09
'gi', # 0x0a
'gaa', # 0x0b
'gee', # 0x0c
'ge', # 0x0d
'go', # 0x0e
'[?]', # 0x0f
'gwa', # 0x10
'[?]', # 0x... |
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
# We intentionally define lot... |
#!/usr/bin/env python
from __future__ import division, print_function
import sys
import os
import subprocess
import cProfile
from time import time, sleep
import distutils.spawn
import numpy as np
import guicontrol
os.chdir(os.path.dirname(sys.argv[0]))
sys.path.insert(0, '..')
sys.path.insert(0, '.')
start_measure... |
import os
import ctypes
import socket
import platform
from utp.utp_h import *
from utp.sockaddr_types import *
basepath = os.path.join(os.path.dirname(__file__), "..")
if platform.system() == "Windows":
utp = ctypes.cdll.LoadLibrary(os.path.join(basepath, "utp.dll"))
elif platform.system() == "Darwin":
utp = c... |
#!/usr/bin/env python
import time
import roslib;
import rospy
import actionlib
from control_msgs.msg import *
from trajectory_msgs.msg import *
JOINT_NAMES = ['PhantomXPincher_joint1','PhantomXPincher_joint2','PhantomXPincher_joint3','PhantomXPincher_joint4']
Q1_ANGLE = 1.5708/4
Q0 = [0, 0, 0, 0]
Q1 = [Q1_ANGLE, Q1_A... |
import token
import symbol
import parser
def issequence(t):
return isinstance(t, (list, tuple))
def int_to_symbol(i):
""" Convert numeric symbol or token to a desriptive name.
"""
try:
return symbol.sym_name[i]
except KeyError:
return token.tok_name[i]
def translate_symbols(ast_tu... |
import os
from typing import List
from laniakea.localconfig import LocalConfig, ExternalToolsUrls
from laniakea.git import Git
from laniakea.logging import log, get_verbose
from laniakea.utils import listify
class DakBridge:
'''
Call commands on the Debian Archive Kit (dak)
CLI utility.
'''
def _... |
#!/usr/bin/env python
from textwrap import wrap
NO_ERRORS_EXIT = 0
ERRORS_EXIT = 1
WARNINGS_EXIT = 2
CAN_NOT_OPEN_EVENT_FILE = 11
CAN_NOT_OPEN_CONF_FILE = 12
CAN_NOT_OPEN_CLUSTER_DB_FILE = 13
CAN_NOT_OPEN_PBS = 14
UNDEFINED_EVENT = 15
UNEXPECTED_ERROR = 64
def format_msg(msg_tmpl, extra, indent=8, width=64):
i... |
import json
import nose
from nose.tools import assert_equals
from pylons import config
import sqlalchemy.orm as orm
import paste.fixture
import ckan.config.middleware as middleware
import ckan.plugins as p
import ckan.lib.create_test_data as ctd
import ckan.model as model
import ckan.tests.legacy as tests
import ckan... |
#!/usr/bin/env python
import sys
import datetime
import hashlib
import json
import logging
import controller.framework.ipoplib as ipoplib
from controller.framework.ControllerModule import ControllerModule
py_ver = sys.version_info[0]
if py_ver == 3:
import urllib.request as urllib2
else:
import urllib2
cla... |
__author__ = 'Rajiv Mayani'
import re
from datetime import datetime
from time import localtime, strftime
from flask import request, render_template, url_for, json
from sqlalchemy.orm.exc import NoResultFound
from Pegasus.netlogger.analysis.error.Error import StampedeDBNotFoundError
from pegasus.service import app... |
import ctypes
import functools
import windows.generated_def as gdef
from .error import ExportNotFound
from windows.pycompat import is_py3
# Utils
def is_implemented(apiproxy):
"""Return :obj:`True` if DLL/Api can be found"""
try:
apiproxy.force_resolution()
except ExportNotFound:
return Fa... |
# -*- coding: utf-8 -*-
"""
Django production settings for {{ project_name }} project.
For more information on this file, see
https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
"""... |
import logging
import os
import time
import sys
from itertools import combinations, product
from queue import Empty
import dill
import numpy as np
import matplotlib
matplotlib.rcParams['backend'] = 'Agg'
from hyperspy.signal import BaseSignal
from hyperspy.utils.model_selection import AICc
_logger = logging.getLogge... |
from neutron_lib.db import model_base
from oslo_log import log as logging
import sqlalchemy as sa
from neutron._i18n import _LE
from neutron.callbacks import registry
from neutron.callbacks import resources
from neutron.db import models_v2
from neutron.db import standard_attr
LOG = logging.getLogger(__name__)
PROVISI... |
import pytest
import nacl.hash
import nacl.encoding
@pytest.mark.parametrize(("inp", "expected"), [
(
b"The quick brown fox jumps over the lazy dog.",
b"ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c",
),
(
b"",
b"e3b0c44298fc1c149afbf4c8996fb92427ae41e46... |
import unittest
import openmesh
import numpy as np
class TriMeshGarbageCollection(unittest.TestCase):
def setUp(self):
self.mesh = openmesh.TriMesh()
# Add some vertices
self.vhandle = []
self.vhandle.append(self.mesh.add_vertex(np.array([-1, -1, 1])))
self.vhan... |
# -*- encoding: utf-8 -*-
from datetime import datetime, timedelta
import random
import string
import base64
import os
import factory
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from django.contrib.auth import get_user_model
from django.utils import timezone
from dj... |
from django.core.urlresolvers import reverse
from django.db import models
from edc_base.audit_trail import AuditTrail
from edc_base.model.models import BaseUuidModel
from edc_sync.models import SyncModelMixin
from lis.specimen.lab_result.models import BaseResult
from ..managers import ResultManager
from .order_item ... |
MODULES_LIST = {'dashboard': {'txt':'Dashboard','icon':'icon_house_alt'},
'inventario': {'txt':'Inventario','icon':'fa fa-cubes'},
'tickets': {'txt':'Tickets','icon':'fa fa-bug'},
'new': {'txt':'Nuevo','icon':'fa fa-plus'},
'calendario': {'txt':'Calendario... |
from __future__ import absolute_import
#from __future__ import print_function
import numpy as np
import random
import keras as k
from keras.datasets import cifar10
from keras.models import Sequential, Graph
from keras.layers.core import *
from keras.layers.convolutional import *
from keras.layers.normalization import... |
import tessterrain
from math import *
from euclid import *
from omega import *
from cyclops import *
from omegaToolkit import *
tt = tessterrain.initialize()
tt.addTerrain("testdata/tess/config.ini")
# model
scene = getSceneManager()
light = Light.create()
light.setColor(Color("#505050"))
light.setAmbient(Color("#20... |
"""
pyDAL is a pure Python Database Abstraction Layer.
It dynamically generates the SQL in real time using the specified dialect for
the database back end, so that you do not have to write SQL code or learn
different SQL dialects (the term SQL is used generically), and your code will
be portable among different types ... |
"""Plotting functions for Clusters.
Note that some visualizations work best with datasets that
have fewer samples while some are more informative with more
samples.
.. testsetup:: *
import crystal
import crystal.utils as cu
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import ... |
import datetime, sys, os, time
from cappylib.general import *
from cappylib.log import Log
##############################################################################################
# GLOBAL VARS
##############################################################################################
######################... |
"""Support for Tahoma switches."""
import logging
from homeassistant.components.switch import SwitchEntity
from homeassistant.const import STATE_OFF, STATE_ON
from . import DOMAIN as TAHOMA_DOMAIN, TahomaDevice
_LOGGER = logging.getLogger(__name__)
ATTR_RSSI_LEVEL = "rssi_level"
def setup_platform(hass, config, a... |
#!/usr/bin/env python
"""
@file csv2vss.py
@author Michael Behrisch
@date 2013-06-04
@version $Id: csv2vss.py 14425 2013-08-16 20:11:47Z behrisch $
Create variable speed signs from comma separated detector data.
SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
Copyright (C) 2013-2013 DLR (http://ww... |
import os
from textwrap import indent, dedent
from mot.lib.cl_function import CLFunction, SimpleCLFunction
from mot.lib.utils import split_cl_function
__author__ = 'Robbert Harms'
__date__ = "2016-10-03"
__maintainer__ = "Robbert Harms"
__email__ = "<EMAIL>"
class CLLibrary(CLFunction):
pass
class SimpleCLLibr... |
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from adhocracy4.comments import models as comment_models
from adhocracy4.ratings import models as rating_models
from meinberlin.apps.mapide... |
from google.appengine.api import mail
import webapp2
import os
from google.appengine.api import users
import smtplib
import logging
from jinja_template import JinjaTemplating
import wsgiref
import json
class EmailHandler(JinjaTemplating):
def post(self):
email_details = json.loads(self.request.body)
object_detai... |
#!/usr/bin/env python
'''
The random module allows the rest of the framework to have access to random functionality
'''
# import random, string
from framework.dependency_management.dependency_resolver import BaseComponent
from framework.lib.general import *
from collections import defaultdict
class PluginParams(BaseC... |
#!/usr/bin/python
from os import environ, path
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
MODELDIR = "../../../model"
DATADIR = "../../../test/data"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us/en-us'))
c... |
"""CLI tests."""
import logging
import os
import sys
import tempfile
import unittest
from contextlib import contextmanager
from io import StringIO
IS_PY3 = sys.version_info > (3,)
# noqa from http://stackoverflow.com/questions/4219717/how-to-assert-output-with-nosetest-unittest-in-python
@contextmanager
def captur... |
from StringIO import StringIO
from xml4h.impls.interface import XmlImplAdapter
from xml4h import nodes, exceptions
import xml.dom
import xml.dom.minidom
class XmlDomImplAdapter(XmlImplAdapter):
"""
Adapter to the
`minidom <http://docs.python.org/2/library/xml.dom.minidom.html>`_ XML
library implemen... |
from ..utils import minversion
# This returns False if matplotlib cannot be imported
MATPLOTLIB_GE_1_5 = minversion('matplotlib', '1.5')
__all__ = ['astropy_mpl_style_1', 'astropy_mpl_style']
# Version 1 astropy plotting style for matplotlib
astropy_mpl_style_1 = {
# Lines
'lines.linewidth': 1.7,
'lines.... |
"""
The purpose of this module is to provide utility functions related to loading
and registering plugins into the system. The "loadPlugins" and "loadPlugin"
functions are used by the core system to actually load the plugins and create
the pseudo-packages required for easily referencing them. The other functions
in thi... |
{% include 'misc/header.py' %}
"""{{ cookiecutter.description }}"""
from flask_babelex import gettext as _
from . import config
class {{ cookiecutter.extension_class }}(object):
"""{{ cookiecutter.project_name}} extension."""
def __init__(self, app=None):
"""Extension initialization."""
# T... |
from __future__ import absolute_import
from __future__ import unicode_literals
import yaml
from aspy.yaml.ordereddict import OrderedDict
# Adapted from http://stackoverflow.com/a/21912744/812183
class OrderedLoader(yaml.loader.Loader):
pass
OrderedLoader.add_constructor(
yaml.resolver.BaseResolver.DEFAUL... |
"""
Functions for resolving hostnames and IPs
"""
import dns.reversename
import dns.resolver
import multiprocessing
import multiprocessing.dummy
import os
import queue
import socket
import threading
__DEFAULT_TIMEOUT__ = 2
def dns_default_timeout():
return __DEFAULT_TIMEOUT__
def __check_ip_version__(ip_vers... |
#!/usr/bin/env python3
class Compass(object):
def __init__(self):
self.directions = [('n', 1), ('e', 1), ('s', -1), ('w', -1)]
self.currentDirection = 0
def getNewDirection(self, turnDirection):
if turnDirection == 'L':
self.currentDirection = (self.currentDirect... |
from django.contrib import admin
from django.conf import settings
from messages.models import Message
class MessageAdmin(admin.ModelAdmin):
list_display = ('user', 'subject', 'author', 'read', 'created')
if settings.DEBUG:
admin.site.register(Message, MessageAdmin) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.