content stringlengths 4 20k |
|---|
# -*- 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 field 'WMSSource.get_feature_type'
db.add_column('lizard_wms_wmssource', 'get_feature_type',
... |
import optparse
import re
import sys
from optparse import OptionParser
# the gcov report follows certain pattern. Each file will have two lines
# of report, from which we can extract the file name, total lines and coverage
# percentage.
def parse_gcov_report(gcov_input):
per_file_coverage = {}
total_coverage ... |
# -----------------------------------------------------------------------------
# hedit.py
#
# Paring of Fortran H Edit descriptions (Contributed by Pearu Peterson)
#
# These tokens can't be easily tokenized because they are of the following
# form:
#
# nHc1...cn
#
# where n is a positive integer and c1 ... cn are ch... |
from gnuradio import gr, gr_unittest, blks2
import rmg, sys
tx_name = "test"
test_data = "unit_test.tdat"
class qa_rmg (gr_unittest.TestCase):
def setUp (self):
self.fg = gr.top_block ()
def tearDown (self):
self.fg = None
def test_001_detect (self):
src_file = gr.file_source(gr... |
from invenio.legacy.dbquery import run_sql
depends_on = ['invenio_release_1_1_0']
def info():
return "crcLIBRARY.type is now mandatory"
def do_upgrade():
run_sql("UPDATE crcLIBRARY SET type='main' WHERE type IS NULL")
create_statement = run_sql('SHOW CREATE TABLE crcLIBRARY')[0][1]
if '`type` varchar... |
import sqlite3 as sql
import pandas as pd
import datetime as d
import make_db as m
date = "%d-%d-%d"
datef = "%Y-%m-%d"
year_end = "%Y-12-31"
year_start = "%Y-01-01"
query = "select * from `%d` where Time between '%s' and '%s'"
def nd(s):
return d.datetime.strptime(s, "%Y-%m-%d").month
def get_ft_t(year, month, d... |
"""Compatibility code for Python 2.1
Currently, this just defines:
- True and False
- object
- isinstance
"""
__revision__ = "$Id$"
__all__ = []
import sys
import __builtin__
# 'True' and 'False' aren't defined in Python 2.1. Define them.
try:
True, False
except NameError:
(True, False) = (1, 0... |
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def title(sel... |
'''
Image Restriction Function File
Description: This file contains all functions for the verifying image restrictions.
'''
import os
import re
import cv2
import yaml
from datetime import datetime
import exifread
import numpy as np
class imgRestFuncs(object):
'Class containing all image restriction functions'
... |
"""
MgmtCenter module
"""
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from ovs.dal.lists.mgmtcenterlist import MgmtCenterList
from ovs.dal.hybrids.mgmtcenter import MgmtCenter
from backend.serializers.serializers import FullSerializer
from rest_framework.exceptions import... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80)
def __str__(self):
return "%... |
"""
Support for RESTful API sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.rest/
"""
import logging
import voluptuous as vol
import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from homeassistant.components.sensor im... |
import user
import key
from boto import handler
import xml.sax
class CompleteMultiPartUpload(object):
"""
Represents a completed MultiPart Upload. Contains the
following useful attributes:
* location - The URI of the completed upload
* bucket_name - The name of the bucket in which the upload
... |
import errno
import re
import os
import sys
import subprocess
# Note that gcc uses unicode, which may depend on the locale. TODO:
# force LANG to be set to en_US.UTF-8 to get consistent warnings.
allowed_warnings = set([
"return_address.c:63",
"kprobes.c:1493",
"rcutree.c:1614",
"af_unix.c:893",
... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import unescapeHTML
class OoyalaIE(InfoExtractor):
_VALID_URL = r'(?:ooyala:|https?://.+?\.ooyala\.com/.*?(?:embedCode|ec)=)(?P<id>.+?)(&|$)'
_TEST = {
# From http://it.slashdot.org/story/13/... |
import numpy as np
import time, os, sys
import matplotlib.pyplot as plt
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/transformations/'))
import utilFunctions as UF
impo... |
"""Patches the compile() to allow enable parallel compilation of C/C++.
build_ext has lots of C/C++ files and normally them one by one.
Enabling parallel build helps a lot.
"""
import distutils.ccompiler
import os
try:
BUILD_EXT_COMPILER_JOBS = int(
os.environ['GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS'])
exce... |
'''
Test cases for pyclbr.py
Nick Mathewson
'''
from test.test_support import run_unittest, import_module
import sys
from types import ClassType, FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(cl... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:... |
import os
import sys
import errno
import time
from datetime import datetime
import filemtime as fmt
import Catche as mP
from xml.dom import minidom
import tarfile
def GetExec():
try:
for names in os.listdir(r'.\CurrentCel/'):
os.remove(r'.\CurrentCel/'+names)
os.removedirs(r'.\Curr... |
"""Tests for the mfa setup flow."""
from homeassistant import data_entry_flow
from homeassistant.auth import auth_manager_from_config
from homeassistant.components.auth import mfa_setup_flow
from homeassistant.setup import async_setup_component
from tests.common import CLIENT_ID, MockUser, ensure_auth_manager_loaded
... |
#imports for thermometer reading
import os
import glob
import time
#imports for gmail reading
import imaplib
import email
# wiringpi numbers
import wiringpi2 as wiringpi
wiringpi.wiringPiSetup()
wiringpi.pinMode(0, 1) # sets WP pin 0 to output
#Find temperature from thermometer
os.system('modprobe w1-gpio')
os.sys... |
from openerp.osv.orm import Model
from openerp.osv import fields
from openerp.addons.email_template.email_template import mako_template_env
class email_template(Model):
_inherit = 'email.template'
def _get_is_template_template(self, cr, uid, ids, fields_name, arg,
context=No... |
import pickle
class __UnProvided():
pass
class ObjectStorage():
def __init__(self, storage):
self.storage = storage
def __delitem__(self, key):
del self.storage[pickle.dumps(key)]
def __getitem__(self, key):
return pickle.loads(self.storage[pickle.dumps(key)])
def __se... |
from datetime import datetime
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
DEFAULT_DATE = datetime(2000, 1, 1)
dag1 = DAG(
dag_id='exit_test_dag',
start_date=DEFAULT_DATE)
dag1_task1 = DummyOperator(
task_id='dummy',
dag=dag1,
owner='airflow') |
from openerp import fields,models
class eq_import_helper(models.Model):
_name = 'eq_import_helper'
ir_model = fields.Many2one('ir.model')
old_id = fields.Integer('Old id')
new_id = fields.Integer('New id') |
# stdlib
from datetime import datetime
import glob
from itertools import groupby
import os
import re
import sys
import time
import traceback
# project
from checks import LaconicFilter
import modules
from util import windows_friendly_colon_split
from utils.tailfile import TailFile
if hasattr('some string', 'partition'... |
import re
import unittest
import subprocess32 as subprocess
import Gaffer
import GafferTest
class StatsApplicationTest( GafferTest.TestCase ) :
def test( self ) :
script = Gaffer.ScriptNode()
script["frameRange"]["start"].setValue( 10 )
script["frameRange"]["end"].setValue( 50 )
script["variables"].addChi... |
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
class ln_price_SSS_times_ln_price_vacant_land(Variable):
"""Multiplication of two zone variables"""
_return_type = "float32"
price_vacant_land = "ln_avg_val_per_unit_vacant_land"
def... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible... |
from random import Random
import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal
from sklearn.utils.testing import (assert_equal, assert_in,
assert_false, assert_true)
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_selec... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
from munch import Munch, unmunchify
HAS_MUNCH = True
except ImportError:
H... |
# coding: utf-8
"""
webencodings.tests
~~~~~~~~~~~~~~~~~~
A basic test suite for Encoding.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from . import (lookup, LABELS, decode, encode, iter_decode, iter_encode,
... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argparse
from goodman_ccd.image_processor import ImageProcessor
def get_args(arguments=None):
parser = argparse.ArgumentParser(description='''Extracts pipeline spectra and
does wavelength cali... |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... |
from oslo_config import cfg
from nova.tests.functional.v3 import api_sample_base
from nova.tests.unit.image import fake
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
... |
"""
Code to hook into the MLP framework
"""
import functools
import inspect
import logging
from theano.compat.six.moves import xrange
from pylearn2.sandbox.rnn.space import SequenceSpace, SequenceDataSpace
from pylearn2.space import CompositeSpace
from pylearn2.utils.track_version import MetaLibVersion
log = logging.... |
import sys
from snf_django.management.utils import pprint_table
from synnefo.lib.ordereddict import OrderedDict
from snf_django.lib.astakos import UserCache
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_AUTH_URL)
from synnefo.db.models import Backend, poole... |
import os, sys
import numpy as np
from optparse import OptionParser
from py_paddle import swig_paddle, DataProviderConverter
from paddle.trainer.PyDataProvider2 import sparse_binary_vector
from paddle.trainer.config_parser import parse_config
"""
Usage: run following command to show help message.
python api_predict.p... |
"""Spelling Corrector.
Copyright 2007 Peter Norvig.
Open source code under MIT license: http://www.opensource.org/licenses/mit-license.php
"""
import re, collections
def words(text): return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.network.nxos.nxos import get_config, load_config
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansible.mo... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para vureel
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
# TODO: Este no tiene captcha, podría funcionar en free
impor... |
"""
Binvox to Numpy and back.
>>> import numpy as np
>>> import binvox_rw
>>> with open('chair.binvox', 'rb') as f:
... m1 = binvox_rw.read_as_3d_array(f)
...
>>> m1.dims
[32, 32, 32]
>>> m1.scale
41.133000000000003
>>> m1.translate
[0.0, 0.0, 0.0]
>>> with open('chair_out.binvox', 'wb') as f:
... m1.write(f)... |
import os
import re
dir_ = 'docs/_posts'
post_filenames = os.listdir(dir_)
for filename in post_filenames:
if filename.endswith('.md'):
fullpath = os.path.join(dir_, filename)
with open(fullpath, mode='r', encoding='utf-8') as f:
contents = f.read()
# truncate filename in l... |
from django.core.exceptions import MultipleObjectsReturned
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.http import HttpRequest
from django.test import TransactionTestCase
from nose.tools impo... |
from django.core.management.base import BaseCommand, CommandError
from xmodule.contentstore.utils import empty_asset_trashcan
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.keys import CourseKey
from .prompt import query_yes_no
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locati... |
from django.db import connection
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_object_permissions = False
supports_anonymous_user = True
# TODO: Model, login attribute name and passwo... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from twisted.internet import reactor, error
from twisted.internet.defer import Deferred, DeferredList, maybeDeferred
from twisted.python import failure
from twisted.trial import unittest
from scrapy.downloadermiddlewares.robotstxt import (RobotsTxtMiddlewar... |
{
'name': 'Long Term Projects',
'version': '1.1',
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'category': 'Project Management',
'images': ['images/project_phase_form.jpeg','images/project_phases.jpeg', 'images/resources_allocation.jpeg'],
'depends': ['project'],
'descrip... |
# SHORT ySubscriptYOffset
# SHORT ySuperscriptXSize
# SHORT ySuperscriptYSize
# SHORT ySuperscriptXOffset
# SHORT ySuperscriptYOffset
# SHORT yStrikeoutSize
# SHORT yStrikeoutPosition
# SHORT sFamilyClass
# BYTE panose[10]
# ULONG ulUnicodeRange1 // Bits 0... |
"""Test HD Wallet keypool restore function.
Two nodes. Node1 is under test. Node0 is providing transactions and generating blocks.
- Start node1, shutdown and backup wallet.
- Generate 110 keys (enough to drain the keypool). Store key 90 (in the initial keypool) and key 110 (beyond the initial keypool). Send funds to... |
"""
French-language mappings for language-dependent features of Docutils.
"""
__docformat__ = 'reStructuredText'
labels = {
'author': 'Auteur',
'authors': 'Auteurs',
'organization': 'Organisation',
'address': 'Adresse',
'contact': 'Contact',
'version': 'Version',
'revision': ... |
"""
PyMF Convex Hull Non-negative Matrix Factorization [1]
CHNMF(NMF) : Class for Convex-hull NMF
quickhull : Function for finding the convex hull in 2D
[1] C. Thurau, K. Kersting, and C. Bauckhage. Convex Non-Negative Matrix
Factorization in the Wild. ICDM 2009.
"""
import numpy as np
from ... |
"""SCons.Tool.ar
Tool-specific initialization for ar (library archive).
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons ... |
from __future__ import (unicode_literals, print_function, division)
import json
import re
import subprocess
try:
from urllib2 import urlopen
except:
from urllib.request import urlopen
from xml.dom import minidom
IETF_TLS_PARAMETERS_WWW = "https://www.ietf.org/assignments/tls-parameters/tls-parameters.xml"
def rf... |
"""
Verify that a link time only dependency will get pulled into the set of built
targets, even if no executable uses it.
"""
import TestGyp
import sys
test = TestGyp.TestGyp()
test.run_gyp('lib_only.gyp')
test.build('lib_only.gyp', test.ALL)
test.built_file_must_exist('a', type=test.STATIC_LIB)
# TODO(bradnelso... |
"""Methods to get information about system DNS servers."""
__author__ = '<EMAIL> (Thomas Stromberg)'
import glob
import os
import subprocess
import sys
import time
if __name__ == '__main__':
sys.path.append('../nb_third_party')
# 3rd party libraries
import dns.resolver
# local libs
import addr_util
MAX_LEASE_AG... |
import cgi
import multiprocessing
import os
import subprocess
import sys
import argparse
import python_utils.jobset as jobset
import python_utils.start_port_server as start_port_server
sys.path.append(
os.path.join(
os.path.dirname(sys.argv[0]), '..', 'profiling', 'microbenchmarks',
'bm_diff'))
im... |
import unittest
import sys
import os.path
sys.path.append(os.path.dirname(__file__) + "/../../..")
import pox.openflow.nicira as nx
from pox.lib.addresses import EthAddr, IPAddr
import pox.openflow.libopenflow_01 as of
class basics_test (unittest.TestCase):
"""
Do some tests on the Nicira extensions
This isn't... |
from __future__ import unicode_literals
import re
from .mtv import MTVServicesInfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
float_or_none,
unified_strdate,
)
class ComedyCentralIE(MTVServicesInfoExtractor):
_VALID_URL = r'''(?x)... |
from django.db import models
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AbstractUser
from django.db.models import signals
from django.conf import settings
from taggit.managers import TaggableManager
from geonode.base.enumerati... |
"""Line Task
$Id: linetask.py 27442 2004-09-03 08:16:55Z shane $
"""
import socket
import time
from zope.server.interfaces import ITask
from zope.interface import implements
class LineTask(object):
"""This is a generic task that can be used with command line
protocols to handle commands in a separate thre... |
__version__=''' $Id: fonts.py 3101 2007-06-04 14:05:14Z rgbecker $ '''
import sys, os
###############################################################################
# A place to put useful font stuff
###############################################################################
#
# Font Mappings
# The b... |
from openerp.modules.registry import RegistryManager
from openerp.osv import osv, fields
import openerp.exceptions
from openerp import tools
import utils
class res_users(osv.osv):
_inherit = 'res.users'
# TODO create helper fields for autofill openid_url and openid_email -> http://pad.openerp.com/web-openid
... |
data = (
'[?]', # 0x00
'[?]', # 0x01
'N', # 0x02
'[?]', # 0x03
'[?]', # 0x04
'a', # 0x05
'aa', # 0x06
'i', # 0x07
'ii', # 0x08
'u', # 0x09
'uu', # 0x0a
'[?]', # 0x0b
'[?]', # 0x0c
'[?]', # 0x0d
'[?]', # 0x0e
'ee', # 0x0f
'ai', # 0x10
'[?]', # 0x11
'[?]', # 0x12
'... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_text, force_text
from django.utils.encoding import python_2_unicode_compatible
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the plac... |
from eventlet import tpool
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
import nova.virt.firewall as base_firewall
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('use_ipv6', 'nova.config')
CONF.import_opt('vpn_image_id', 'nova.config')
try:
import libv... |
# -*- coding: utf-8 -*-
import pytest
import fakeredis
from flask import Flask
from flask.ext.cacheobj import FlaskCacheOBJ, Msgpackable
from flask.ext.cacheobj import set_counter, get_counter, dec_counter, inc_counter
app = Flask(__name__)
cache = FlaskCacheOBJ()
cache.init_app(app)
@pytest.fixture
def app(request... |
# -*- coding: utf-8 -*-
"""
Reconstructing VXX from futures data
author: Jev Kuznetsov
License : BSD
"""
from __future__ import division
from pandas import *
import numpy as np
import os
class Future(object):
""" vix future class, used to keep data structures simple """
def __init__(self,serie... |
from OpenSSL import crypto
from os import path, makedirs, remove
from datetime import datetime
import re
from shutil import copy
import sys
import os
key_dir = 'keys'
index_file = os.path.join(key_dir, 'index.txt')
class SSLCertificateGenerator:
key_dir = None
index_file = None
serial = No... |
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.document import Document
from erpnext.education.api import get_grade
from frappe.utils.pdf import get_pdf
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_formatted_resu... |
"""Treats a decision tree as a representation transformation layer.
A decision tree transformer takes features as input and returns the probability
of reaching each leaf as output. The routing throughout the tree is learnable
via backpropagation.
"""
from __future__ import absolute_import
from __future__ import divis... |
import re
from random import randrange
def test_all_info(app):
users = app.user.get_user_list()
index = randrange(len(users))
user_from_home_page = app.user.get_user_list()[index]
user_from_edit_page = app.user.get_user_info_from_edit_page(index)
assert user_from_home_page.all_phones_from_home_pag... |
"""
Test cases for L{twisted.protocols.haproxy.V1Parser}.
"""
from twisted.trial import unittest
from twisted.internet import address
from .._exceptions import (
InvalidProxyHeader, InvalidNetworkProtocol, MissingAddressData
)
from .. import _v1parser
class V1ParserTests(unittest.TestCase):
"""
Test L{t... |
"""Utility functions used by the bisect tool.
This includes functions related to checking out the depot and outputting
annotations for the Buildbot waterfall.
"""
import errno
import imp
import os
import stat
import subprocess
import sys
DEFAULT_GCLIENT_CUSTOM_DEPS = {
'src/data/page_cycler': 'https://chrome-int... |
import conda_build.conda_interface
import networkx as nx
import conda_build.api
from compute_build_graph import construct_graph
import argparse
import os
from collections import OrderedDict
import sys
try:
from ruamel_yaml import safe_load, safe_dump
except ImportError:
from yaml import safe_load, safe_dump
... |
import sqlalchemy as SA
import tornado.web
import pushmanager.core.db as db
from pushmanager.core.requesthandler import RequestHandler
import pushmanager.core.util
class UndelayRequestServlet(RequestHandler):
@tornado.web.asynchronous
def post(self):
if not self.current_user:
return self.... |
import os
from typing import Dict, Iterable, Optional, Tuple
from repology.logger import Logger
from repology.packagemaker import NameType, PackageFactory, PackageMaker
from repology.parsers import Parser
from repology.parsers.maintainers import extract_maintainers
from repology.transformer import PackageTransformer
... |
from openerp.osv import osv
from openerp.tools.translate import _
class account_state_open(osv.osv_memory):
_name = 'account.state.open'
_description = 'Account State Open'
def change_inv_state(self, cr, uid, ids, context=None):
proxy = self.pool.get('account.invoice')
if context is None:... |
from iomediator import KEY_SPLIT_RE, Key
import common
if common.USING_QT:
from PyKDE4.kdecore import ki18n
from PyKDE4.kdeui import KMenu, KAction
from PyQt4.QtCore import SIGNAL
_ = ki18n
class MacroAction(KAction):
def __init__(self, menu, macro, callback):
KAction.__init__... |
import sys
from oslo.config import cfg
from neutron.openstack.common import log as logging
from neutron.plugins.hyperv.agent import utils
from neutron.plugins.hyperv.agent import utilsv2
# Check needed for unit testing on Unix
if sys.platform == 'win32':
import wmi
hyper_opts = [
cfg.BoolOpt('force_hyperv_u... |
import logging
import jedi
from lib.anaconda_handler import AnacondaHandler
from jedi import refactoring as jedi_refactor
from commands import Doc, Goto, GotoAssignment, Rename, FindUsages
from commands import CompleteParameters, AutoComplete
logger = logging.getLogger('')
class JediHandler(AnacondaHandler):
""... |
"""Support for Cameras with FFmpeg as decoder."""
import asyncio
import logging
from haffmpeg.camera import CameraMjpeg
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
from homeassistant.const import CONF_NA... |
#-*-coding-utf-8-*-
from django.contrib.auth.models import User
from rest_framework import serializers
from biz.idc.models import UserDataCenter
from biz.volume.models import Volume
from biz.instance.serializer import InstanceSerializer
class VolumeSerializer(serializers.ModelSerializer):
user = serializers.Prim... |
"""Download files with progress indicators.
"""
import cgi
import logging
import mimetypes
import os
from typing import Iterable, Optional, Tuple
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
from pip._internal.cli.progress_bars import DownloadProgressProvider
from pip._internal.exceptions impo... |
"""\
Dump the contents of an Avro container to a different format.
WARNING: the 'pickle' and 'json' formats read the whole Avro container
into memory in order to dump it as a single list, so they're **not**
suitable for very large files.
"""
import cPickle
import json
import os
import pprint
import shelve
import warn... |
import asposepdfcloud
from asposepdfcloud.PdfApi import PdfApi
from asposepdfcloud.PdfApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sepcify App SID
api... |
import datetime
import os
import random
from vod_metadata import default_template_path
from vod_metadata.vodpackage import VodPackage
__all__ = ["generate_metadata"]
IMAGE_EXTENSIONS = [".bmp", ".jpg"]
def _check_for_ae(ae_type, movie_name, extensions):
ae_safe = ae_type.replace(' ', '_')
ae_paths = ['{}_{... |
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth.provider import OAuthProvider
class BitbucketAccount(ProviderAccount):
def get_profile_url(self):
return 'http://bitbucket.org/' + self.account.extra_data... |
import mxnet.gluon.data as data
from PIL import Image
import os
import os.path
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def is_image_file(filename):
return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)
def find_classes(d... |
from types import GeneratorType
from django.utils.copycompat import copy, deepcopy
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of t... |
# test_deeplts.py ---
#
# Description:
# Last-Updated: Thu Nov 8 18:00:47 2012 (+0530)
# By: subha
# Update #: 501
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#
#
#
# Change log:
#
#
#
#
# Code:
import unittest
from cell_test_util import SingleCellCurrentStepTest
import t... |
#!/usr/bin/env python
"""
Runs pylint on all contained python files in this directory, printint out
nice colorized warnings/errors without all the other report fluff
"""
from __future__ import print_function
import os
from pylint.lint import Run
__author__ = "Matthew 'MasterOdin' Peveler"
__license__ = "The MIT Licen... |
"""
Support for Envisalink sensors (shows panel info).
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.envisalink/
"""
import logging
from homeassistant.components.envisalink import (EVL_CONTROLLER,
... |
"""Support for Geolocation."""
from datetime import timedelta
import logging
from typing import Optional
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
from homeassistant.helpers.config_validation import ( # noqa
PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE)
from homeassistant.helpers.entity import Entity... |
"""
Postfix mail transport agent related protocols.
"""
import sys
try:
# Python 2
from UserDict import UserDict
except ImportError:
# Python 3
from collections import UserDict
try:
# Python 2
from urllib import quote as _quote, unquote as _unquote
except ImportError:
# Python 3
from u... |
# -*- coding: utf-8 -*-
from framework.auth import Auth
from tests.base import OsfTestCase
from tests.factories import AuthUserFactory, ProjectFactory
class AddonTestCase(OsfTestCase):
"""General Addon TestCase that automatically sets up a user and node with
an addon.
Must define:
- ADDON_SHOR... |
from __future__ import print_function
import email.utils
import fcntl
import io
import os
import pkg_resources
import random
import resource
import socket
import sys
import textwrap
import time
import traceback
import inspect
import errno
import warnings
import cgi
from gunicorn.errors import AppImportError
from guni... |
"""
NephoScale Cloud driver (http://www.nephoscale.com)
API documentation: http://docs.nephoscale.com
Created by Markos Gogoulos (https://mist.io)
"""
import base64
import sys
import time
import os
import binascii
from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import b
from libcloud.utils.py3 import u... |
import jinja2
import json
import os
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
def load_recipe(recipe_id):
filename = os.path.dirname(__file__) + '/r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.