content string |
|---|
from pyjamas import DOM
from pyjamas import Factory
from pyjamas.ui.CellPanel import CellPanel
from pyjamas.ui import Event
class StackPanel(CellPanel):
def __init__(self, **kwargs):
self.visibleStack = -1
self.indices = {}
self.stackListeners = []
kwargs['StyleName'] = kwargs.ge... |
"""Image warping using sparse flow defined at control points."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.image.python.ops import dense_image_warp
from tensorflow.contrib.image.python.ops import interpolate_... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
def main():
module = AnsibleModule(
supports_check_mode=True,
... |
import inspect
import numpy
def summary(x):
"""Summarize a datatype as a string (for display and debugging)."""
if type(x)==numpy.ndarray:
return "<ndarray %s %s>"%(x.shape,x.dtype)
if type(x)==str and len(x)>10:
return '"%s..."'%x
if type(x)==list and len(x)>10:
return '%s...'%... |
import time
from report import report_sxw
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw('report.sale.order', 'sal... |
"""
example.py
by Ted Morin
contains example code for 30-year CVD calculator - all models
10.1161/CIRCULATIONAHA.108.816694
2009 Predicting the Thirty-year Risk of Cardiovascular Disease
The Framingham Heart Study
"""
#ismale,age,sbp,antihyp,smoke,diabet,totchol,hdlchol
#tests
from modela import model as a
from mod... |
'''
Created on Aug 1, 2012
@author: Peyman Kazemian
'''
from examples.utils.network_loader import load_network
from config_parser.cisco_router_parser import cisco_router
from utils.wildcard import wildcard_create_bit_repeat
from utils.wildcard_utils import set_header_field
from headerspace.hs import headerspace
from ... |
#!/usr/bin/python
#
# Usage: unwcheck.py FILE
#
# This script checks the unwind info of each function in file FILE
# and verifies that the sum of the region-lengths matches the total
# length of the function.
#
# Based on a shell/awk script originally written by Harish Patil,
# which was converted to Perl by Matthew Ch... |
# stdlib
from datetime import datetime, timedelta
import logging
from operator import attrgetter
import sys
import time
# project
from checks.check_status import ForwarderStatus
from util import get_tornado_ioloop, plural
log = logging.getLogger(__name__)
FLUSH_LOGGING_PERIOD = 20
FLUSH_LOGGING_INITIAL = 5
class Tr... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils.common.parameters import get_unsupported_parameters
@pytest.fixture
def argument_spec():
return {
'state': {'aliases': ['status']},
'enabled': {},
}
def mock_handl... |
'''Property Definitions (bpy.props)
This module defines properties to extend blenders internal data, the result of these functions is used to assign properties to classes registered with blender and can't be used directly.
'''
def BoolProperty(name="", description="", default=False, options={'ANIMATABLE'... |
# -*- coding: utf-8 -*-
"""**Postprocessors package.**
"""
__author__ = 'Marco Bernasocchi <<EMAIL>>'
__revision__ = '$Format:%H$'
__date__ = '10/10/2012'
__license__ = "GPL"
__copyright__ = 'Copyright 2012, Australia Indonesia Facility for '
__copyright__ += 'Disaster Reduction'
from collections import OrderedDict
... |
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import Big5DistributionAnalysis
from .mbcssm import BIG5_SM_MODEL
class Big5Prober(MultiByteCharSetProber):
def __init__(self):
super(Big5Prober, self).__init__()
self.codi... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para bitshare
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core impo... |
from datetime import datetime
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase
from django.ut... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
from pygame.locals import *
import pygame, string
class ConfigError(KeyError): pass
class Config:
""" A utility for configuration """
def __init__(self, options, *look_for):
assertions = []
for key in look_for:
if key[0] in options.keys(): exec('self.'+key[0]+' = options[... |
"""
==========================================
Outlier detection with several methods.
==========================================
When the amount of contamination is known, this example illustrates three
different ways of performing :ref:`outlier_detection`:
- based on a robust estimator of covariance, which is assum... |
from gnuradio import gr, gr_unittest
class test_copy(gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_copy (self):
src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
expected_result = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
... |
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, InternetGateway
class TestDescribeInternetGateway(AWSMockServiceTestCase):
connection_class = VPCConnection
def default_body(self):
return b"""
<DescribeInternetGatewaysResp... |
"""
Distance and Area objects to allow for sensible and convenient calculation
and conversions.
Authors: Robert Coup, Justin Bronn, Riccardo Di Virgilio
Inspired by GeoPy (https://github.com/geopy/geopy)
and Geoff Biggs' PhD work on dimensioned units for robotics.
"""
from decimal import Decimal
from functools import... |
"""
Pluggable Weighing support
"""
import abc
import six
from nova import loadables
def normalize(weight_list, minval=None, maxval=None):
"""Normalize the values in a list between 0 and 1.0.
The normalization is made regarding the lower and upper values present in
weight_list. If the minval and/or max... |
import subprocess
class InstallError(Exception):
pass
class AptError(InstallError):
pass
class YumError(InstallError):
pass
class UnsupportedInstallerError(InstallError):
pass
class Installer:
"""Abstract Base Class for an installer. Represents the installation
system for the current ... |
from openerp.osv import orm, fields
def name(n): return 'base_import.tests.models.%s' % n
class char(orm.Model):
_name = name('char')
_columns = {
'value': fields.char('unknown', size=None)
}
class char_required(orm.Model):
_name = name('char.required')
_columns = {
'value': fie... |
from unittest import TestCase
from six.moves.urllib.parse import urlparse
from scrapy.http import Response, Request
from scrapy.spiders import Spider
from scrapy.spidermiddlewares.offsite import OffsiteMiddleware
from scrapy.utils.test import get_crawler
class TestOffsiteMiddleware(TestCase):
def setUp(self):
... |
from base import BaseGraph, UnifiedGraph
from canvas import ScatterCanvas, DoubleScatterCanvas, BarCanvas, HorizontalBarCanvas, PieCanvas, LineCanvas
from axes import YAxis
from ..utils.struct import Vector as V
from ..graphics.utils import ViewBox, Translate, Rotate, addAttr, blank, boolean
from ..graphics.color imp... |
#!/Usr/bin/env python
#Use ctypes to interface with C libraries
#POINTER is the class type of pointer
#pointer() acts on actual array, while POINTER() works on class type.
#pointer(cell(arr)) #creates cell Structure for np.array type arr and makes a pointer
#pcell=POINTER(cell) ; pcell() #Creates a class for cell Stru... |
"""
Verifies that the user can override the compiler and linker using CC/CXX/LD
environment variables.
"""
import TestGyp
import os
import copy
import sys
here = os.path.dirname(os.path.abspath(__file__))
if sys.platform == 'win32':
# cross compiling not supported by ninja on windows
# and make not supported on ... |
import numpy as np
import chainer
from chainer.backends import cuda
import chainer.functions as F
import chainer.links as L
from chainercv.links.model.faster_rcnn.utils.generate_anchor_base import \
generate_anchor_base
from chainercv.links.model.faster_rcnn.utils.proposal_creator import \
ProposalCreator
c... |
"""
tests for quantecon.util
"""
from __future__ import division
from collections import Counter
import unittest
import numpy as np
from numpy.testing import assert_allclose
from nose.plugins.attrib import attr
import pandas as pd
from quantecon import matrix_eqn as qme
def test_solve_discrete_lyapunov_zero():
'... |
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.util import truncate_name
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated PostgreSQL column
# types, as strings. Column-type strings can contain format strings; they'll
... |
from __future__ import unicode_literals
from mach.decorators import (
CommandProvider,
Command,
)
def is_foo(cls):
"""Foo must be true"""
return cls.foo
def is_bar(cls):
"""Bar must be true"""
return cls.bar
@CommandProvider
class ConditionsProvider(object):
foo = True
bar = False
... |
import pyuaf
import unittest
from pyuaf.util.unittesting import parseArgs, TestResults
import thread, time
ARGS = parseArgs()
def suite(args=None):
if args is not None:
global ARGS
ARGS = args
return unittest.TestLoader().loadTestsFromTestCase(ClientDiscoveryTest)
def testParalle... |
"""
Tests for the update() queryset method that allows in-place, multi-object
updates.
"""
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class DataPoint(models.Model):
name = models.CharField(max_length=20)
... |
"""
pyyaml legacy
Copyright (c) 2001 Steve Howell and Friends; All Rights Reserved
(see open source license information in docs/ directory)
"""
import re, string
from implicit import convertImplicit
from inline import InlineTokenizer
from klass import DefaultResolver
from stream import YamlLoaderException, F... |
import sys
import json
import argparse
from st2common import log as logging
from st2actions import config
from st2actions.runners.pythonrunner import Action
from st2common.util import loader as action_loader
from st2common.util.config_parser import ContentPackConfigParser
from st2common.constants.action import ACTION_... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListVirtualMFADevices(Choreography):
def __init__(self, temboo_session):
"""
... |
import sys, locale
sys.path.append('/usr/local/subversion/lib/svn-python')
from svn import repos, fs
locale.setlocale(locale.LC_ALL, 'en_GB')
def canonicalize(path):
return path.decode('utf-8').lower().encode('utf-8')
def get_new_paths(txn_root):
new_paths = []
for path, change in fs.paths_changed(txn_root).ite... |
from oslo_config import cfg
from oslo_log import log as logging
from oslo_versionedobjects import fields
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder import objects
from cinder.objects import base
from cinder import utils
CONF = cfg.CONF
OPTIONAL_FIELDS = ['metadata', 'admi... |
# A tool to setup the Python registry.
class error(Exception):
pass
import sys # at least we can count on this!
def FileExists(fname):
"""Check if a file exists. Returns true or false.
"""
import os
try:
os.stat(fname)
return 1
except os.error, details:
return 0
def ... |
from en.parser.nltk_lite.stem import *
class Regexp(StemI):
"""
A stemmer that uses regular expressions to identify morphological
affixes. Any substrings that matches the regular expressions will
be removed.
"""
def __init__(self, regexp, min=0):
"""
Create a new regexp stemmer... |
def web_socket_do_extra_handshake(request):
pass
def web_socket_transfer_data(request):
request.connection.write('sub/plain_wsh.py is called for %s, %s' %
(request.ws_resource, request.ws_protocol))
# vi:sts=4 sw=4 et |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
str = type('')
import logging
from . import __version__
from .terminal import TerminalApplication, FileType
from .readers import open_scan
class CtInfoApplication(TerminalApplication):
"""
This utility... |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 Foundation, either version 3 of the License, or
(at your option) any l... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para zippyshare
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core import scrap... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.common import Backend
from lib.core.common import Format
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
... |
import uno
import string
import unohelper
import xmlrpclib
from com.sun.star.task import XJobExecutor
if __name__<>"package":
from lib.gui import *
from lib.error import ErrorDialog
from lib.functions import *
from lib.logreport import *
from LoginTest import *
from lib.rpc import *
databas... |
class calendar:
def __repr__(self):
def color(text):
colors = {
'BLUE' : '\033[94m',
'GREEN' : '\033[92m',
'YELLOW' : '\033[93m',
'RED' : '\033[91m',
'ENDC' : '\033[0m'
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.python import *
# pylint: enable=wildcard-import
from tensorflow.python.util.lazy_loader import LazyLoader
contrib = LazyLoader('contrib', globals(), 'tensorfl... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
fr... |
"""
Test module for Entrance Exams AJAX callback handler workflows
"""
import json
from mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase
from contentst... |
import curses
class Terminal:
style_bold = False
keymap = {'A': 0x3, 'C': 0x2, 'D': 0x1}
def setup_colors(self):
curses.start_color()
curses.use_default_colors()
self.colors = {}
self.colors[(0, 0)] = 0
self.colors[(7, 0)] = 0
self.color_index = 1
s... |
from odoo.addons.connector.unit.mapper import (mapping,
changed_by,
ImportMapper,
ExportMapper,
)
def trim(field):
""" A modif... |
import fnmatch
import optparse
import os
import sys
from util import build_utils
from util import md5_check
def DoJar(options):
class_files = build_utils.FindInDirectory(options.classes_dir, '*.class')
for exclude in options.excluded_classes.split():
class_files = filter(
lambda f: not fnmatch.fnmatc... |
from django.db.utils import IntegrityError
from django.test import TestCase, tag
from dashboard.models import Product, PUC, ProductToPUC, ProductUberPuc, PUCKind
from dashboard.tests.loader import load_model_objects, fixtures_standard
from dashboard.views.product_curation import ProductForm
import time
@tag("puc")
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
import io
import re
from glob import glob
from os import path, environ
from setuptools import find_packages
# Include extensions only when not on readthedocs.org
if environ.get('READTHEDOCS', None) == 'True':
from setuptools i... |
from __future__ import print_function
from __future__ import unicode_literals
HIDE_CURSOR = '\x1b[?25l'
SHOW_CURSOR = '\x1b[?25h'
class WriteMixin(object):
hide_cursor = False
def __init__(self, message=None, **kwargs):
super(WriteMixin, self).__init__(**kwargs)
self._width = 0
if m... |
import numpy as np
import lensfunpy as lensfun
import gc
from numpy.testing.utils import assert_equal
# the following strings were taken from the lensfun xml files
cam_maker = 'NIKON CORPORATION'
cam_model = 'NIKON D3S'
lens_maker = 'Nikon'
lens_model = 'Nikon AI-S Nikkor 28mm f/2.8'
def testDatabaseLoading():
db... |
# All fields except for BlobField written by Jonas Haag <<EMAIL>>
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.importlib import import_module
__all__ = ('RawField', 'ListField', 'DictField', 'SetField',
'BlobField', 'EmbeddedModelField')
class _HandleAs... |
import math
import psycopg2
import numpy as np
mas_to_rad = 4.8481368 * 1E-09
n_q = 0.637
vfloat = np.vectorize(float)
band_cm_dict = {'c': 6., 'l': 18., 'p': 94., 'k': 1.35}
SEFD_dict = {'RADIO-AS': {'K': {'L': 46700., 'R': 36800},
'C': {'L': 11600., 'R': None},
'L... |
import urllib
def main():
module = AnsibleModule(
argument_spec=dict(
token=dict(required=True),
environment=dict(required=True),
revision=dict(required=True),
user=dict(required=False),
rollbar_user=dict(required=False),
comment=dict... |
from __future__ import print_function
import numpy as np
from optparse import OptionParser
from pylearn2.models.independent_multiclass_logistic import IndependentMulticlassLogistic
from galatea.s3c.feature_loading import get_features
from pylearn2.utils import serial
from pylearn2.datasets.cifar10 import CIFAR10
from ... |
"""
A Fake Data API for testing purposes.
"""
import copy
import datetime
_DEFAULT_FAKE_MODE = {
"slug": "honor",
"name": "Honor Code Certificate",
"min_price": 0,
"suggested_prices": "",
"currency": "usd",
"expiration_datetime": None,
"description": None
}
_ENROLLMENTS = []
_COURSES = [... |
'''
Copyright (C) 2013 Travis DeWolf
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 Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope t... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import getpass
class Command(BaseCommand):
help = "Clone of the UNIX program ``passwd'', for django.contrib.auth."
requires_model_validation = False
def handle(self, *args, **options):
i... |
import base64
from binascii import hexlify
import getpass
import os
import select
import socket
import sys
import time
import traceback
from paramiko.py3compat import input
import paramiko
try:
import interactive
except ImportError:
from . import interactive
def agent_auth(transport, username):
"""
A... |
import numpy as np
from theano.compat.six.moves import zip as izip
from pylearn2.costs.cost import SumOfCosts
from pylearn2.testing.cost import SumOfOneHalfParamsSquared
from pylearn2.testing.cost import SumOfParams
from pylearn2.testing.datasets import ArangeDataset
from pylearn2.training_algorithms.sgd import SGD
f... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.nxos import get_config, load_config
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic import A... |
#!/usr/bin/env python
# A linter to warn for ASSERT macros which are separated from their argument
# list by a space, which Clang's CPP barfs on
import sys
import logging
import os
import json
import re
def setup_logging(logger):
"""
``arc lint`` makes it quite tricky to catch debug output from linters.
... |
# -*- coding: utf-8 -*-
'''
:maintainer: Calle Pettersson <<EMAIL>>
:maturity: new
:depends: python-requests
:platform: all
Interact with Hashicorp Vault
'''
import logging
import difflib
import salt.exceptions
log = logging.getLogger(__name__)
def policy_present(name, rules):
url = "v1/sys/po... |
'''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Purpose:
This is a utility to display variuos node firmware and manufacturer info.
'''
import fit_path # NOQA: unused import
import json
import pprint
import fit_common
import test_api_utils
# Globals
NODELIST = fit_common.node_select()
if ... |
from django.contrib.auth.models import (
AbstractBaseUser, AbstractUser, BaseUserManager, Group, Permission,
PermissionsMixin, UserManager,
)
from django.db import models
# The custom User uses email as the unique identifier, and requires
# that every user provide a date of birth. This lets us test
# changes ... |
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import os
import re
import sys
import pretty_vcproj
def BuildProject(project, built... |
import calendar
from datetime import datetime
import itertools
from time import time
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from config import logging, charts
from model.patchlog import PatchLog
from model.queues import Queue
from model.queuelog import QueueLog
clas... |
"""Support for magicseaweed data from magicseaweed.com."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_API_KEY,
CONF_NAME,
CONF_MONITORED_CONDITIONS,
ATTR_ATTRIBUTION,
)
import ... |
import functools
import json
import logging
import traceback
from flask import g, redirect, Response, flash, abort
from flask_babel import gettext as __
from flask_appbuilder import BaseView
from flask_appbuilder import ModelView
from flask_appbuilder.widgets import ListWidget
from flask_appbuilder.actions import act... |
"""Tests of the DataFrame class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python import learn
from tensorflow.contrib.learn.python.learn.tests.dataframe import mocks
from tensorflow.python.framework import dtypes
from... |
import os
import subprocess
import extract_sa
from app import app
from scripts.satools import oscode
def prepare(sessionID, target, sa_filename, q):
file_metadata = "file_metadata:%s:%s" % (sessionID, sa_filename)
SA_FILEPATH = os.path.join(target, sa_filename)
res = oscode.determine_version(file_path=SA_... |
# -*- coding: utf-8 -*-
'''
@author: nick
'''
import pygame
class InputProcessor():
def __init__(self, appModel):
self.model = appModel
def process(self, event):
if event.type == pygame.QUIT:
self.model.closeWindow()
if event.type == pygame.KEYDOWN and even... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsMessageLog.
.. note:: 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 Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__a... |
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import network
authorize = extensions.soft_extension_authorizer('compute', 'extended_vif_net')
class ExtendedServerVIFNetController(wsgi.Controller):
def __init__(self):
super(ExtendedServerVIFNetController, self).__i... |
"""
Creates minimal accounting demo data:
- a minimal accounts chart
- some journals
"""
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
from django.conf import settings
from lino.api import dd, rt, _
from lino_xl.lib.accounts.utils import DEBIT, CREDIT
from lino_xl.li... |
import cgi
import connexion
import logging
import re
import auslib.web
from os import path
from connexion import request
from flask import make_response, send_from_directory, Response
from raven.contrib.flask import Sentry
from auslib.AUS import AUS
from auslib.web.api_validator import BalrogParameterValidator
fro... |
import unittest
import tempfile
import shutil
try:
from unittest import mock
except ImportError:
import backports.unittest_mock
backports.unittest_mock.install()
from unittest import mock
try:
from types import SimpleNamespace as namespace
except ImportError:
class namespace(object):
d... |
import calendar
import time
from email.utils import formatdate, parsedate, parsedate_tz
from datetime import datetime, timedelta
TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT"
def expire_after(delta, date=None):
date = date or datetime.now()
return date + delta
def datetime_to_header(dt):
return formatdate(c... |
from moviepy.decorators import apply_to_mask
from .crop import crop
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
#@apply_to_mask
def freeze_region(clip, t=0, region=None, outside_region=None, mask=None):
""" Freezes one region of the clip while the rest remains animated.
Yo... |
"""Tests for display of certificates on the student dashboard. """
import unittest
import ddt
import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from mock import patch
from django.test.utils import override_settings
from xmodule.modulestore.tests.django_utils import ModuleStore... |
# encoding=utf-8
#################################
# Link: http://www.ideawu.net/
#################################
import sys, os, shutil, datetime
import antlr3
import antlr3.tree
from ExprLexer import ExprLexer
from ExprParser import ExprParser
class CpyEngine:
found_files = set()
def find_imports(self, srcfile... |
import sys
import string
import ModeController
import Modes
class ModeControllerCreator:
#if mode_list isn't set in the constructor, the populate_list is going to have to be called before create_controller.
def __init__(self, mode_list=None):
self.mode_list = mode_list or []
#A reference to a ... |
from django.conf import settings
from django.conf.urls import patterns, include, url
from xmodule.modulestore import parsers
# There is a course creators admin table.
from ratelimitbackend import admin
admin.autodiscover()
urlpatterns = patterns('', # nopep8
url(r'^transcripts/upload$', 'contentstore.views.uplo... |
"""Config for classifier INSPIRE module."""
import os
from invenio.config import CFG_PREFIX
CLASSIFIER_MODEL_PATH = os.path.join(CFG_PREFIX, "var/data/classifier/models")
"""
The base path for classifier models used for predictions.
""" |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 02 17:07:02 2017
@author: Colin Drayton
"""
import sys
import nltk
import unicodedata as uniD
import re
# This modul uses python 3.5
# a function that turns tweets into one line tokenized strings
# I wrote this for Doc2vec training but could be useful besides
# the goal ... |
"""Support for interacting with and controlling the cmus music player."""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC, MEDIA_TYPE_PLAYLIST, SUPPORT_NEX... |
from PIL import Image
class Transform(Image.ImageTransformHandler):
def __init__(self, data):
self.data = data
def getdata(self):
return self.method, self.data
def transform(self, size, image, **options):
# can be overridden
method, data = self.getdata()
return im... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y'
TIME_FORMAT = 'G:i'
DATETIME_FORMAT = 'j E Y, G:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.... |
from utils import HTTPException
class RangeParser(object):
def __call__(self, header, file_size):
prefix = "bytes="
if not header.startswith(prefix):
raise HTTPException(416, message="Unrecognised range type %s" % (header,))
parts = header[len(prefix):].split(",")
rang... |
import inspect
import re
from django.apps import apps as django_apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.middleware.csrf import rotate_token
from django.utils.crypto import constant_time_compare
from django.utils.module_loading import i... |
"""
Demo light platform that implements lights.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
import random
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR,
ATTR_WHITE_VALUE, SUPP... |
"""
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... |
# fly ArduPlane QuadPlane in SITL
from __future__ import print_function
import os
import pexpect
import shutil
from pymavlink import mavutil
from common import *
from pysim import util
# get location of scripts
testdir = os.path.dirname(os.path.realpath(__file__))
HOME_LOCATION = '-27.274439,151.290064,343,8.7'
MIS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.