content stringlengths 4 20k |
|---|
#!/usr/bin/env python
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.csvcut import CSVCut
from csvkit.exceptions import ColumnIdentifierError, RequiredHeaderError
class TestCSVCut(unittest.TestCase):
def test_simple(self):
args = ['-c', '1,3', 'examples/dummy.csv']
... |
from rezgui.qt import QtCore, QtGui
from rezgui.util import create_pane
from rezgui.mixins.StoreSizeMixin import StoreSizeMixin
from rezgui.widgets.StreamableTextEdit import StreamableTextEdit
from rezgui.objects.App import app
from threading import Thread, Lock
class ProcessDialog(QtGui.QDialog, StoreSizeMixin):
... |
#!/usr/bin/python
import sys
def generate_tag( ref, xml=False ):
ref_name, match = ref
return "<link rel='"+ ["mismatch","match"][match] + "' href='" + ref_name + "'"+ [">"," />"][xml]
def find_refs(reftest_list):
tests = {}
for entry in reftest_list:
if entry.strip() == '':
continue
split_entry = entry.sp... |
"""
String convert functions
"""
import re
def camelcase(string):
""" Convert string into camel case.
Args:
string: String to convert.
Returns:
string: Camel case string.
"""
string = re.sub(r"^[\-_\.]", '', str(lowercase(string)))
if not string:
return string
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils.common.parameters import list_deprecations
@pytest.fixture
def params():
return {
'name': 'bob',
'dest': '/etc/hosts',
'state': 'present',
'value': 5,
... |
from random import random
import connect_wifi
import ujson
import urequests
import utime
from boot import (
API_KEY,
API_URL,
LAT,
LONG,
PARTICLE_SENSOR,
SSID,
TEMP_HUM_PRESS_SENSOR,
TVOC_CO2_SENSOR,
WIFI_PASSWORD,
)
from i2c import I2CAdapter
from lib import logging
from machine im... |
def __boot():
import sys, os, os.path
PYTHONPATH = os.environ.get('PYTHONPATH')
if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
PYTHONPATH = []
else:
PYTHONPATH = PYTHONPATH.split(os.pathsep)
pic = getattr(sys,'path_importer_cache',{})
stdpath = sys.path[len... |
from django import http
from django.template import (Context, RequestContext,
loader, TemplateDoesNotExist)
from django.views.decorators.csrf import requires_csrf_token
# This can be called when CsrfViewMiddleware.process_view has not run,
# therefore need @requires_csrf_token in case the... |
cmd_names = {
0: 'GO_IDLE_STATE',
# 1: Reserved
2: 'ALL_SEND_CID',
3: 'SEND_RELATIVE_ADDR',
4: 'SET_DSR',
5: 'IO_SEND_OP_COND', # SDIO-only
6: 'SWITCH_FUNC', # New since spec 1.10
7: 'SELECT/DESELECT_CARD',
8: 'SEND_IF_COND',
9: 'SEND_CSD',
10: 'SEND_CID',
11: 'V... |
__all__ = ['OpenType']
class OpenType(object):
"""Create ASN.1 type map indexed by a value
The *OpenType* object models an untyped field of a constructed ASN.1
type. In ASN.1 syntax it is usually represented by the
`ANY DEFINED BY` for scalars or `SET OF ANY DEFINED BY`,
`SEQUENCE OF ANY DEFINED ... |
class ModuleDocFragment(object):
# Documentation fragment for ProxySQL connectivity
CONNECTIVITY = r'''
options:
login_user:
description:
- The username used to authenticate to ProxySQL admin interface.
type: str
login_password:
description:
- The password used to authenticate to Pr... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from . import Filter
__all__ = ['Renko']
class Renko(Filter):
'''Modify the data stream to draw Renko bars (or bricks)
Params:
- ``hilo`` (default: *False*) Use high and low instead of clos... |
"""
Regression tests for Django built-in views.
"""
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
def get_absolute_ur... |
"""
==========================
SGD: convex loss functions
==========================
A plot that compares the various convex loss functions supported by
:class:`sklearn.linear_model.SGDClassifier` .
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def modified_huber_loss(y_true, y_pred):
z ... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class People(models.Model):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self')
class Message(models.Model):
from_field = models.ForeignKey(People, db_column='from_id')
class PeopleData... |
"""make sure that we don't break the physics!"""
def check_physics_all(preds, objects):
return (all(check_physics(pred, objects) for pred in preds)
and check_uniqueness(preds))
def check_uniqueness(preds):
"""Check that we dont want to put two things inside a box or one thing inside two boxes
... |
from openerp import http
from openerp.addons.website_event.controllers.main import website_event
class WebsiteEvent(website_event):
def _validate(self, name, post, force_check=False):
if name in post or force_check:
if name == 'name' and not post.get('name', '').strip():
return... |
# -*- coding:UTF-8 -*- #必须在第一行或者第二行
# -*- coding:gb2312 -*- #必须在第一行或者第二行
# -*- coding:GBK -*- #必须在第一行或者第二行
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full li... |
import re
from django.conf import settings
from django.contrib.gis.db.backends.base.operations import \
BaseSpatialOperations
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gis.db.backends.postgis.pgraster import (
from_pgraster, to_pgraster,
)
from django.contrib... |
"""
raven.contrib.celery
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from celery.signals import after_setup_logger, task_failure
from raven.handlers.logging impor... |
import numpy as np
from ..util.univariate_Gaussian import std_norm_pdf, std_norm_cdf, derivLogCdfNormal, logCdfNormal
from . import link_functions
from .likelihood import Likelihood
class Bernoulli(Likelihood):
"""
Bernoulli likelihood
.. math::
p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1... |
"""
Script for fixing the item not found errors in a course
"""
from django.core.management.base import BaseCommand, CommandError
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum
# To run from command line: ./manage.py cms fix... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.erlang
~~~~~~~~~~~~~~~~~~~~~~
Lexers for Erlang.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions, \
... |
from __future__ import unicode_literals
import logging
import os
import re
from ctypes import CDLL, CFUNCTYPE, c_char_p, c_int
from ctypes.util import find_library
from django.contrib.gis.gdal.error import GDALException
from django.core.exceptions import ImproperlyConfigured
logger = logging.getLogger('django.contri... |
"""Sanity test using validate-modules."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
from .. import types as t
from ..sanity import (
SanitySingleVersion,
SanityMessage,
SanityFailure,
SanitySuccess,
SANITY_ROOT,
)
from ..target ... |
"""Wrapper around tf-slim's training code contrib/slim/python/slim/learning.py
to support training of pruned models
*******************************************************************
* A simple working training script with support for model pruning *
*******************************************************************... |
from pprint import pprint
import inspect
import os
import sys
# datadog
from config import get_checksd_path, get_confd_path
from util import get_os
def run_check(name, path=None):
"""
Test custom checks on Windows.
"""
# Read the config file
confd_path = path or os.path.join(get_confd_path(get_o... |
"""
PackageKit integration.
"""
# Copyright (C) 2010, Aleksey Lim
# See the README file for details, or visit http://0install.net.
import os, sys
import locale
import logging
from zeroinstall import _, SafeException
from zeroinstall.support import tasks, unicode
from zeroinstall.injector import download, model
_log... |
"""Google Cloud Storage error class."""
__author__ = '<EMAIL> (Kathryn Hurley)'
class GcsError(Exception):
"""Exception raised when API call does not return a 20x status.
Attributes:
status: The string status of the HTTP response.
message: A string message explaining the error.
"""
def __init__(sel... |
import cStringIO
import struct
import dns.exception
import dns.inet
import dns.name
class IPSECKEY(dns.rdata.Rdata):
"""IPSECKEY record
@ivar precedence: the precedence for this key data
@type precedence: int
@ivar gateway_type: the gateway type
@type gateway_type: int
@ivar algorithm: the al... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.cnos import cnos_static_route
from .cnos_module import TestCnosModule, load_fixture
from units.modules.utils import set_module_args
class TestCnosStaticRouteModule(... |
# -*- coding: utf-8 -*-
"""Tests for jslex."""
# originally from https://bitbucket.org/ned/jslex
from __future__ import unicode_literals
from django.test import SimpleTestCase
from django.utils.jslex import JsLexer, prepare_js_for_gettext
class JsTokensTest(SimpleTestCase):
LEX_CASES = [
# ids
("... |
#! /usr/bin/env python3
## example_function_name
## ExampleVariableName
import random
## targets based on met office monthly data
## Row Labels Average of rain StdDev of rain StdDevp of rain
## 1 127.425 60.61179013 59.84934732
## 2 89.0475 49.09225218 48.47471499
## 3 ... |
'''
@author: Pedram Amini
@license: GNU General Public License 2.0 or later
@contact: <EMAIL>
@organization: www.openrce.org
'''
import wx
import wx.lib.dialogs
import MySQLdb
class EditReconDlg(wx.Dialog):
def __init__(self, *args, **kwds):
self.parent = kwds["parent"]
... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
parse_duration,
)
class MwaveIE(InfoExtractor):
_VALID_URL = r'https?://mwave\.interest\.me/(?:[^/]+/)?mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0... |
import time
from report import report_sxw
import pooler
def titlize(journal_name):
words = journal_name.split()
while words.pop() != 'journal':
continue
return ' '.join(words)
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(order, self).__init__(cr... |
"""engine.SCons.Tool.cvf
Tool-specific initialization for the Compaq Visual Fortran compiler.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in th... |
from geopy import Point
from geopy.util import NULL_HANDLER
from geopy.parsers.iso8601 import parse_iso8601
import sys, re, logging
from xml.etree import ElementTree
log = logging.getLogger(__name__)
log.addHandler(NULL_HANDLER)
class VersionError(Exception):
pass
class Waypoint(Point):
'''
A `Waypoint`... |
from django.template import VariableNode, Context
from django.template.loader import get_template_from_string
from django.utils.unittest import TestCase
from django.test.utils import override_settings
class NodelistTest(TestCase):
def test_for(self):
source = '{% for i in 1 %}{{ a }}{% endfor %}'
... |
# coding=utf-8
from __future__ import unicode_literals
__loader__ = None
import datetime
import json
import os
import time
import unittest
import sys
try:
from mock import patch
except ImportError:
from unittest.mock import patch
try:
from StringIO import StringIO
except ImportError:
from io import... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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.
... |
import models
from askmath.models.users import Administrator, Teacher, Assistant, Student
from django.contrib.auth.models import Permission
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.db.models import signals
from django.db.models.signals imp... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
vector.py
---------------------
Date : February 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
******************************... |
import re
import os
import pipes
import tempfile
EXAMPLES = r"""
- lineinfile: dest=/etc/selinux/config regexp=^SELINUX= line=SELINUX=enforcing
- lineinfile: dest=/etc/sudoers state=absent regexp="^%wheel"
- lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost' owner=root group=root mode=0644... |
# -*- coding: utf-8 -*-
"""
Pelican Comment System
======================
A Pelican plugin, which allows you to add comments to your articles.
Author: Bernhard Scheirle
"""
from __future__ import unicode_literals
import logging
import os
import copy
logger = logging.getLogger(__name__)
from itertools import chain
f... |
from git.util import (
Actor,
LockedFD,
LockFile,
assure_directory_exists,
to_native_path,
)
from gitdb.util import (
bin_to_hex,
join,
file_contents_ro_filepath,
)
from git.objects.util import (
parse_date,
Serializable,
altz_to_utctz_str,
)
from git.compat import (
PY... |
"""
Home for upgrade-related tests that don't fit in with the core upgrade testing in dtest.upgrade_through_versions
"""
import glob
import os
import re
import time
import pytest
import logging
from cassandra import ConsistencyLevel as CL
from dtest import RUN_STATIC_UPGRADE_MATRIX
from tools.jmxutils import (Jolokia... |
"""Provides device automations for Cover."""
from typing import List
import voluptuous as vol
from homeassistant.components.automation import (
AutomationActionType,
numeric_state as numeric_state_automation,
state as state_automation,
)
from homeassistant.components.device_automation import TRIGGER_BASE_... |
# -*- coding: utf-8 -*-
"""
flask.testsuite.templating
~~~~~~~~~~~~~~~~~~~~~~~~~~
Template functionality
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
class TemplatingTestCase(Flask... |
"""
Cross-validation with MLPs.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
__maintainer__ = "Steven Kearnes"
from pylearn2.models.mlp import Layer, PretrainedLayer
class PretrainedLayerCV(Layer):
"""
Container of PretrainedLayer objec... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate, cstr, get_link_to_form
class LabTest(Document):
def validate(self):
if not self.is_new():
self.set_secondary_uom_result()
def on_submit(self):
self.validate_... |
"""
An OpenFlow 1.0 L2 learning switch implementation.
"""
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0
from ryu.lib.mac import haddr_to_bin
from ryu.lib.packe... |
#!/usr/bin/env python
# This is code is designed to download list of known bad IPs and domains
# Once the lists have been downloaded, 2 reference sets are created
# 1 for IPs and 1 for domains
# Manual creation of QRadar rules are then done. These rules are then run against these
# list to identify known bad IPs and ... |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
from layout.css import *
__all__ = ['html4_default_stylesheet']
# Default stylesheet for HTML 4
# http://www.w3.org/TR/CSS21/sample.html
html4_default_stylesheet = Stylesheet('''
html, address,
blockquote,
body, dd, div,
dl, dt,... |
import os
import sys
import shutil
import tarfile
import hashlib
import argparse
import subprocess
import ssl
import stat
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts"))
from build.common import *
EXTERNAL_DIR = os.path.realpath(os.path.normpath(os.path.dirname(__file__)))
def computeCheck... |
"""Installs an APK.
"""
import optparse
import os
import re
import subprocess
import sys
from util import build_device
from util import build_utils
from util import md5_check
BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(BUILD_ANDROID_DIR)
from pylib import constants
from pylib.... |
"""Document layout engine."""
class Layout:
"""The document layout engine."""
def __init__(self,rect=None):
"""initialize the object with the size of the box."""
self._widgets = []
self.rect = rect
def add(self,e):
"""Add a document element to the layout.
... |
import pickle
from revscoring.datasources import revision_oriented
from revscoring.dependencies import solve
from revscoring.languages import french
from .util import compare_extraction
BAD = [
"anus",
"baise", "baisé",
"baiz",
"batar", "batard",
"bite", "bites", "bitte",
"branler", "branlett... |
################################################################################
# Peach - Computational Intelligence for Python
# Jose Alexandre Nalon
#
# This file: tutorial/norms-conorms.py
# How to use t-norms and s-norms (norms and conorms)
####################################################################... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals
try:
from collections import OrderedDict
except ImportError:
# Python 2.6
... |
"""Command line frontend for Memory Inspector"""
import json
import memory_inspector
import optparse
import os
import time
from memory_inspector import constants
from memory_inspector.classification import mmap_classifier
from memory_inspector.core import backends
from memory_inspector.data import serialization
def... |
"""
Django settings for test_site project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
#... |
"""Generates READMEs using configuration defined in yaml."""
import argparse
import io
import os
import subprocess
import jinja2
import yaml
jinja_env = jinja2.Environment(
trim_blocks=True,
loader=jinja2.FileSystemLoader(
os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates'))))
READ... |
from paste.fixture import *
from paste.exceptions.errormiddleware import ErrorMiddleware
from paste import lint
from paste.util.quoting import strip_html
#
# For some strange reason, these 4 lines cannot be removed or the regression
# test breaks; is it counting the number of lines in the file somehow?
#
def do_reques... |
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "network",
}
import time
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import... |
"""Python representation for Chromium Preferences.
Obtain one of these from a call to PyUITest::GetPrefsInfo() or
PyUITest::GetLocalStatePrefsInfo().
Example:
class MyTest(pyauto.PyUITest):
def testBasic(self):
info = self.GetPrefsInfo() # fetch prefs snapshot
print info.Prefs() # all prefs
print info... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.dalvik
~~~~~~~~~~~~~~~~~~~~~~
Pygments lexers for Dalvik VM-related languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygr... |
# coding=utf-8
__author__ = 'kohlmannj'
import os
import re
from collections import OrderedDict
def get_file_paths(
paths=(),
patterns=None,
recursion_levels=8,
valid_paths=set(),
excluded_paths=set(),
debug=False
):
"""
Given a list of paths, returns two sets of file... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutClassMethods in the Ruby Koans
#
from runner.koan import *
class AboutClassAttributes(Koan):
class Dog(object):
pass
def test_new_style_class_objects_are_objects(self):
# Note: Old style class instances are not objects but they... |
"""Module containing bug report helper(s)."""
from __future__ import print_function
import json
import platform
import sys
import ssl
import idna
import urllib3
import chardet
from . import __version__ as requests_version
try:
from .packages.urllib3.contrib import pyopenssl
except ImportError:
pyopenssl = N... |
from django.contrib import admin
from testmanager.testplanner.models import (
TestRepository,
Maintainer,
OS,
Scope,
Device,
TestPlan,
TestDefinition,
TestDefinitionRevision,
TestPlanTestDefinition
)
admin.site.register(TestRepository)
admin.site.register(Maintainer)
admin.site.regi... |
import json
from flask import Blueprint
from flask import Response
from flask.ext.cors import cross_origin
from pgeo.error.custom_exceptions import PGeoException
from pgeo.utils.filesystem import create_filesystem
filesystem = Blueprint('filesystem', __name__)
@filesystem.route('/')
@cross_origin(origins='*')
def i... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: expect
version_added: '2.0'
short_description: Executes a command and responds to prompts.
description:
- The C(expect) module executes a com... |
# encoding: utf-8
"""
Modulestore configuration for test cases.
"""
import datetime
import pytz
from uuid import uuid4
from mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
from request_cache... |
"""Example Module for testing utils.monkey_patch()."""
CALLED_FUNCTION = []
def example_decorator(name, function):
"""decorator for notify which is used from utils.monkey_patch().
:param name: name of the function
:param function: - object of the function
:returns: function -- decorated... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_system_ipv6_tunnel
except ImportError:
... |
import types
import urllib
import locale
import datetime
import codecs
from decimal import Decimal
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
UnicodeDecodeError.__init__(self, *args)
def __str_... |
"""Unit tests for osinfo_metrics."""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import print_function
import sys
import mock
from chromite.lib import cros_test_lib
from chromite.scripts.sysmon import osinfo_metrics
assert sys.version_info >= (3, 6), 'This module req... |
from __future__ import absolute_import
import unittest
from bokeh.plotting import figure
from bokeh.models.ranges import DataRange1d
class TestGlyphRenderer(unittest.TestCase):
def test_warning_about_colons_in_column_labels_for_axis(self):
invalid_labels = ['0', '1', '2:0']
plot = figure(
... |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.http
~~~~~~~~~~~~~~~~~~~~~~~
HTTP parsing utilities.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import unittest
from datetime import datetime
from werkzeug.testsuite import WerkzeugTestCase
from werkzeug.... |
from __future__ import absolute_import, unicode_literals
import os
from django.core.management import call_command
from django.test import TestCase, TransactionTestCase
from django.test.utils import extend_sys_path
from django.utils._os import upath
from .models import (
ConcreteModel, ConcreteModelSubclass, Con... |
"""Enable pyglet to be used interacively with prompt_toolkit
"""
import sys
import time
from timeit import default_timer as clock
import pyglet
# On linux only, window.flip() has a bug that causes an AttributeError on
# window close. For details, see:
# http://groups.google.com/group/pyglet-users/browse_thread/threa... |
from selenium.common.exceptions import NoSuchElementException
from .base import FunctionalTest, logout_current_user, login_test_user_with_browser
class NewVisitorTest(FunctionalTest):
def test_default_page(self):
# 지훈이는 멋진 게시판 앱이 나왔다는 소식을 듣고
# 해당 웹 사이트를 확인하러 간다.
self.browser.get(self.live... |
from south.tests import Monkeypatcher, skipUnless
from south.modelsinspector import (convert_on_delete_handler, get_value,
IsDefault, models, value_clean)
from fakeapp.models import HorribleModel, get_sentinel_object
on_delete_is_available = hasattr(models, "PROTECT") # models here is django.db.models
skipUnless... |
import sys
try:
import boto3
from botocore.exceptions import ClientError, ParamValidationError, MissingParametersError
HAS_BOTO3 = True
except ImportError:
HAS_BOTO3 = False
# ---------------------------------------------------------------------------------------------------
#
# Helper Functions & ... |
from case9_2_1 import *
class Case9_2_6(Case9_2_1):
DESCRIPTION = """Send binary message message with payload of length 16 * 2**20 (16M)."""
EXPECTATION = """Receive echo'ed binary message (with payload as sent)."""
def init(self):
self.DATALEN = 16 * 2**20
self.PAYLOAD = "\x00\xfe\x2... |
"""Input layer code (`Input` and `InputLayer`).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import context
from tensorflow.python.framework import tensor_shape
from tensorflow.python.keras import backend as K
from tensorf... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
import hr_attendance
import wizard
import report
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# -*- coding: utf-8 -*-
'''
Elysiumtester Add-on
Copyright (C) 2017 Elysiumtester
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... |
"""Tests for TPU InfeedQueue methods."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.tpu.python.tpu import tpu_feed
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorfl... |
import numpy as np
class goodness_test(object):
_tolerance = None
@property
def tolerance(self):
return self._tolerance
@tolerance.setter
def tolerance(self, value):
if value is None:
self._tolerance = None
else:
self._tolerance = np.abs(value) |
"""
List all the available toolboxes so they can be used by the UI.
Dropping a new .py file into this directory will automatically list and load
it into the UI when it is started.
"""
__author__ = 'Bitcraze AB'
__all__ = []
import os
import glob
import logging
logger = logging.getLogger(__name__)
foundToolboxes = ... |
from openerp.osv import fields
from openerp.osv import osv
from openerp.tools.translate import _
class account_analytic_line(osv.osv):
_inherit = 'account.analytic.line'
_description = 'Analytic Line'
_columns = {
'product_uom_id': fields.many2one('product.uom', 'Unit of Measure'),
'product... |
class LoggingInfo(object):
def __init__(self, bucket='', prefix=''):
self.bucket = bucket
self.prefix = prefix
def startElement(self, name, attrs, connection):
return None
def endElement(self, name, value, connection):
if name == 'Bucket':
self.bucket = val... |
import supybot.utils as utils
import supybot.ircdb as ircdb
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Protector')
class Protector(callbacks.Pl... |
#!/bin/env python
"""
Server:
Directory services for
easy_py_messaging - easy messaging client and servers
control_messaging - Control messaging structure
"""
import sys
import os
import time
import zmq
import json
import pickle
import atexit
import logConfig
import platform
import loggingCl... |
#!/usr/bin/env python
from numpy import *
import utilities
import classification
def generate_features(meta_data_train, y_train, meta_data_test):
""" Generates features for classifier. """
# Generate maps.
name_score_map, desc_score_map, caption_score_map, word_score_map = \
generate_text_score_ma... |
import datetime
from dateutil.relativedelta import relativedelta
import logging
from operator import itemgetter
import time
import urllib2
import urlparse
try:
import simplejson as json
except ImportError:
import json # noqa
from openerp.release import serie
from openerp.tools.translate import _
from open... |
# -*- coding: utf-8 -*-
from south.v2 import DataMigration
class Migration(DataMigration):
def forwards(self, orm):
fixtures = [
{
"pk": None,
"model": "detective.searchterm",
"fields": {
"topic": 2,
"na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.