content stringlengths 4 20k |
|---|
"""
Copyright 2014-2015 Rackspace
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 in writing, software... |
from boto.regioninfo import RegionInfo, get_regions
def regions():
"""
Get all available regions for the Amazon CloudSearch service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
import boto.cloudsearch.layer1
return get_regions(
'cloudsearch',
co... |
from openerp import models, fields
import openerp.addons.decimal_precision as dp
class AccountAnalyticLine(models.Model):
_inherit = 'account.analytic.line'
estim_std_cost = fields.Float(string='Estimated Standard Cost',
digits=dp.get_precision('Product Price'))
estim_av... |
import unittest
import logging
import six
from nose.tools import *
from ryu.controller import ofp_event
from ryu.controller.handler import (
set_ev_cls,
MAIN_DISPATCHER,
)
from ryu.lib.packet import vlan, ethernet, ipv4
from ryu.lib.ofp_pktinfilter import packet_in_filter, RequiredTypeFilter
from ryu.lib impo... |
"""Tests for bucketize_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.compiler.tests import xla_test
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
from tensorflow.python.ops import... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Account import Account
class QuickshareCz(Account):
__name__ = "QuickshareCz"
__type__ = "account"
__version__ = "0.05"
__status__ = "testing"
__description__ = """Quickshare.cz account plugin"""
__license__ = "GPLv3"... |
# Tests that work for both bytes and buffer objects.
# See PEP 3137.
import struct
import sys
class MixinBytesBufferCommonTests(object):
"""Tests that work for both bytes and buffer objects.
See PEP 3137.
"""
def marshal(self, x):
"""Convert x into the appropriate type for these tests."""
... |
"""
DAG designed to test what happens when a DAG with pooled tasks is run
by a BackfillJob.
Addresses issue #1225.
"""
from datetime import datetime
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operat... |
import os
from .. import handlers
from ycm import user_options_store
def BuildRequest( **kwargs ):
filepath = kwargs[ 'filepath' ] if 'filepath' in kwargs else '/foo'
contents = kwargs[ 'contents' ] if 'contents' in kwargs else ''
filetype = kwargs[ 'filetype' ] if 'filetype' in kwargs else 'foo'
request = {
... |
from optparse import make_option
from django.conf import settings
from django.core.management.commands.runserver import Command as RunserverCommand
from django.contrib.staticfiles.handlers import StaticFilesHandler
class Command(RunserverCommand):
option_list = RunserverCommand.option_list + (
make_opti... |
"""Support for Awair sensors."""
from typing import Callable, List, Optional
from python_awair.devices import AwairDevice
import voluptuous as vol
from homeassistant.components.awair import AwairDataUpdateCoordinator, AwairResult
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.config_e... |
"""
FPD - FreeTextBlock
can render and process FreeTextIdevices as XHTML
"""
import logging
from exe.webui.block import Block
from exe.webui.element import TextAreaElement
from exe.webui import common
log = logging.getLogger(__name__)
# ======================================... |
"""
Creation, renaming and deletion configuration testcases
List of tested functions :
--------------------------
- [createDomain] function
- [deleteDomain] function
Test cases :
------------
- Testing nominal cases
- Testing domain creation error
- Testing domain deletion error
"""
import os
fro... |
from huxley.api import tests
from huxley.api.tests import auto
from huxley.utils.test import models
class CountryDetailGetTestCase(auto.RetrieveAPIAutoTestCase):
url_name = 'api:country_detail'
@classmethod
def get_test_object(cls):
return models.new_country()
def test_anonymous_user(self):
... |
from operator import itemgetter
import time
from openerp.osv import fields, osv
from openerp import api
class account_fiscal_position(osv.osv):
_name = 'account.fiscal.position'
_description = 'Fiscal Position'
_order = 'sequence'
_columns = {
'sequence': fields.integer('Sequence'),
'n... |
import httplib
import json
import decimal
import re
decimal.getcontext().rounding = decimal.ROUND_DOWN
exps = [decimal.Decimal("1e-%d" % i) for i in range(16)]
btce_domain = "btc-e.com"
all_currencies = ("btc", "usd", "rur", "ltc", "nmc", "eur", "nvc",
"trc", "ppc", "ftc", "xpm")
all_pairs = ("btc_... |
"""Utility functions specifically for NMT."""
from __future__ import print_function
from tpu.utils import misc_utils as utils
__all__ = ["get_translation"]
def get_translation(nmt_outputs, tgt_eos, subword_option):
"""Given batch decoding outputs, select a sentence and turn to text."""
if tgt_eos: tgt_eos = tgt... |
"""Support for PlayStation 4 consoles."""
import logging
import os
from pyps4_2ndscreen.ddp import async_create_ddp_endpoint
from pyps4_2ndscreen.media_art import COUNTRIES
import voluptuous as vol
from homeassistant.components.media_player.const import (
ATTR_MEDIA_CONTENT_TYPE,
ATTR_MEDIA_TITLE,
MEDIA_T... |
from chirp.drivers import icf
from chirp import chirp_common, directory, bitwise
# memory nuber:
# 000 - 999 regular memory channels (supported, others not)
# 1000 - 1049 scan edges
# 1050 - 1249 auto write channels
# 1250 call channel (C0)
# 1251 call channel (C1)
MEM_FORMAT = """
struct {
ul32 freq;
ul32 o... |
# -*- coding: utf-8 -*-
"""
pygments.styles.colorful
~~~~~~~~~~~~~~~~~~~~~~~~
A colorful style, inspired by CodeRay.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, ... |
from unittest import mock, TestCase
from pcs.cli.booth import env
from pcs.common import report_codes, env_file_role_codes
from pcs.lib.errors import LibraryEnvError, ReportItem
from pcs.test.tools.misc import create_setup_patch_mixin
SetupPatchMixin = create_setup_patch_mixin(env)
class BoothConfTest(TestCase, Setu... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'community'}
# import cloudstack common
from ansible.module_utils.cloudstack import *
class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
def __init__(self, module):
... |
import datetime
from flexget.manager import Session
from flexget.plugins.filter.timeframe import EntryTimeFrame
def age_timeframe(**kwargs):
with Session() as session:
session.query(EntryTimeFrame).update(
{'first_seen': datetime.datetime.now() - datetime.timedelta(**kwargs)}
)
clas... |
#!/usr/bin/python2
"""This script use the nearest marker to the transcript as control, increasing permutation rounds according to the p-value"""
########################################################################
# Last Updated Sep 27, 2011 by Xiaodong
# This version fix the bug that incorrectly exclude the first ... |
"""Add License headers to all py files."""
import fnmatch
import os
import inspect
import sys
import c7n
header = """\
# Copyright 2017 Capital One Services, LLC
#
# 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 c... |
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([
"alignment.c:327",
"mmu.c:602",
"return_address.c:62",
])
# Capture the name of th... |
from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
from .base import Database
try:
import pytz
except ImportError:
pytz = None
class DatabaseFeatures(BaseDatabaseFeatures):
empty_fetchmany_value = ()
update_can_self_select = False
... |
"""
API related to providing field overrides for individual students. This is used
by the individual custom courses feature.
"""
import json
import logging
from django.db import transaction, IntegrityError
from courseware.field_overrides import FieldOverrideProvider # pylint: disable=import-error
from opaque_keys.e... |
{
'name' : 'Fleet Management',
'version' : '0.1',
'author' : 'OpenERP S.A.',
'sequence': 110,
'category': 'Managing vehicles and contracts',
'website' : 'https://www.odoo.com/page/fleet',
'summary' : 'Vehicle, leasing, insurances, costs',
'description' : """
Vehicle, leasing, insurances,... |
import importlib
import inspect
class Field(object):
def __init__(self, field_name):
self.field_name = field_name
def get(self, obj):
return getattr(obj, self.field_name)
class RelatedViewField(Field):
def __init__(self, field_name, operator_view_class):
super(RelatedViewField, ... |
#!/usr/bin/env python
from Tkinter import *
import tkFileDialog
import data_analyzer
class App:
def __init__(self, master):
# initializing variables
self.filepath_open = None
frame_1 = Frame(master)
frame_2 = Frame(master)
frame_3 = Frame(master)
frame_4 = Frame(mast... |
#!/usr/bin/env python
"""convexhull.py
Calculate the convex hull of a set of n 2D-points in O(n log n) time.
Taken from Berg et al., Computational Geometry, Springer-Verlag, 1997.
Prints output as EPS file.
When run from the command line it generates a random set of points
inside a square of given length and finds... |
""" Run the unit tests for Signal """
from __future__ import absolute_import
import copy
import operator
import random
import sys
from random import randrange
import pytest
from myhdl import Signal, intbv
from myhdl._compat import long
from myhdl._simulator import _siglist
random.seed(1) # random, but deterministi... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 in wr... |
''' Implements handler for /menus
Imported from handler for /restaurants/{id} '''
import os, os.path, json, logging, mysql.connector
import cherrypy
from jinja2 import Environment, FileSystemLoader
from menuid import MenuID
env = Environment(loader=FileSystemLoader(os.path.abspath(os.path.dirname(__file__))+'/templ... |
#!/usr/bin/env python
from xml.sax.saxutils import escape, quoteattr
from emit import Emit
from param import known_param_fields, known_units
# Emit APM documentation in an machine readable XML format
class XmlEmit(Emit):
def __init__(self):
Emit.__init__(self)
wiki_fname = 'apm.pdef.xml'
... |
import logging
import os
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
class Command(BaseCommand):
help = 'Discover and run tests in the specified modules or the current directory.'
requires_system_checks = False
... |
import os, string
codecs = {
'cn': ('gb2312', 'gbk', 'gb18030', 'hz'),
'tw': ('big5', 'cp950'),
'hk': ('big5hkscs',),
'jp': ('cp932', 'shift_jis', 'euc_jp', 'euc_jisx0213', 'shift_jisx0213',
'euc_jis_2004', 'shift_jis_2004'),
'kr': ('cp949', 'euc_kr', 'johab'),
'iso2022': ('iso2022_j... |
from .common import BaseTest
class TestOpsworksCM(BaseTest):
def test_query_CM(self):
factory = self.replay_flight_data("test_opswork-cm_query")
p = self.load_policy(
{"name": "get-opswork-cm", "resource": "opswork-cm"},
session_factory=factory,
)
resources... |
from openerp.osv import fields, orm
class ProjectIssue(orm.Model):
_inherit = 'project.issue'
_columns = {
'department_id': fields.many2one('hr.department', 'Department'),
}
def on_change_project(self, cr, uid, ids, proj_id=False, context=None):
"""When Project is changed: copy it's D... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings, override_settings
from django.utils impor... |
"""
Plot the scaling of the nearest neighbors algorithms with k, D, and N
"""
from time import time
import numpy as np
import pylab as pl
from matplotlib import ticker
from sklearn import neighbors, datasets
def get_data(N, D, dataset='dense'):
if dataset == 'dense':
np.random.seed(0)
return np.... |
import functools
import sys
import threading
import warnings
from collections import Counter, OrderedDict, defaultdict
from functools import partial
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from .config import AppConfig
class Apps:
"""
A registry that stores the configura... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class res_users(osv.Model):
""" Update of res.users class
- if adding groups to an user, check if base.group_user is in it
(member of 'Employee'), create an employee form linked to it.
"""
_name = 'res.users'
_in... |
from collections import deque
import numpy as np
class ODE:
def __init__(
self, fcn, t, y, tend=None, backwards=False,
params=None, order=8, reltol=None, abstol=None,
init_stepsize=None, max_stepsize=None,
num_steps=100000, num_stiff=1000, num_dense=None,
safe=None, fac1=No... |
"""Test accelerometer device."""
import math
from mpf.tests.MpfTestCase import MpfTestCase
class TestAccelerometer(MpfTestCase):
def __init__(self, methodName):
super().__init__(methodName)
# this is the first test. give it some more time
self.expected_duration = 2
def get_config_fi... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
o... |
"""Test case for checking creation of two VM's with same name on VMWare"""
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
ServiceOffering,
... |
import contextlib
import os
import shutil
import stat
import sys
try:
import ConfigParser as configparser
except ImportError:
import configparser
@contextlib.contextmanager
def open_config(filename):
if sys.version_info >= (3, 2):
cfg = configparser.ConfigParser()
else:
cfg = ... |
import plotly
import plotly.plotly as py
import pandas as pd
from plotly.widgets import GraphWidget
from IPython.html import widgets
from IPython.display import display, clear_output
import numpy as np
py.sign_in('dswbtest', 'ci8iu7p6wi') #plotly API credentials
food = pd.read_csv("supply.csv")
# Definition of a f... |
from .nodes import *
import ply.yacc as yacc
# lex & yacc transform the popeye output into a list of Nodes
# the final rule - BuildTree - transforms this list into a tree
def p_BuildTree(t):
'BuildTree : Solution'
t[1][0].unflatten(t[1], 1)
t[1][0].linkContinuedTwins()
t[0] = t[1][0]
def p_Solution... |
import certifi
import db
import json
import os
import pytz
import random
import re
import requests
import string
from datetime import datetime, timedelta
from distutils.util import strtobool
from netifaces import ifaddresses, gateways
from os import getenv, path, utime
from platform import machine
from settings import... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import autoslug.fields
import django.core.files.storage
import inventory.models
import courselib.json_fields
class Migration(migrations.Migration):
dependencies = [
('outreach', '0001_initial'),
('coredata', '0014_auto_20160623_15... |
from __future__ import absolute_import
from collections import namedtuple
from ..exceptions import LocationParseError
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
class Url(namedtuple('Url', url_attrs)):
"""
Datastructure for representing an HTTP URL. Used as a return value f... |
"""The Tornado web server and tools."""
from __future__ import absolute_import, division, print_function
# version is a human-readable version number.
# version_info is a four-tuple for programmatic comparison. The first
# three numbers are the components of the version number. The fourth
# is zero for an official ... |
"""
Notify windows.
Copyright (c) 2013 - 2016 Isaac Muse <<EMAIL>>
License: MIT
"""
import traceback
import winsound
import ctypes
import ctypes.wintypes as wintypes
import os
__all__ = ("get_notify", "alert", "setup", "windows_icons", "destroy")
if ctypes.sizeof(ctypes.c_long) == ctypes.sizeof(ctypes.c_void_p):
... |
""" Management command to update courses' search index """
import logging
from textwrap import dedent
from django.core.management import BaseCommand, CommandError
from elasticsearch import exceptions
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import ... |
"""
Setup module for the utilbox package.
"""
import setuptools
from utilbox import __conf__
def read_file(file_path):
with open(file_path, "r") as target_file:
return target_file.read()
# retrieve information from package files
package_version = __conf__.config_map["version"]
package_requirements =... |
from ..message_server import Message, ClosingMessage
from ..interaction import instantiate
from ..network_error import NetworkError
class HelloMessage(Message):
"""
Let's name ourselves!
"""
def __init__(self, name=""):
Message.__init__(self)
self.name = name
def __setstate__(self... |
"""
Copyright (C) 2010-2013, Ryan Fan
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.
This program is distribute... |
# -*- coding: utf-8 -*-
from urllib import urlencode
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.tools.mail import html_sanitize
class WebsiteEmailDesigner(http.Controller):
@http.route('/website_mail/email_designer', type='http', auth="user", website=True)
... |
#!
# -*- coding: utf_8 -*-
"""
╔════════════════════════════════════════════════════════════════════════════════════╗
║ ║
║ Copyright (c) 2020 https://prrvchr.github.io ║
║ ... |
#!/usr/bin/env python
"""
For each argument on the command line, look for it in the set of all Unicode
names. Arguments are treated as case-insensitive regular expressions, e.g.:
% find-uname 'small letter a$' 'horizontal line'
*** small letter a$ matches ***
LATIN SMALL LETTER A (97)
COMBINING LATIN... |
from time import sleep
from datetime import timedelta
from airflow.exceptions import AirflowException, AirflowSensorTimeout, \
AirflowSkipException, AirflowRescheduleException
from airflow.models import BaseOperator
from airflow.models.skipmixin import SkipMixin
from airflow.models.taskreschedule import TaskResche... |
{
'name' : 'Procurements',
'version' : '1.0',
'author' : 'OpenERP SA',
'website' : 'http://www.openerp.com',
'category' : 'Hidden/Dependency',
'depends' : ['base', 'product'],
'description': """
This is the module for computing Procurements.
==============================================
In... |
from django.core.urlresolvers import reverse, NoReverseMatch
from pyquery import PyQuery as pq
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon
class TestManagement(TestCase):
fixtures = ['base/addon_3615',
'tags/tags.json']
def test_tags_details_view(self):
... |
#re!/usr/bin/env python3
import csv
import sys
from datetime import datetime
from pathlib import Path
monocle_dir = Path(__file__).resolve().parents[1]
sys.path.append(str(monocle_dir))
from monocle.accounts import get_accounts
accounts_file = monocle_dir / 'accounts.csv'
try:
now = datetime.now().strftime("%... |
from __future__ import print_function
from TestBase import TestBaseClass
import sys
def replace(pre, post, main_cmd_list):
if pre:
pre = pre + ' && '
else:
pre = ''
if post:
post = ' && ' + post
else:
post = ''
return [ pre + main_cmd + post for main_cmd in main_cmd_... |
import unittest
import ctypes
from ctypes.test import need_symbol
import _ctypes_test
@need_symbol('c_wchar')
class UnicodeTestCase(unittest.TestCase):
def test_wcslen(self):
dll = ctypes.CDLL(_ctypes_test.__file__)
wcslen = dll.my_wcslen
wcslen.argtypes = [ctypes.c_wchar_p]
self.... |
#!/usr/bin/env python
# This script simply downloads waf to the current directory
from __future__ import print_function
import os, sys, stat, hashlib, subprocess
WAFRELEASE = "waf-1.8.12"
WAFURLS = ["https://waf.io/" + WAFRELEASE,
"http://www.freehackers.org/~tnagy/release/" + WAFRELEASE]
SHA256HASH... |
# -*- encoding: utf-8 -*-
import unittest2
from openerp.tests.common import TransactionCase
from .. import models
ID_FIELD = {
'id': 'id',
'name': 'id',
'string': "External ID",
'required': False,
'fields': [],
}
def make_field(name='value', string='unknown', required=False, fields=[]):
retur... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
err = open('err.log', 'a')
err = sys.stderr
def enc_print(string='', encoding='utf8'):
sys.stdout.buffer.write(string.encode(encoding) + b'\n')
def get_content(path):
content = ""
with open(path) as content_file:
content = co... |
from forms import Form
from django.core.exceptions import ValidationError
from django.utils.encoding import StrAndUnicode
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from fields import IntegerField, BooleanField
from widgets import Media, HiddenInput
from util import... |
"""
Functional tests for checking PyOWM caching features
"""
import unittest
from time import time
from pyowm.webapi25.configuration25 import parsers
from pyowm.webapi25.owm25 import OWM25
from pyowm.caches.lrucache import LRUCache
from pyowm.abstractions.owmcache import OWMCache
class CacheWrapper(OWMCache):
""... |
'''
Created on Sep 11, 2014
@author: moloyc
'''
import unittest
from flexmock import flexmock
from jnpr.openclos.ztp import ZtpServer
from test_model import createPod, createDevice, createPodDevice, LeafSetting
from test_dao import InMemoryDao
class TestZtp(unittest.TestCase):
def setUp(self):
self.__c... |
""""Processes a log file and resolves IPC message identifiers.
Resolves IPC messages of the form [unknown type NNNNNN] to named IPC messages.
e.g. logfile containing
I/stderr ( 3915): ipc 3915.3.1370207904 2147483647 S [unknown type 66372]
will be transformed to:
I/stderr ( 3915): ipc 3915.3.1370207904 214748364... |
"""Backup Dropbox Business files.
See README.md for full instructions.
"""
import argparse
from datetime import date, datetime
from concurrent.futures import ThreadPoolExecutor
from functools import partial
import json
import logging
import logging.config
import os
import re
import string
import sys
import time
from ... |
__author__ = 'Chris Lewis'
__version__ = '0.1.0'
__email__ = '<EMAIL>'
import sys
import json
import maya.cmds as mc
from maya.OpenMaya import *
from maya.OpenMayaMPx import *
kPluginTranslatorTypeName = 'Three.js'
kOptionScript = 'ThreeJsExportScript'
kDefaultOptionsString = '0'
FLOAT_PRECISION = 8
# adds decima... |
"""
Higher order functions built on the BlockStructureManager to interact with a django cache.
"""
from django.core.cache import cache
from xmodule.modulestore.django import modulestore
from .manager import BlockStructureManager
def get_course_in_cache(course_key):
"""
A higher order function implemented on ... |
import mock
from neutron import context
from neutron.openstack.common import uuidutils
from neutron.plugins.nec.common import config
from neutron.plugins.nec.db import api as ndb
from neutron.plugins.nec import ofc_manager
from neutron.tests.unit import testlib_api
class FakePortInfo(object):
def __init__(self, ... |
#!/usr/bin/env python2.7
import os
from time import sleep, time
import socket
from dt_utils.status import read_status
import redis
import cPickle as pickle
import struct
hostname = socket.gethostname()
if '.' in hostname:
hostname = hostname[:hostname.find('.')]
INTERVAL = 10
GRAPHITE_HOST = 'graphite'
GRAPHI... |
import os, requests, logging
def send_metric(measurement, tags, values, num_retries=0, must_succeed=False):
url = os.environ.get("DPP_INFLUXDB_URL")
db = os.environ.get("DPP_INFLUXDB_DB")
if tags and url and db:
line_tags = ",".join(["{}={}".format(k, v) for k, v in tags.items()])
line_valu... |
#!/usr/bin/env python
# example aspectframe.py
import pygtk
pygtk.require('2.0')
import gtk
class AspectFrameExample:
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL);
window.set_title("Aspect Frame")
window.connect("destroy", lambda x: gtk.main_quit())
window.set_bord... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_pim_rp_address
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosPimRpAddressModule(TestNxosModule):
... |
import os
import os.path
from subprocess import Popen, PIPE, call
import re
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
LOCALE_NORMALIZATION = {
".utf8": ".UTF-8",
".eucjp": ".EUC-JP",
".iso885915": ".ISO-8859-15",
".cp1251": ".CP1251",
".koi8... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
from django.conf import settings
import model_utils.fields
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
... |
# coding: utf-8
"""
:mod:`boardgamegeek.utils` - Generic helper functions
=====================================================
.. module:: boardgamegeek.utils
:platform: Unix, Windows
:synopsis: generic helper functions
.. moduleauthor:: Cosmin Luță <<EMAIL>>
"""
from __future__ import unicode_literals
import... |
import sys
import os
import marshal
import imp
import struct
import time
import unittest
import zlib # implied prerequisite
from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED
from test import test_support
from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co
import zipimport
import ... |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
#
# All Plot3D scalar functions
#
# Create the RenderWindow, Renderer and both Actors
#
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renW... |
import unittest
import six
from scrapy.spiders import Spider
from scrapy.http import Request, Response
from scrapy.item import Item, Field
from scrapy.logformatter import LogFormatter
class CustomItem(Item):
name = Field()
def __str__(self):
return "name: %s" % self['name']
class LoggingContribTe... |
from __future__ import unicode_literals
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.projects.doctype.time_log.time_log import OverlapError
from erpnext.projects.doctype.time_log.time_log import NotSubmittedError
from erpnext.manufacturing.doctype.workstation.workstation import ... |
"""
Info:
This tests DeviceManagerADB with a real device
Requirements:
- You must have a device connected
- It should be listed under 'adb devices'
Notes:
- Not all functions have been covered.
In particular, functions from the parent class
- No testing of properties is done
- The test ca... |
from pyspark import SparkContext, SparkConf, SparkFiles
from pyspark.sql import SQLContext, Row
from subprocess import Popen, PIPE
from datetime import datetime
import os
import sys
from md_description import md_description
from gromacs_utils import check_file_exists
from os_utils import make_directory, preparing_path,... |
import base64
import operator
import time
import urllib
try:
from hashlib import md5 as _md5
except ImportError:
import md5
_md5 = md5.new
from django.db.models.query import Q
from django.conf import settings
from openid.association import Association as OIDAssociation
import openid.store.interface
impo... |
"""
Helpers for quality checks tests.
"""
from django.test import TestCase
import uuid
class MockLanguage(object):
'''
Mock language object.
'''
def __init__(self, code='cs'):
self.code = code
class MockProject(object):
'''
Mock project object.
'''
def __init__(self):
... |
__author__ = 'Thomas Rueckstiess, <EMAIL>, Tom Schaul'
from scipy import ones, zeros, dot, ravel, random
from scipy.linalg import pinv
from pybrain.auxiliary import GradientDescent
from pybrain.optimization.optimizer import ContinuousOptimizer
class FiniteDifferences(ContinuousOptimizer):
""" Basic finite diffe... |
from setuptools import setup, find_packages
NAME = "autorestswaggerbatdictionaryservice"
VERSION = "1.0.0"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
REQUIRES = ["msrest>=0.2.0"]
setup(
name=NAME,
version=VERS... |
{
'name': 'UK - Accounting',
'version': '1.0',
'category': 'Localization/Account Charts',
'description': """
This is the latest UK OpenERP localisation necessary to run OpenERP accounting for UK SME's with:
=================================================================================================... |
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.... |
from Products.Archetypes.atapi import *
from Products.ATContentTypes.content.image \
import ATImage as BaseClass
from Products.ATContentTypes.content.image \
import ATImageSchema as DefaultSchema
from Products.ATContentTypes.content.base import registerATCT
from ubify.coretypes.config import PROJECTNAME
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.