content string |
|---|
'''
A discord bot for scouting in Love Live: School Idol Festival.
'''
import sys
from asyncio import get_event_loop
from json import load
from time import time
from threading import Thread
from commands import *
from bot import HahaNoUR, get_session_manager
from bot.logger import setup_logging
from config import conf... |
"""Does scraping for all known versions of IE."""
import pywintypes
import time
import types
from drivers import keyboard
from drivers import mouse
from drivers import windowing
# Default version
version = "7.0.5730.1"
DEFAULT_PATH = r"c:\program files\internet explorer\iexplore.exe"
def GetBrowser(path):
"""Inv... |
import re
from collections import namedtuple
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
field_size_re = re.compile(r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$')
FieldInfo = namedtuple('FieldInfo', FieldInfo._fields + ('default',))
def get_field_size(name)... |
"""Installation script for Python nupic package."""
import os
import pkg_resources
import sys
from setuptools import setup, find_packages, Extension
from setuptools.command.test import test as BaseTestCommand
REPO_DIR = os.path.dirname(os.path.realpath(__file__))
def getVersion():
"""
Get version from local... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.tcl
~~~~~~~~~~~~~~~~~~~
Lexers for Tcl and related languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, words
from pygments.token import... |
from . import utils
content_types = utils.invert_dict({"text/html": ["htm", "html"],
"application/json": ["json"],
"application/xhtml+xml": ["xht", "xhtm", "xhtml"],
"application/xml": ["xml"],
... |
#!/usr/bin/python
# Compile document to HTML use docutils.
# ========================================
# Pygments syntax highlighting
# ========================================
from pygments.formatters import HtmlFormatter
# Set to True if you want inline CSS styles instead of classes
INLINESTYLES = True
from pygment... |
from __future__ import absolute_import, print_function
from bitfield import BitField
from django.db import models
from django.utils import timezone
from jsonfield import JSONField
from sentry.db.models import (
BoundedPositiveIntegerField, FlexibleForeignKey, Model, sane_repr
)
class AuthProvider(Model):
__... |
import os
import os.path
import re
import sys
import time
import threading
class Reloader(threading.Thread):
def __init__(self, extra_files=None, interval=1, callback=None):
super(Reloader, self).__init__()
self.setDaemon(True)
self._extra_files = set(extra_files or ())
self._extra... |
import frappe
from frappe.utils import money_in_words
def execute():
company_currency = dict(frappe.db.sql("select name, default_currency from `tabCompany`"))
bank_or_cash_accounts = frappe.db.sql_list("""select name from `tabAccount`
where account_type in ('Bank', 'Cash') and docstatus < 2""")
for je in frappe.... |
# -*- coding: utf-'8' "-*-"
import hashlib
import hmac
import logging
import time
import urlparse
from openerp import api, fields, models
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_authorize.controllers.main import AuthorizeController
from openerp.tools.floa... |
import configparser
import gist
import pytest
@pytest.fixture
def config():
cfg = configparser.ConfigParser()
cfg.add_section("gist")
return cfg
def test_get_value_from_command():
"""
Ensure that values which start with ``!`` are treated as commands and
return the string printed to stdout b... |
"""Implementation of :class:`AlgebraicField` class. """
from __future__ import print_function, division
from sympy.polys.domains.field import Field
from sympy.polys.domains.simpledomain import SimpleDomain
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy.polys.polyclasses import ANP
f... |
# -*- coding: utf-8 -*-
def setupCV(cameraMatrixFile, distortionCoefsFile):
"""
Load camera matrix and distortion coefficients.
Function to load the camera matrix and distortion coefficients
from saved files and returning them in the proper format.
Args:
cameraMatrixFile (string): Path to... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.lookup import LookupBase
from ansible.module_utils.net_tools.nios.api import WapiLookup
from ansible.module_utils.net_tools.nios.api import normalize_extattrs, flatten_extattrs
from ansible.errors import Ansib... |
# encoding: 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 'Tag.slug'
db.add_column('articles_tag', 'slug', self.gf('django.db.models.fields.CharField')(defau... |
import theano.tensor as T
from logistic_reg import LogisticRegression
from hiddenLayer import HiddenLayer
class MLP(object):
def __init__(self, rng, inpt, layers, scale=1):
'''
len(layers) must be atleast 3
input -> hidden -> output
but it can be more as well.
'''
se... |
import array
import hashlib
import itertools
import sys
try:
import threading
except ImportError:
threading = None
import unittest
import warnings
from test import support
from test.support import _4G, precisionbigmemtest
# Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = hasat... |
"""
This is a dummy file for testing and debugging XBMC plugins from the
command line. The file contains definitions for the functions found
in xbmc, xbmcgui and xbmcplugin built in modules
"""
import os
_loglevel = 1
_settings = {'external_filemanaging': 'true'}
_filename = 'dummy.log'
_loge... |
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
class Documentation(osv.Model):
_name = 'forum.documentation.toc'
_description = 'Documentation ToC'
_inherit = ['website.seo.metadata']
_order = "parent_left"
_parent_order = "sequence, name"
_parent_store = True
def name_get(s... |
from django.conf import settings
from django.core.urlresolvers import clear_url_caches, resolve
from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
import sys
@attr('shard_1')
class FaviconTestCase(TestCase):
def setUp(se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Get files in category
import os # get file path
import sys # reset file encoding
import webbrowser # open webpages
import urllib, json, io # read json
from urllib import urlopen # open file
import time # get unix code
import csv # rea... |
from nose.tools import eq_
from ycmd.completers.all import identifier_completer as ic
from ycmd.request_wrap import RequestWrap
from ycmd.tests.test_utils import BuildRequest
def BuildRequestWrap( contents, column_num, line_num = 1 ):
return RequestWrap( BuildRequest( column_num = column_num,
... |
import json
import logging
from django.utils.functional import wraps
from django.utils.translation import ugettext as _
from desktop.lib.exceptions_renderable import PopupException
from desktop.models import Document, Document2
from oozie.models import Job, Node, Dataset
LOG = logging.getLogger(__name__)
def che... |
from openerp.osv import osv, fields
class sale_order(osv.osv):
_name = "sale.order"
_inherit = ['sale.order', 'crm.tracking.mixin']
_columns = {
'categ_ids': fields.many2many('crm.case.categ', 'sale_order_category_rel', 'order_id', 'category_id', 'Tags', \
domain="['|', ('section_id', '... |
from cassandra.cluster import Cluster, NoHostAvailable
from cassandra.decoder import dict_factory
class CassandraConnection(object):
ip = None
kp = None
def __init__(self, cass_ip, cass_kp):
self.ip = cass_ip
self.kp = cass_kp
try:
self.cluster = Cluster(contact_point... |
from gensim.models import KeyedVectors
from nltk import pos_tag
from nltk import word_tokenize
import numpy as np
word2vec_filepath = "./data/GoogleNews-vectors-negative300.bin"
# word2vec similarity between the topic and the nouns of the candidate sentence
def nouns_sim(word2vec, sentences, tagged_sentences, tagged_... |
"""WebSearch Flask Blueprint."""
import cStringIO
from functools import wraps
from flask import g, render_template, request, flash, redirect, url_for, \
current_app, abort, Blueprint, send_file
from flask_breadcrumbs import default_breadcrumb_root
from flask_login import current_user
from flask_menu import regist... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer plugins and filters.
From build dir, run: ctest -R PyQgsServerPlugins -V
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either ve... |
#coding=utf-8
import requests
from xml.etree import ElementTree
from tornado.util import ObjectDict
__name__ = 'oschina'
def test(data, msg=None, bot=None):
if ('oschina' in data or '开源中国' in data) and '最新' in data and '新闻' in data:
return True
return False
def respond(data, msg=None, bot=None):
... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import errors
from tensorflow.python.platform import test
class ShardDa... |
import base_state
import base_stage
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
#
# This is the regobj setuptools script.
# Originally developed by Ryan Kelly, 2009.
#
# This script is placed in the public domain.
#
from distutils.core import setup
# Safely extract the docstring and version info from the module.
# If we did a straight `import regobj` here we wouldn't be able
# to build on ... |
import os
import sys
from twisted.trial.unittest import TestCase, SkipTest
from scrapy.downloadermiddlewares.httpproxy import HttpProxyMiddleware
from scrapy.exceptions import NotConfigured
from scrapy.http import Response, Request
from scrapy.spiders import Spider
spider = Spider('foo')
class TestDefaultHeadersMidd... |
import collections
def unflatten_dict(a_dict):
resultDict = {}
for key, value in a_dict.items():
parts = key.split("-")
d = resultDict
for part in parts[:-1]:
if part not in d:
d[part] = {}
d = d[part]
d[parts[-1]] = value
return resu... |
"""Posix implementations of platform-specific functionality."""
from __future__ import absolute_import, division, print_function, with_statement
import fcntl
import os
from tornado.platform import interface
def set_close_exec(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD, flags ... |
"""
@author: Brendan Dolan-Gavitt and AAron Walters
@license: GNU General Public License 2.0 or later
@contact: <EMAIL>,<EMAIL>
@organization: Volatile Systems LLC
"""
from forensics.object import *
import struct
def round_up(addr, align):
if addr % align == 0: return addr
else: return (addr +... |
from unittest import TestCase
import simplejson as json
import textwrap
from StringIO import StringIO
class TestIndent(TestCase):
def test_indent(self):
h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh',
'i-vhbjkhnth',
{'nifty': 87}, {'field': 'yes', 'morefield': False} ... |
{
'name': 'Website Partner',
'category': 'Website',
'summary': 'Partner Module for Website',
'version': '0.1',
'description': """Base module holding website-related stuff for partner model""",
'author': 'OpenERP SA',
'depends': ['website'],
'data': [
'views/res_partner_view.xml',... |
"""Logging and Summary Operations."""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import gen_logging_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.module_utils._text import to_native
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
class UTMModuleConfigurationError(Exception):
def __init__(s... |
from __future__ import absolute_import
from threading import Thread, Event
from apscheduler.schedulers.base import BaseScheduler
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.util import asbool
class BackgroundScheduler(BlockingScheduler):
"""
A scheduler that runs in the bac... |
'''
This example demonstrates creating and usind an AdvancedEffectBase. In
this case, we use it to efficiently pass the touch coordinates into the shader.
'''
from kivy.base import runTouchApp
from kivy.properties import ListProperty
from kivy.lang import Builder
from kivy.uix.effectwidget import EffectWidget, Advance... |
#!/usr/bin/env python
#
# Check trace components in FreeType 2 source.
#
# This code is explicitly into the public domain.
import sys
import os
import re
SRC_FILE_LIST = []
USED_COMPONENT = {}
KNOWN_COMPONENT = {}
SRC_FILE_DIRS = [ "src" ]
TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ]
# -------... |
"""LossScaleManager classes for mixed precision training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import six
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import c... |
import argparse
import pprint
import logging
import time
import os
import mxnet as mx
from config.config import config, generate_config, update_config
from config.dataset_conf import dataset
from config.network_conf import network
from symbols import *
from dataset import *
from core.loader import TestDataLoader
from ... |
# -*- 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 'GeneratedCertificate.error_reason'
db.add_column('certificates_generatedcertificate', 'error... |
import unittest
import numpy
import theano
from theano import tensor, function
from theano.tests.unittest_tools import attr
# this tests other ops to ensure they keep the dimensions of their
# inputs correctly
class TestKeepDims(unittest.TestCase):
def makeKeepDims_local(self, x, y, axis):
if axis is N... |
""" Logging part of workflows module."""
import logging
def get_logger(logger_name, db_handler_obj, level=10, **kwargs):
"""
Initialize and return a Python logger object.
You can specifiy the handlers to output logs in sys.stderr as well as the
datebase or anything you want.
"""
logging.bas... |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponsePermanentRedirect
from djconfig import config
from spirit.core.utils.views import is_post, post_data
from spirit.core.utils.paginator ... |
from __future__ import unicode_literals
import errno
import os
import re
import socket
import sys
from datetime import datetime
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.servers.basehttp import get_internal_wsgi_application, run
from django.uti... |
from distutils import log
import distutils.command.install_scripts as orig
import os
from pkg_resources import Distribution, PathMetadata, ensure_directory
class install_scripts(orig.install_scripts):
"""Do normal script install, plus any egg_info wrapper scripts"""
def initialize_options(self):
ori... |
"""
Tests for Platform against Mobile App Request
"""
import ddt
from django.test import TestCase
from lms.djangoapps.mobile_api.mobile_platform import MobilePlatform
@ddt.ddt
class TestMobilePlatform(TestCase):
"""
Tests for platform against mobile app request
"""
@ddt.data(
("edX/org.edx... |
from __future__ import absolute_import, division, print_function, \
with_statement
import hashlib
from shadowsocks.crypto import openssl
__all__ = ['ciphers']
def create_cipher(alg, key, iv, op, crypto_path=None,
key_as_bytes=0, d=None, salt=None,
i=1, padding=1):
md5 = h... |
"""
Oceanographic profiles and T-S diagrams
=======================================
This example demonstrates how to plot vertical profiles of different
variables in the same axes, and how to make a scatter plot of two
variables. There is an oceanographic theme but the same techniques are
equally applicable to atmosph... |
"""
====================================================================
Mass-univariate twoway repeated measures ANOVA on single trial power
====================================================================
This script shows how to conduct a mass-univariate repeated measures
ANOVA. As the model to be fitted assume... |
# encoding: 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):
# Changing field 'Strategy.name'
db.alter_column('lizard_rijnmond_strategy', 'name', self.gf('django.db.mo... |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.util.string.Split import split_words, pair_split
from echomesh.util.TestCase import TestCase
class SplitTest(TestCase):
def test_split_simple(self):
self.assertEqual(split_words('hello, there!'), ['hello,', 't... |
from weboob.tools.browser import BaseBrowser
from weboob.tools.date import datetime
from weboob.tools.parsers.jsonparser import json
from urllib import urlencode
#from .pages import Page1, Page2
__all__ = ['GuerrillamailBrowser']
class GuerrillamailBrowser(BaseBrowser):
PROTOCOL = 'https'
DOMAIN = 'www.gue... |
"""SCons.Tool.yacc
Tool-specific initialization for yacc.
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 The SCons Foundation
#
# Permi... |
"""
Page objects for patternfly/bootstrap modal window.
Modal window is a window which makes itself the only active element on the
page, so that one needs to close it first to access the rest of the page again.
"""
# Copyright 2016 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may ... |
from __future__ import absolute_import, division, unicode_literals
import re
from xml.sax.saxutils import escape, unescape
from .tokenizer import HTMLTokenizer
from .constants import tokenTypes
class HTMLSanitizerMixin(object):
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
accepta... |
"""
Test class for PXE Drivers
"""
import mock
import testtools
from ironic.common import exception
from ironic.drivers.modules import agent
from ironic.drivers.modules.amt import management as amt_management
from ironic.drivers.modules.amt import power as amt_power
from ironic.drivers.modules.amt import vendor as am... |
print_log('\n10. Prover creates Proof for Proof Request\n')
cred_for_attr_1 = creds_for_proof_request['attrs']['attr1_referent']
referent = cred_for_attr_1[0]['referent']
print_log('Referent: ')
pprint.pprint(referent)
chosen_claims_json = json.dumps({
'self_attested_... |
import flask
from . import main
from . import forms
import os
from werkzeug import secure_filename
from flask import Flask, render_template, request
from . import activeCampaign
@main.route('/', methods=['GET', 'POST'])
def index():
""""Login form to enter a room."""
form = forms.LoginForm()
if form.val... |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... |
import os
import sys
import struct
import datetime
from PySide.QtSql import *
# Need to access PostgreSQL C library directly to use COPY FROM STDIN
from ctypes import *
libpq = CDLL("libpq.so.5")
PQconnectdb = libpq.PQconnectdb
PQconnectdb.restype = c_void_p
PQfinish = libpq.PQfinish
PQstatus = libpq.PQstatus
PQexec ... |
import exceptions, sys, optparse, os, warnings
from operator import xor
import ZSI
from ConfigParser import ConfigParser
from ZSI.generate.wsdl2python import WriteServiceModule, ServiceDescription
from ZSI.wstools import WSDLTools, XMLSchema
from ZSI.wstools.logging import setBasicLoggerDEBUG
from ZSI.generate import c... |
from __future__ import unicode_literals
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import (
TestCase, modify_settings, override_settings, skipUnlessDBFeature,
)
from .models import City
@modify_settings(INSTALLED_APPS={'append': 'd... |
import distutils, os
from setuptools import Command
from distutils.util import convert_path
from distutils import log
from distutils.errors import *
from setuptools.command.setopt import edit_config, option_base, config_file
def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in ... |
import os
import fixtures
from tempest.cmd import init
from tempest.tests import base
class TestTempestInit(base.TestCase):
def test_generate_testr_conf(self):
# Create fake conf dir
conf_dir = self.useFixture(fixtures.TempDir())
init_cmd = init.TempestInit(None, None)
init_cmd... |
#!/usr/bin/env python
"""
search_character.py
Usage: search_character "character name"
Search for the given name and print the results.
"""
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.... |
"""
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... |
"""Tests for tf.contrib.training.device_setter."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from tensorflow.contrib.training.python.training import device_setter as device_setter_lib
from tensorflow.python.framework import ops
from ... |
"""
Test cases for twisted.protocols.ident module.
"""
import struct
from twisted.protocols import ident
from twisted.python import failure
from twisted.internet import error
from twisted.internet import defer
from twisted.python.compat import NativeStringIO
from twisted.trial import unittest
from twisted.test.proto... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
import numpy as np
from pandas.compat import lrange, u
from pandas import DataFrame, Series, MultiIndex, date_range
import pandas as pd
from pandas.util.testing import assert_series_equal, assert_frame_equal
import pandas.util.testing as t... |
import datetime
from django.conf import settings
from django.contrib.sessions.models import Session
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
from django.utils.encoding impor... |
"""
Consul Catalog Endpoint Access
"""
from consulate.api import base
class Catalog(base.Endpoint):
"""The Consul agent is the core process of Consul. The agent maintains
membership information, registers services, runs checks, responds to
queries and more. The agent must run on every node that is part o... |
#!/usr/bin/env python
import argparse
import getnwisrelease
import getnwversion
import gzip
import os
import platform
import shutil
import sys
import tarfile
import zipfile
from subprocess import call
steps = ['nw', 'chromedriver', 'symbol', 'headers', 'others']
################################
# Parse command line a... |
import copy
import re
import sys
from command import InteractiveCommand
from editor import Editor
from error import UploadError
UNUSUAL_COMMIT_THRESHOLD = 5
def _ConfirmManyUploads(multiple_branches=False):
if multiple_branches:
print "ATTENTION: One or more branches has an unusually high number of commits."
... |
'''
@author: YYK
'''
import zstacklib.utils.shell as shell
import zstacklib.utils.ssh as ssh
import os.path
import sys
def check_and_install_ansible():
cmd = 'which ansible'
try:
shell.call(cmd)
except:
print('ansible is not installed. Will try to install ansible')
cmd = 'pip inst... |
# -*- coding: utf-8 -*-
__version__ = '$Id$'
import family
# The Wikitravel shared family
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wikitravel_shared'
self.langs = {
'wikitravel_shared': 'wikitravel.org',
}
se... |
import pytest
import sys, os
from decimal import Decimal
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
from hotwing_core import Coordinate
class TestCoordinate():
def test_create_coordinate(self):
x = 1
y = 1.4
c = Coordinate(x, y)
assert ... |
import random
import resources
import string
import work_estimates
ID_LENGTH = 8
class Dependency:
"""A struct representing a dependency on another concept."""
def __init__(self, tag, reason, shortcut):
self.tag = tag
self.reason = reason
assert type(shortcut) == int
self.short... |
from django.shortcuts import render
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.template import RequestContext
from guardian.decorators import permission_required_or_403
from .models import MessageThread, Message
from .forms impo... |
"""
Regression tests for proper working of ForeignKey(null=True). Tests these bugs:
* #7512: including a nullable foreign key reference in Meta ordering has un
xpected results
"""
from django.db import models
# The first two models represent a very simple null FK ordering case.
class Author(models.Model):
n... |
"""Receives documents from the oplog worker threads and indexes them
into the backend.
This file is a document manager for the Solr search engine, but the intent
is that this file can be used as an example to add on different backends.
To extend this to other systems, simply implement the exact same class and
replace ... |
"""Tests to ensure that the html5lib tree builder generates good trees."""
import warnings
try:
from bs4.builder import HTML5TreeBuilder
HTML5LIB_PRESENT = True
except ImportError, e:
HTML5LIB_PRESENT = False
from bs4.element import SoupStrainer
from bs4.testing import (
HTML5TreeBuilderSmokeTest,
... |
'''
Specialized alternative to shelve. provides a class that stores a list of
arrays.All arrays are of type Float32, 1D, and of the same length. File format
is simple binary, always littlendian, with the first 4 bytes encoding the width
as an unsigned int ("<I")
'''
import struct, os, tempfile
from sys import byteord... |
# Neural network data analysis tool collection. Makes heavy use of the logging module.
# Can generate training curves during the run (from properly setup IPython and/or with
# TkAgg backend and interactive mode - see matplotlib documentation).
__author__ = "Martin Felder"
__version__ = "$Id$"
from pylab import ion, fi... |
"""Gradients for operators defined in control_flow_ops.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import dtypes
from tensorflow.python.framework i... |
from numpy.testing import *
from numpy import array
import math
import util
class TestF77Callback(util.F2PyTest):
code = """
subroutine t(fun,a)
integer a
cf2py intent(out) a
external fun
call fun(a)
end
subroutine func(a)
cf2py intent(in,out) a
integer a
... |
import sys
import imp
import marshal
from distutils.version import StrictVersion
from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN
from .py33compat import Bytecode
__all__ = [
'Require', 'find_module', 'get_module_constant', 'extract_constant'
]
class Require:
"""A prerequisite to building o... |
data = (
'ddyels', # 0x00
'ddyelt', # 0x01
'ddyelp', # 0x02
'ddyelh', # 0x03
'ddyem', # 0x04
'ddyeb', # 0x05
'ddyebs', # 0x06
'ddyes', # 0x07
'ddyess', # 0x08
'ddyeng', # 0x09
'ddyej', # 0x0a
'ddyec', # 0x0b
'ddyek', # 0x0c
'ddyet', # 0x0d
'ddyep', # 0x0e
'ddyeh', # 0x0f
... |
import xmlrpclib
webfaction = xmlrpclib.ServerProxy('https://api.webfaction.com/')
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
state = dict(required=False, choices=['present', 'absent'], default='present'),
type = dict(required... |
import sys
from gppylib.gplog import *
from gppylib.system.configurationInterface import *
from gppylib.system import configurationImplTest, fileSystemImplTest, fileSystemInterface, osInterface, osImplTest, \
faultProberInterface, faultProberImplTest
from gppylib.gparray import Segment
logger = get_default_lo... |
'''SSL with SNI-support for Python 2.
This needs the following packages installed:
* pyOpenSSL (tested with 0.13)
* ndg-httpsclient (tested with 0.3.2)
* pyasn1 (tested with 0.1.6)
To activate it call :func:`~urllib3.contrib.pyopenssl.inject_into_urllib3`.
This can be done in a ``sitecustomize`` module, or at any ot... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
from celery import task, chord
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from treemap.models import Species
from importer.mo... |
"""Tests for optimizers.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow_estimator.python.estimator.canned import optimizers
class _TestOptimizer(tf.compat.v1.train.Optimizer):
def __init__(self):
super... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp import SUPERUSER_ID, api
import logging
_logger = logging.getLogger(__name__)
class stock_inventory(osv.osv):
_inherit = "stock.inventory"
_columns = {
'period_id': fields.many2one('account.period', 'Force Valuation... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.