content string |
|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import parse_filesize
class TagesschauIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:[^/]+/)*?[^/#?]+?(?P<id>-?[0-9]+)(?:~_[^/#?]+?)?\.html'
_TESTS = [... |
#!/usr/bin/env python3
# _*_coding:utf-8_*_
# Created by "LiuXin"
# Time
import traceback
import pymongo
# text = """吖】ā[吖嗪](āqín)名有机化合物的一类,呈环状结构,含有一个或几个氮原子,如吡啶、哒嗪、嘧啶等。[英azine]
#
# 【阿】ā〈方〉前缀。①用在排行、小名或姓的前面,有亲昵的意味:~大|~宝|~唐。②用在某些亲属名称的前面:~婆|~爹|~哥。
# 另见2页•ɑ“啊”;354页ē。
#
# 【阿鼻地狱】ābídìyù佛教指最深层的地狱,是犯了重罪的人死后灵魂永远受苦的地方。"""
# fi... |
from flask import Response, request
from galah.web import app, oauth_enabled
from flask.ext.login import current_user
from galah.web.api.commands import api_calls, UserError
from galah.base.crypto.passcrypt import check_seal, deserialize_seal
from galah.db.models import User
from flask.ext.login import login_user
from ... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('KA', 'Karnataka'),
('AP', 'Andhra Pr... |
from nupic.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer
class RandomSweep(BaseExplorer):
"""
This explorer performs randomly-selected horizontal or vertical sweeps, and
it switches to a randomly-selected image in between each sweep.
"""
def __init__(self, sweepDirections=['left', 'right',... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'MailGroupEmail.email'
db.alter_column('dbmail_mailgrou... |
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
os.path.split(parent_dir)[1] == 'pygame')
if not is_pygame_pkg:
sys.pa... |
# -*- coding: utf-8 -*-
import os
import mock
import unittest
from flask import Flask
from nose.tools import * # noqa (PEP8 asserts)
import datetime
from tests.base import OsfTestCase
from tests.factories import RegistrationFactory
from framework.routing import Rule, json_renderer
from framework.utils import secure_... |
import sys
from django.core.management.base import BaseCommand
from ...models import IndicatorPeriod, Keyword, Project
class Command(BaseCommand):
help = 'Script for locking and unlocking periods based on Keyword'
def add_arguments(self, parser):
parser.add_argument(
'action',
... |
#!/usr/bin/env python3
from paramecio.cromosoma.corefields import CharField
from paramecio.citoplasma.slugify import slugify
from paramecio.cromosoma.coreforms import HiddenForm
class SlugifyField(CharField):
def __init__(self, name, size=255, field_related=None, required=False):
super(Slugi... |
import hashlib
import os
import sys
import logging
import requests,time,re,zipfile
from bs4 import BeautifulSoup
PY_VERSION = sys.version_info[0]
if PY_VERSION == 2:
import urllib2
if PY_VERSION == 3:
import urllib.request
def get_hash(file_path):
read_size = 64 * 1024
with open(file_path, 'rb') as f:... |
"""Tools to match goog.scope alias statements."""
# Allow non-Google copyright
# pylint: disable=g-bad-file-header
__author__ = ('<EMAIL> (Nathan Naze)')
import itertools
from closure_linter import ecmametadatapass
from closure_linter import tokenutil
from closure_linter.javascripttokens import JavaScriptTokenType
... |
"""
Contains a convenience function to create a ready-made Smith plot
"""
# Major library imports
from numpy import array, ndarray, transpose, real, imag
from enthought.chaco.array_data_source import ArrayDataSource
from enthought.chaco.data_range_1d import DataRange1D
# Local relative imports
from .smith_mapper imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup as bs
from datetime import date, timedelta, datetime
import re
from suds.client import Client
from ..models import Player
class Comunio:
def __init__(self):
self.client = Client(url='http://www.comunio.es/soapservice.php?wsdl')
... |
{
'name': 'Delivery Costs',
'version': '1.0',
'category': 'Sales Management',
'description': """
Allows you to add delivery methods in sale orders and picking.
==============================================================
You can define your own carrier and delivery grids for prices. When creating
in... |
from collections import defaultdict
import itertools
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon.utils.memoized import memoized # noqa
from openstack_dashboard.api import base
from openstack_dashboard.api import cinder
from openstack_dashboard.a... |
"""Component to interface with switches that can be controlled remotely."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.loader import bind_hass
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.entity import ToggleEntity
from ho... |
#!/usr/bin/env python
import json
from tests.unit import AWSMockServiceTestCase
from boto.beanstalk.layer1 import Layer1
# These tests are just checking the basic structure of
# the Elastic Beanstalk code, by picking a few calls
# and verifying we get the expected results with mocked
# responses. The integration t... |
from django.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
20: 'BigIntegerField',
21: 'SmallIntegerField',
23: 'IntegerField',
25: 'T... |
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
from django import forms
from django.core import exceptions
from django.forms.widgets import MultiWidget
from django.utils.translation import ugettext_lazy as _
__all__ = ['IntegerRangeField', 'FloatRangeField', 'DateTimeRangeField', 'DateRangeField... |
import numbers
from abc import ABCMeta
from itertools import chain
from typing import Any, Optional, Union
import numpy as np
import pandas as pd
from pandas.api.types import CategoricalDtype
from pyspark.sql import functions as F
from pyspark.sql.types import (
ArrayType,
BinaryType,
BooleanType,
Dat... |
#!/usr/bin/env python
from ctypes import *
from ctypes.util import find_library
import sys
# For unix the prefix 'lib' is not considered.
if find_library('svm'):
libsvm = CDLL(find_library('svm'))
elif find_library('libsvm'):
libsvm = CDLL(find_library('libsvm'))
else:
if sys.platform == 'win32':
libsvm = CDLL('... |
from core.Cipher import DES
from hashlib import md5
import hashlib
import base64
import re
import os
'''
PBEWithMD5AndDES port based on
'''
class PBEWithMD5AndDES():
@staticmethod
def get_derived_key(password, salt, count):
key = password + salt
for i in range(count):
m = hashlib.... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
cs_argument_spec,
cs_required_together,
)... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: fetch
short_description: Fetch files from remote nodes
description:
- This module works like M(copy), but in reverse.
- It is used for fetching files from remote machines and storing them locally in ... |
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.contrib.sites import models
from django.contrib.sites.management import create_default_site
from django.contrib.sites.middleware import CurrentSiteMiddleware
from django.contrib.sites.models import Site, c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on October 04, 2018
@author: jakob <<EMAIL>>
'''
from __future__ import print_function
from builtins import next
from builtins import str
from builtins import range
import datetime
import mock
import pytest
from eWRT.ws.wikidata.bundle_wikipedia_requests import co... |
from spacewalk.common.rhnLog import log_debug
from spacewalk.server import rhnSQL
from spacewalk.server.rhnLib import InvalidAction
# the "exposed" functions
__rhnexport__ = ['deploy']
# returns the values for deploying a virtual machine with an image
#
# file_name, checksum, mem_kb, vcpus, imageType
#
def deploy(s... |
"""HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
This is just a copy of the Python 2.2 HMAC module, modified to work when
used on versions of Python before 2.2.
"""
__revision__ = "$Id: HMAC.py,v 1.5 2002/07/25 17:19:02 z3p Exp $"
import strin... |
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class ExtendedServerAttributesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-extended-server-attribute... |
"""
Package upgrade plugin.
"""
import datetime
import gettext
import os
import platform
from otopi import constants as otopicons
from otopi import plugin, transaction, util
from ovirt_engine_setup import constants as osetupcons
from ovirt_setup_lib import dialog
from ovirt_engine_setup import util as osetuputil
d... |
# Configure the test suite from the env variables.
import os
dbname = os.environ.get('PSYCOPG2_TESTDB', 'psycopg2_test')
dbhost = os.environ.get('PSYCOPG2_TESTDB_HOST', None)
dbport = os.environ.get('PSYCOPG2_TESTDB_PORT', None)
dbuser = os.environ.get('PSYCOPG2_TESTDB_USER', None)
dbpass = os.environ.get('PSYCOPG2_T... |
import hashlib
def get_gravatar_id(email: str) -> str:
"""Get the gravatar id associated to an email.
:return: Gravatar id.
"""
return hashlib.md5(email.lower().encode()).hexdigest()
def get_user_gravatar_id(user: object) -> str:
"""Get the gravatar id associated to a user.
:return: Gravat... |
import logging
from django.contrib.gis.db.models.fields import GeometryField
from django.db.utils import OperationalError
from django.db.backends.mysql.schema import DatabaseSchemaEditor
logger = logging.getLogger('django.contrib.gis')
class MySQLGISSchemaEditor(DatabaseSchemaEditor):
sql_add_spatial_index = 'C... |
from six import BytesIO, text_type
from six.moves.urllib.parse import urlparse, parse_qsl
class Request(object):
"""
VCR's representation of a request.
There is a weird quirk in HTTP. You can send the same header twice. For
this reason, headers are represented by a dict, with lists as the values.
... |
from __future__ import division, print_function, absolute_import
from ._ufuncs import _lambertw
def lambertw(z, k=0, tol=1e-8):
r"""
lambertw(z, k=0, tol=1e-8)
Lambert W function.
The Lambert W function `W(z)` is defined as the inverse function
of ``w * exp(w)``. In other words, the value of ``... |
from __future__ import absolute_import, print_function
import sys
if __package__ is None and not hasattr(sys, 'frozen'):
import os.path
path = os.path.realpath(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(os.path.dirname(path)))
if len(sys.argv) > 1 and sys.argv[1] == '--cpuinfo':
# ... |
from __future__ import unicode_literals
from calendar import timegm
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import HttpResponse, Http404
from django.template import loader,... |
#!/usr/bin/env python
"""
@brief A base class for constructing shapes
@author <EMAIL>
"""
from __future__ import print_function
from csg.core import CSG
from csg.geom import Vector
import numpy
DEFAULTS = dict(origin=[0.0, 0.0, 0.0],
lengths=[1.0, 1.0, 1.0],
radius=1.0,
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
gdal2xyz.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
**************... |
"""
Timezone-related classes and functions.
This module uses pytz when it's available and fallbacks when it isn't.
"""
import sys
import time as _time
from datetime import datetime, timedelta, tzinfo
from threading import local
from django.conf import settings
from django.utils import lru_cache, six
from django.util... |
# -*- coding: utf-8 -*-
from lxml import objectify
import time
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment.tests.common import PaymentAcquirerCommon
from openerp.addons.payment_ogone.controllers.main import OgoneController
from openerp.tools i... |
'''
#Cover 22976
based on test_zs_upgd_3.5.2_latest_on_cos74.py
Test the upgrade master from 3.5.2.53 & check API permissions
@author: Zhaohao
'''
import os
import tempfile
import uuid
import time
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_s... |
from unittest import TestCase
from lxml import etree
from pcs_test.tools.assertions import assert_xml_equal
from pcs_test.tools.xml import etree_to_str
from pcs.lib.cib import nvpair
from pcs.lib.cib.tools import IdProvider
# pylint: disable=no-self-use, protected-access
class AppendNewNvpair(TestCase):
def te... |
"""Provides functionality to interact with climate devices."""
from abc import abstractmethod
from datetime import timedelta
import functools as ft
import logging
from typing import Any, Dict, List, Optional
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
PRECISION_TENTHS,
PRE... |
#!/usr/bin/env python
import gevent
import logging
import os
import random
import re
import sys
import time
from gevent import socket
from gevent.event import Event
from gevent.queue import Queue
from logging.handlers import RotatingFileHandler
from optparse import OptionParser
from irc import IRCConnection, IRCBot
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import imp
import os
import sys
import shutil
import six
from migrate import exceptions
from migrate.versioning import version, repository
from migrate.versioning.script import *
from migrate.versioning.util import *
from migrate.tests import fixture
from migrate.tests.f... |
import webbrowser
from xierpa3.components import Theme, Page, Column
from xierpa3.builders.cssbuilder import CssBuilder
from xierpa3.builders.htmlbuilder import HtmlBuilder
from xierpa3.attributes import Em, Margin, Color, Perc
BODYFAMILY = 'Georgia, serif'
class BaseHelloWorldText(Column):
# Get Constants->Co... |
"""Classes for manipulating audio devices (currently only for Sun and SGI)"""
from warnings import warnpy3k
warnpy3k("the audiodev module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
__all__ = ["error","AudioDev"]
class error(Exception):
pass
class Play_Audio_sgi:
# Private instance variables
... |
import logging
import os
import re
import typing
from plumbum import cli
from plumbum import local
from plumbum import cmd
from plumbum import path
from acceptance.common.docker import Compose
from acceptance.common.log import LogExec
from acceptance.common.scion import SCION, SCIONSupervisor
NAME = 'NOT_SET' # mus... |
import pytest
from pootle_app.forms import PermissionsUsersSearchForm
from pootle_app.models.permissions import PermissionSet, get_pootle_permission
@pytest.mark.django_db
def test_form_permissions_users(project0, member, member2):
# must supply a directory
with pytest.raises(KeyError):
PermissionsU... |
"""A collection of modules for iterating through different kinds of
tree, generating tokens identical to those produced by the tokenizer
module.
To create a tree walker for a new type of tree, you need to do
implement a tree walker object (called TreeWalker by convention) that
implements a 'serialize' method taking a ... |
{
'name': "Ricevute Bancarie",
'version': "8.0.1.3.0",
'author': "Odoo Community Association (OCA)",
'category': "Accounting & Finance",
'website': "http://www.odoo-italia.org",
'license': "AGPL-3",
'depends': [
'account_voucher',
'l10n_it_fiscalcode',
'account_due_li... |
#! /usr/bin/env python
"""Test the errno module
Roger E. Masse
"""
import errno
from test import support
import unittest
std_c_errors = frozenset(['EDOM', 'ERANGE'])
class ErrnoAttributeTests(unittest.TestCase):
def test_for_improper_attributes(self):
# No unexpected attributes should be on the modul... |
{
'name': 'Employee Contracts',
'version': '1.0',
'category': 'Human Resources',
'description': """
Add all information on the employee form to manage contracts.
=============================================================
* Contract
* Place of Birth,
* Medical Examination Date
* Compa... |
"""Tests for samba.upgradeprovision that need a DC."""
import os
import re
import shutil
from samba import param
from samba.credentials import Credentials
from samba.auth import system_session
from samba.provision import getpolicypath,find_provision_key_parameters
from samba.upgradehelpers import (get_paths, get_ldbs... |
#!/usr/bin/env python3
"""!
@file
"""
import glob
import sys
import time
# @todo: manage test that have to be checked manually (such as plots)
def analyse_log(filename):
"""!
@brief Analyse a test log to find passed and failed tests
@param filename Name of the log file
@return res @todo doc this
... |
from m5.objects import *
from alpha_generic import *
root = LinuxAlphaFSSystemUniprocessor(mem_mode='timing',
mem_class=DDR3_1600_8x8,
cpu_class=MinorCPU).create_root() |
"""
MPEG audio file parser.
Creation: 12 decembre 2005
Author: Victor Stinner
"""
from hachoir_parser import Parser
from hachoir_core.field import (FieldSet,
MissingField, ParserError, createOrphanField,
Bit, Bits, Enum,
PaddingBits, PaddingBytes,
RawBytes)
from hachoir_parser.audio.id3 import ID3v1, ... |
__author__ = 'sxjscience'
import mxnet as mx
import numpy
import cv2
import logging
import os
from utils import *
from replay_memory import ReplayMemory
from game import Game
from game import DEFAULT_MAX_EPISODE_STEP
logger = logging.getLogger(__name__)
_dirname = os.path.dirname(os.path.realpath(__file__))
_default... |
import os
import platform
import subprocess
try:
import http.client as http_client
except ImportError:
import httplib as http_client
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support.ui import ... |
ALLOW_NONE_HELP = \
"NULL is OK, both for passing and returning"
TRANSFER_NONE_HELP = \
"Don't free data after the code is done"
TRANSFER_FULL_HELP = \
"Free data after the code is done"
TRANSFER_FLOATING_HELP = \
"Alias for transfer none, used for objects with floating refs"
TRANSFER_CONTAINER_HELP = \
"Free data ... |
import struct, difflib, re
def splitnewlines(text):
'''like str.splitlines, but only split on newlines.'''
lines = [l + '\n' for l in text.split('\n')]
if lines:
if lines[-1] == '\n':
lines.pop()
else:
lines[-1] = lines[-1][:-1]
return lines
def _normalizeblocks... |
import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from allauth.socialaccount.providers import registry
from .provider import E... |
import json
import logging
import werkzeug
from datetime import datetime
from math import ceil
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT as DTF
from openerp.tools.safe_eval import safe_e... |
from __future__ import print_function
import paddle.fluid as fluid
import unittest
from ir_memory_optimize_net_base import TestIrMemOptBase
def lstm_net(data,
label,
dict_dim,
emb_dim=128,
hid_dim=128,
hid_dim2=96,
class_dim=2,
... |
"""The nut component."""
from homeassistant.components.sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
)
from homeassistant.const import (
ELECTRICAL_CURRENT_AMPERE,
ELECTRICAL_VOLT_AMPERE,
FREQUENCY_HERTZ,
PERCENTAGE,
POWER_WATT,
TEMP_CELSIUS,
... |
"""Services descriptor definitions.
Contains message definitions and functions for converting
service classes into transmittable message format.
Describing an Enum instance, Enum class, Field class or Message class will
generate an appropriate descriptor object that describes that class.
This message can itself be us... |
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
usage = "perf trace -s syscall-counts.py [comm]\n";
for_comm = None
if len(sys.argv) > 2:
sys.exit(usage)
if len(sys.argv) > 1:
for_comm = ... |
from sword2 import HttpLayer, HttpResponse
from octopus.lib import http
import json
from requests.auth import HTTPBasicAuth
class OctopusHttpResponse(HttpResponse):
def __init__(self, *args, **kwargs):
self.resp = None
if len(args) > 0:
self.resp = args[0]
def __getitem__(self, att... |
"""Tests for Coordinator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import threading
import time
import tensorflow as tf
def StopInN(coord, n_secs):
time.sleep(n_secs)
coord.request_stop()
def RaiseInN(coord, n_secs, ex, report_e... |
"""Utility to decode a crash dump generated by untrusted_crash_dump.[ch]
Currently this produces a simple stack trace.
"""
import argparse
import json
import os
import posixpath
import subprocess
import sys
class CoreDecoder(object):
"""Class to process core dumps."""
def __init__(self, main_nexe, nmf_filename... |
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.aws.core import AnsibleAWSModule
from ansible.module_utils.ec2 import camel_dict_to_snake_... |
"""Standard functions for creating slots.
A slot is a `Variable` created with the same shape as a primary variable or
`Tensor`. A slot is always scoped in the namespace of the primary object and
typically has the same device and type.
Slots are typically used as accumulators to track values associated with
the primar... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
from pants.java.jar.manifest import Manifest
class TestManifest(unittest.TestCase):
def test_isempty(self):
manifest = Manifest()
self.as... |
import os
import shlex
import subprocess
from path import Path
def run(command, shell=False):
""" A convience method for executing all the commands. """
print(command)
if shell is False:
command = shlex.split(command)
output = subprocess.check_output(command, shell=shell)
print(output)
... |
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
import product
class stock_landed_cost(osv.osv):
_name = 'stock.landed.cost'
_description = 'Stock Landed Cost'
_inherit = 'mail.thread'
_track = {
'state': {
's... |
import account_wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import sales_crm_account_invoice_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from django.http import Http404
from django.shortcuts import get_object_or_404, get_list_or_404
from django.test import TestCase
from models import Author, Article
class GetObjectOr404Tests(TestCase):
def test_get_object_or_404(self):
a1 = Author.objects.create(name="Brave Sir Robin")
a2 = Author... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.admin import FieldListFilter
try:
from django.contrib.admin.utils import prepare_lookup_value
except ImportError:
# django < 1.7
from django.contrib.admin.util import prepare_lookup_value
from django.utils.translation impor... |
"""
Support for Apple TV.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.apple_tv/
"""
import asyncio
import logging
import hashlib
import aiohttp
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.componen... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('donors', '0004_auto_20141108_1110'),
]
operations = [
migrations.CreateModel(
name='Donation',
... |
# -*- coding: utf-8 -*-
"""
jinja2.visitor
~~~~~~~~~~~~~~
This module implements a visitor for the nodes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from jinja2.nodes import Node
class NodeVisitor(object):
"""Walks the abstract syntax tree and call visitor functions for every... |
from django.contrib.auth.models import User
from django.test import Client, TestCase
from django.core.urlresolvers import reverse
class RoutesTest(TestCase):
def setUp(self):
self.client = Client()
self.logged_in_client = Client()
self.user = User.objects.create_user("testuser", "<EMAIL>", ... |
# textbox.py
import waxyobject
import wx
import core
import styles
class TextBox(wx.TextCtrl, waxyobject.WaxyObject):
__events__ = {
'Char': wx.EVT_CHAR, # do all controls have this?
'MaxLength': wx.EVT_TEXT_MAXLEN, # alias for TextMaxLen
'Text': wx.EVT_TEXT,
'Tex... |
"""Defines test client behaviors (UNARY/STREAMING) (SYNC/ASYNC)."""
import abc
import threading
import time
from concurrent import futures
from six.moves import queue
import grpc
from src.proto.grpc.testing import messages_pb2
from src.proto.grpc.testing import services_pb2
from tests.unit import resources
from test... |
from chowdren.writers.objects import ObjectWriter
from chowdren.common import get_animation_name, to_c, make_color
from chowdren.writers.events import (ComparisonWriter, ActionMethodWriter,
ConditionMethodWriter, ExpressionMethodWriter, make_table)
from mmfparser.bitdict import BitDict
from mmfparser.data.font i... |
import openerp
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
from openerp.tools.translate import _
class sale_configuration(osv.osv_memory):
_inherit = 'sale.config.settings'
_columns = {
'group_invoice_deli_orders': fields.boolean('Generate invoices after and based on delivery ... |
"""Parser for OSX quarantine sqlite files."""
__program__ = "osx_quarantine.py"
import datetime
import glob
import locale
import sys
from grr.parsers import sqlite_file
class OSXQuarantineEvents(sqlite_file.SQLiteFile):
"""Class for handling the parsing of a OSX quarantine events.
Use as:
c = OSXQua... |
from test.test_support import verbose, have_unicode, TestFailed
import sys
# test string formatting operator (I am not sure if this is being tested
# elsewhere but, surely, some of the given cases are *not* tested because
# they crash python)
# test on unicode strings as well
overflowok = 1
def testformat(formatstr,... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.models import OrganizationMember, OrganizationMemberTeam
from sentry.testutils import TestCase
class ProjectTest(TestCase):
def test_member_set_simple(self):
user = self.create_user()
org = self.create_organization(owner=... |
import re
from core import plugins
class Plugin:
"""Triggering plugin attributes.
Get attributes of the currently running plugin.
This object is generally imported like this:
>>> from api import plugin
The following attributes descriptions include some
examples, based on an imaginative plug... |
import logging
from pip.basecommand import Command
from pip.operations.check import check_requirements
from pip.utils import get_installed_distributions
logger = logging.getLogger(__name__)
class CheckCommand(Command):
"""Verify installed packages have compatible dependencies."""
name = 'check'
usage =... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import os
import warnings
from pip.basecommand import RequirementCommand
from pip.index import PackageFinder
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import RequirementSet
from pip.utils import import_or_r... |
from sensor import Sensor
import botbook_mcp3002 as mcp
class Mq135Sensor(Sensor):
"""docstring for Mq135Sensor"""
def __init__(self):
Sensor.__init__(self)
self.sense_pin1 = 0 # pin 7 rasp
self.gain = float(1 / 1000)
self.gain_plus = 0
self.gaslevel = 0
def re... |
import time
import types
# 3p
import bson
from pymongo import (
MongoClient,
ReadPreference,
uri_parser,
version as py_version,
)
# project
from checks import AgentCheck
DEFAULT_TIMEOUT = 10
class LocalRate:
"""To be used for metrics that should be sent as rates but that we want to send as hist... |
import os
import sys
import unittest
import test.support as test_support
from tkinter import Tcl, TclError
test_support.requires('gui')
class TkLoadTest(unittest.TestCase):
@unittest.skipIf('DISPLAY' not in os.environ, 'No $DISPLAY set.')
def testLoadTk(self):
tcl = Tcl()
self.assertRaises(Tc... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
gdalcalc.py
---------------------
Date : Janaury 2015
Copyright : (C) 2015 by Giovanni Manghi
Email : giovanni dot manghi at naturalgis dot pt
**********... |
"""
The Utils methods.
"""
import socket
from selenium.webdriver.common.keys import Keys
try:
basestring
except NameError:
# Python 3
basestring = str
def free_port():
"""
Determines a free port using sockets.
"""
free_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
free_so... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.