content string |
|---|
"""
Unit tests for the stem.util.str_tools functions.
"""
import datetime
import unittest
from stem.util import str_tools
class TestStrTools(unittest.TestCase):
def test_to_int(self):
"""
Checks the _to_int() function.
"""
test_inputs = {
'': 0,
'h': 104,
'hi': 26729,
'hel... |
"""
Provides storage driver for working with local filesystem
"""
from __future__ import with_statement
import errno
import os
import shutil
import sys
try:
import lockfile
from lockfile import LockTimeout, mkdirlockfile
except ImportError:
raise ImportError('Missing lockfile dependency, you can install ... |
# -*- coding: utf-8 -*-
""" Tests for the account API. """
import re
from unittest import skipUnless
from nose.tools import raises
from mock import patch
import ddt
from dateutil.parser import parse as parse_datetime
from django.core import mail
from django.test import TestCase
from django.conf import settings
from ... |
from __future__ import division, absolute_import, print_function
__all__ = ['less', 'cosh', 'arcsinh', 'add', 'ceil', 'arctan2', 'floor_divide',
'fmod', 'hypot', 'logical_and', 'power', 'sinh', 'remainder', 'cos',
'equal', 'arccos', 'less_equal', 'divide', 'bitwise_or',
'bitwise_and', ... |
"""
Test that two targets with the same name generates an error.
"""
import os
import sys
import TestGyp
import TestCmd
# TODO(sbc): Remove the use of match_re below, done because scons
# error messages were not consistent with other generators.
# Also remove input.py:generator_wants_absolute_build_file_paths.
test... |
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
regi... |
import hr_payroll_payslips_by_employees
import hr_payroll_contribution_register_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Presubmit script for ChromeVox."""
def CheckChangeOnUpload(input_api, output_api):
paths = input_api.AbsoluteLocalPaths()
def ShouldCheckFile(path):
return path.endswith('.js') or path.endswith('.py')
def ScriptFilter(path):
return (path.endswith('check_chromevox.py') or
path.endswith('j... |
import os
import unittest
from mantid.simpleapi import *
from mantid.api import MatrixWorkspace,WorkspaceGroup
from mantid import config
class IndirectILLEnergyTransferTest(unittest.TestCase):
_runs = dict([('one_wing_QENS', '090661'),
('one_wing_EFWS', '083072'),
('one_wing_I... |
from openerp import fields, models
class HrContract(models.Model):
_inherit = 'hr.contract'
benefit_line_ids = fields.One2many(
'hr.employee.benefit',
'contract_id',
'Employee Benefits',
) |
from test import test_support
import unittest
nis = test_support.import_module('nis')
class NisTests(unittest.TestCase):
def test_maps(self):
try:
maps = nis.maps()
except nis.error, msg:
# NIS is probably not active, so this test isn't useful
if test_support.ve... |
from __future__ import unicode_literals
import mimetypes
import os
import random
import time
from email import (
charset as Charset, encoders as Encoders, generator, message_from_string,
)
from email.header import Header
from email.message import Message
from email.mime.base import MIMEBase
from email.mime.message... |
"""Tests for pytest-services plugin."""
import os.path
import socket
import pylibmc
import MySQLdb
def test_memcached(request, memcached, memcached_socket):
"""Test memcached service."""
mc = pylibmc.Client([memcached_socket])
mc.set('some', 1)
assert mc.get('some') == 1
# check memcached cleane... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.onyx import onyx_snmp_users
from units.modules.utils import set_module_args
from .onyx_module import TestOnyxModule, load_fixture
class TestOnyxSNMPUsersModule(Test... |
"""Support for Join notifications."""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA,
ATTR_TITLE,
ATTR_TITLE_DEFAULT,
PLATFORM_SCHEMA,
BaseNotificationService,
)
from homeassistant.const import CONF_API_KEY
import homeassistant.helpers.config_validati... |
"""
Provide urlresolver functions that return fully qualified URLs or view names
"""
from __future__ import unicode_literals
from django.core.urlresolvers import reverse as django_reverse
from django.core.urlresolvers import NoReverseMatch
from django.utils import six
from django.utils.functional import lazy
from res... |
"""
=================
Drop Shadow Frame
=================
A widget providing a drop shadow (gaussian blur effect) around another
widget.
"""
from PyQt4.QtGui import (
QWidget, QPainter, QPixmap, QGraphicsScene, QGraphicsRectItem,
QGraphicsDropShadowEffect, QColor, QPen, QPalette, QStyleOption,
QAbstractS... |
from __future__ import print_function, unicode_literals
import datetime
import unittest
from airflow import configuration, DAG
from airflow.models import TaskInstance as TI
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from airflow.operators.python_operator import ShortCircuitOper... |
from django.core.urlresolvers import reverse # noqa
from django import http
from mox import IgnoreArg # noqa
from mox import IsA # noqa
from horizon.workflows import views
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
from openstack_dashboard.dashboards.admin.domains im... |
from rest_framework import status
from rest_framework.test import APITestCase
from django.urls import reverse
from faker import Factory
from django.contrib.auth.models import User
from farms.models import Farm,Zone
from farms.serializers import FarmSerializer
from collections import OrderedDict
###### Module configs ... |
import datetime
import webob
from nova.compute import instance_types
from nova.openstack.common import jsonutils
from nova import test
from nova.tests.api.openstack import fakes
def fake_get_instance_type_by_flavor_id(flavorid):
return {
'id': flavorid,
'flavorid': str(flavorid),
'root_g... |
# -*- coding: utf-8 -*-
"""
flask.globals
~~~~~~~~~~~~~
Defines all the global objects that are proxies to the current
active context.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from functools import partial
from werkzeug.local import LocalStack, ... |
from django.db import models
class R(models.Model):
is_default = models.BooleanField(default=False)
def __str__(self):
return "%s" % self.pk
get_default_r = lambda: R.objects.get_or_create(is_default=True)[0]
class S(models.Model):
r = models.ForeignKey(R)
class T(models.Model):
s = mod... |
import os
import platform
import sys
from webkitpy.common.system import environment, executive, file_lock, filesystem, platforminfo, user, workspace
class SystemHost(object):
def __init__(self):
self.executive = executive.Executive()
self.filesystem = filesystem.FileSystem()
self.user = u... |
"""
Stub implementation of YouTube for acceptance tests.
To start this stub server on its own from Vagrant:
1.) Locally, modify your Vagrantfile so that it contains:
config.vm.network :forwarded_port, guest: 8031, host: 8031
2.) From within Vagrant dev environment do:
cd common/djangoapps/terrain
pyth... |
# -*- coding: utf-8 -*-
from email.parser import BytesParser
from django.core.cache import cache
from servo.lib.utils import empty
from servo.exceptions import ConfigurationError
from servo.models import Configuration, User, Order, Note, Template
def get_rules():
"""
Get the rules from the JSON file and cac... |
"""add geoloc tables
Revision ID: 2b35f2f2adcb
Revises: 29474f196c96
Create Date: 2015-11-09 00:12:02.604229
"""
# revision identifiers, used by Alembic.
revision = '2b35f2f2adcb'
down_revision = '29474f196c96'
branch_labels = None
depends_on = None
import os
import json
from alembic import op
import sqlalchemy as... |
"""
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... |
"""Tests for learn.estimators.tensor_signature."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python.learn.estimators import tensor_signature
from tensorflow.python.framework import dtypes
from tensorflow.python.framework ... |
"""Tests of the builder registry."""
import unittest
from bs4 import BeautifulSoup
from bs4.builder import (
builder_registry as registry,
HTMLParserTreeBuilder,
TreeBuilderRegistry,
)
try:
from bs4.builder import HTML5TreeBuilder
HTML5LIB_PRESENT = True
except ImportError:
HTML5LIB_PRESENT =... |
"""
Fenced Code Extension for Python Markdown
=========================================
This extension adds Fenced Code Blocks to Python-Markdown.
>>> import markdown
>>> text = '''
... A paragraph before a fenced code block:
...
... ~~~
... Fenced code block
... ~~~
... '''
>>> ht... |
"""
Update the scheduled updates
"""
import sys
import time
import traceback
import logging
from sesql import index
from sesql import config
from sesql import results
from sesql import __version__
from sesql.daemon.cmdline import CmdLine
from sesql.daemon.unixdaemon import UnixDaemon
from django.db import connection,... |
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""
from oslo.config import cfg
from barbican.openstack.common import importutils
from barbican.openstack.common import log as logging
from barbican.openstack.common.rpc impor... |
import unittest
def merge_sort(array):
if len(array) <= 1:
return array
mid = len(array) / 2
merge1, merge2 = merge_sort(array[:mid]), merge_sort(array[mid:])
def merge(left, right):
l, r = 0, 0
while l < len(left) and r < len(right):
if left[l] < right[r]:
... |
"""Simply the current installed pygame version. The version information is
stored in the regular pygame module as 'pygame.ver'. Keeping the version
information also available in a separate module allows you to test the
pygame version without importing the main pygame module.
The python version information should alway... |
from openerp import models
from openerp.tools import mute_logger
from openerp.osv.orm import except_orm
from openerp.tests import common
class TestAPI(common.TransactionCase):
""" test the new API of the ORM """
def assertIsRecordset(self, value, model):
self.assertIsInstance(value, models.BaseModel)... |
import datetime
import unittest
from django.apps.registry import Apps
from django.core.exceptions import ValidationError
from django.db import models
from django.test import TestCase
from .models import (
CustomPKModel, FlexibleDatePost, ModelToValidate, Post, UniqueErrorsModel,
UniqueFieldsModel, UniqueForDa... |
__author__ = "Luke Hart"
__copyright__ = "Copyright 2014, The Jeff Museum"
__credits__ = ["Luke Hart","Joe Ellis", "Chris Sewell", "Matt Ribbins",
"Sebastian Beaven", "Joshua Webb", "Andrew Bremmer"]
__license__ = "GPL"
__version__ = "0.9"
__maintainer__ = "Luke Hart"
__email__ = "<EMAIL>"
__status__ = "... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
import time
HAS_PB_SDK = True
try:
from profitbricks.client import ProfitBri... |
from sympy.liealgebras.weyl_group import WeylGroup
from sympy.liealgebras.type_a import TypeA
from sympy.liealgebras.type_b import TypeB
from sympy.matrices import Matrix
def test_weyl_group():
c = WeylGroup("A3")
assert c.matrix_form('r1*r2') == Matrix([[0, 0, 1, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 0,... |
from __future__ import absolute_import
import structlog
from flask import Blueprint
from flask import current_app
from flask import url_for
from werkzeug.exceptions import NotFound
from relengapi.blueprints.badpenny import cleanup
from relengapi.blueprints.badpenny import cron
from relengapi.blueprints.badpenny impor... |
"""Serializers for commment REST APIs"""
from datetime import datetime, timezone
from django.contrib.auth import get_user_model
from praw.models import Comment, MoreComments
from praw.models.reddit.submission import Submission
from rest_framework import serializers
from rest_framework.exceptions import ValidationError... |
import aioreactive as rx
import pytest
from aioreactive.notification import OnCompleted, OnNext
from aioreactive.testing import AsyncTestObserver, VirtualTimeEventLoop
from aioreactive.types import AsyncObservable
from expression.core import pipe
@pytest.yield_fixture() # type: ignore
def event_loop():
loop = Vi... |
from sympy.core.symbol import Symbol
from sympy.core.compatibility import u, range
from sympy.printing.pretty.stringpict import prettyForm
class BaseScalar(Symbol):
"""
A coordinate symbol/base scalar.
Ideally, users should not instantiate this class.
"""
def __new__(cls, name, index, system, p... |
"""
Implementation of the command-line I{pyflakes} tool.
"""
import sys
import os
import _ast
checker = __import__('pyflakes.checker').checker
def check(codeString, filename):
"""
Check the Python source given by C{codeString} for flakes.
@param codeString: The Python source to check.
@type codeStri... |
__all__ = ['Serializer', 'SerializerError']
from error import YAMLError
from events import *
from nodes import *
class SerializerError(YAMLError):
pass
class Serializer(object):
ANCHOR_TEMPLATE = u'id%03d'
def __init__(self, encoding=None,
explicit_start=None, explicit_end=None, version=Non... |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.base import Base
from geocoder.keys import app_id, app_code
from geocoder.location import Location
from geocoder.here import Here
class HereReverse(Here, Base):
"""
HERE Geocoding REST API
=======================
Se... |
"""
Package setup and installation.
"""
from setuptools import setup
from setuptools import find_packages
import sys
import os
import subprocess
version = "1.4.0"
setup(name='Syrupy',
version=version,
author='Jeet Sukumaran',
author_email='<EMAIL>',
description="""\
System resource usage pro... |
import sys
import datetime
import os
from contextlib import contextmanager
import freezegun
import pytest
import pretend
import pip
from pip._vendor import lockfile
from pip.utils import outdated
@pytest.mark.parametrize(
['stored_time', 'newver', 'check', 'warn'],
[
('1970-01-01T10:00:00Z', '2.0', ... |
# -*- coding: utf-8 -*-
import bisect
from collections import defaultdict
import io
import json
import logging
import zipfile
from babelfish import Language
from guessit import guessit
from requests import Session
from . import ParserBeautifulSoup, Provider
from .. import __short_version__
from ..cache import SHOW_EX... |
__author__ = 'Nicholas C Pandolfi'
#The MIT License (MIT)
#
#Copyright (c) 2014 Nicholas C Pandolfi
#
#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 the Software without restriction, including without lim... |
from socket import *
from itertools import imap
import re
class RedisClient:
''' simple (and slow) redis client that works only in request/response mode '''
def __init__( self, ip, port ):
self.ip = ip
self.port = port
self.sock = socket(AF_INET, SOCK_STREAM)
self.sock.connect((... |
"""
arfile - A module to parse GNU ar archives.
Copyright (c) 2006-7 Paul Sokolovsky
This file is released under the terms
of GNU General Public License v2 or later.
"""
import sys
import os
import tarfile
class FileSection:
"A class which allows to treat portion of file as separate file object."
def __in... |
#
# distutils/version.py
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# $Id$
#
"""Provides classes to represent module version numbers (one class for
each style of version numbering). There are currently two such classes
implemented: StrictVersion and LooseVe... |
import sys, string, os
from xml.etree import ElementTree as ET
from xml.dom import minidom
projFile = sys.argv[1]
targetPath = sys.argv[2]
def getLinkElement():
global targetPath
ret = ET.Element('link')
nameEle = ET.Element('name')
nameEle.text = 'plugin-x'
typeEle = ET.Element('type')
typeEl... |
"""Helpers related to deprecation of functions, methods, classes, other
functionality."""
from sqlalchemy import exc
import warnings
import re
from langhelpers import decorator
def warn_deprecated(msg, stacklevel=3):
warnings.warn(msg, exc.SADeprecationWarning, stacklevel=stacklevel)
def warn_pending_deprecation... |
"""Converts checkpoint variables into Const ops in a standalone GraphDef file.
This script is designed to take a GraphDef proto, a SaverDef proto, and a set of
variable values stored in a checkpoint file, and output a GraphDef with all of
the variable ops converted into const ops containing the values of the
variables... |
import unittest
import settings
import time
import mosquitto
import serial
def on_message(mosq, obj, msg):
obj.message_queue.append(msg)
class mqtt_publish_in_callback(unittest.TestCase):
message_queue = []
@classmethod
def setUpClass(self):
self.client = mosquitto.Mosquitto("pubsubclient_ut", cle... |
from openerp import tools
from openerp.osv import osv, fields
def _reopen(self, res_id, model):
return {'type': 'ir.actions.act_window',
'view_mode': 'form',
'view_type': 'form',
'res_id': res_id,
'res_model': self._name,
'target': 'new',
# s... |
"""
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the metaclass for your Field subclass, implement
to_python() and the other necessary methods and everything will work
seamlessly.
"""
class SubfieldBase(type):
"""
A metaclass ... |
from ansible.modules.cloud.amazon import redshift_cross_region_snapshots as rcrs
mock_status_enabled = {
'SnapshotCopyGrantName': 'snapshot-us-east-1-to-us-west-2',
'DestinationRegion': 'us-west-2',
'RetentionPeriod': 1,
}
mock_status_disabled = {}
mock_request_illegal = {
'snapshot_copy_grant': 'cha... |
'''OpenGL extension NV.framebuffer_multisample_coverage
This module customises the behaviour of the
OpenGL.raw.GL.NV.framebuffer_multisample_coverage to provide a more
Python-friendly API
Overview (from the spec)
This extension extends the EXT_framebuffer_multisample
specification by providing a new function,
... |
"""Verifies that Google Test correctly parses environment variables."""
__author__ = '<EMAIL> (Zhanyong Wan)'
import os
import gtest_test_utils
IS_WINDOWS = os.name == 'nt'
IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_')
environ = ... |
from .exception import NoMatches, MultipleMatches
from .named import NamedExtensionManager
class DriverManager(NamedExtensionManager):
"""Load a single plugin with a given name from the namespace.
:param namespace: The namespace for the entry points.
:type namespace: str
:param name: The name of the ... |
"""Previewer bundles."""
from __future__ import unicode_literals
from invenio.ext.assets import Bundle, CleanCSSFilter, RequireJSFilter
pdfjs = Bundle(
"vendors/pdfjs-build/generic/web/compatibility.js",
"vendors/pdfjs-build/generic/web/l10n.js",
"vendors/pdfjs-build/generic/build/pdf.js",
"js/previ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for sp in orm['cms.StaticPlaceholder'].objects.all():
sp.site = None
... |
import collections
import numpy as np
import unittest
import scipy.stats
from . import test_connect_helpers as hf
from .test_connect_parameters import TestParams
class TestSymmetricPairwiseBernoulli(TestParams):
# sizes of source-, target-population and connection probability for
# statistical test
N_s =... |
"""
Grade book view for instructor and pagination work (for grade book)
which is currently use by ccx and instructor apps.
"""
import math
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import transaction
from django.views.decorators.cache import cache_control
... |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '2006, Ed Summers <<EMAIL>>'
__docformat__ = 'restructuredtext en'
from urlparse import urlparse, urlunparse, parse_qs
from urllib import urlencode
class Query(object):
... |
# -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
from .defaults import defaults
from .models import Request
from .hooks import dispatch_hook
from .utils import header_expand
from .packages... |
'''
python %prog
Convert a perf trybot JSON file into a pleasing HTML page. It can read
from standard input or via the --filename option. Examples:
cat results.json | %prog --title "ia32 results"
%prog -f results.json -t "ia32 results" -o results.html
'''
import commands
import json
import math
from optparse imp... |
import openerp
from openerp.osv import osv, fields
from openerp.tools.translate import _
class base_module_upgrade(osv.osv_memory):
""" Module Upgrade """
_name = "base.module.upgrade"
_description = "Module Upgrade"
_columns = {
'module_info': fields.text('Modules to Update',readonly=True),
... |
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_dict
try:
from botocore.exceptions import BotoCoreError, ClientError
except ImportErr... |
b = 256
q = 2**255 - 19
l = 2**252 + 27742317777372353535851937790883648493
def expmod(b,e,m):
if e == 0: return 1
t = expmod(b,e/2,m)**2 % m
if e & 1: t = (t*b) % m
return t
def inv(x):
return expmod(x,q-2,q)
d = -121665 * inv(121666)
I = expmod(2,(q-1)/4,q)
def xrecover(y):
xx = (y*y-1) * inv(d*y*y+1)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import templatefield
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = templatefield.__version__
if sys.argv[-1] == 'publish':
try:
import wheel
except ImportError:
prin... |
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
matplotlib.rcParams.update({'font.size': 24})
matplotlib.rcParams.update({'text.usetex': True})
def lpnorm_scaled(x, p, mu):
return (lpnorm(x, p, mu) - lpnorm(0, p, mu)) / (lpnorm(1, p, mu) - lpnorm(0, p, mu))
def lpnorm(x, p, mu):
r... |
# -*- coding: utf-8 -*-
"""
WSI_BOT_APPLY
Assigns all patches in an image to one of the clusters in the codebook.
@author: vlad
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
__author__ = 'Vlad Popovici'
__version__ = 0.01
import argparse as opt
from... |
from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
interface_common_info = {
'type': 'object',
'properties': {
'port_state': {'type': 'string'},
'fixed_ips': {
'type': 'array',
'items': {
'type': 'object',
'properties... |
#
# AirMassChart.py -- AirMass chart plugin
#
# Eric Jeschke (<EMAIL>)
#
from datetime import timedelta
#from dateutil import tz
from ginga.gw import Widgets, Plot
from ginga.misc import Bunch
from qplan.plugins import PlBase
from qplan.plots.airmass import AirMassPlot
class AirMassChart(PlBase.Plugin):
def __... |
import unittest
from p2pool.bitcoin import data, networks
from p2pool.util import pack
class Test(unittest.TestCase):
def test_header_hash(self):
assert data.hash256(data.block_header_type.pack(dict(
version=1,
previous_block=0x000000000000038a2a86b72387f93c51298298a732079b3b686df... |
import os.path
import tarfile
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import parse_shebang
from pre_commit.languages import ruby
from pre_commit.prefix import Prefix
from pre_commit.util import cmd_output
from pre_commit.util import resource_bytesio
from testing.util i... |
'''
MathDoku solver module.
@author: Radian Baskoro
'''
import itertools
from datetime import datetime
from Utility import Utility
class Solver:
'''
Solver class used to solve the MathDoku problem.
'''
__debugLevel = 0
__iterationCount = 0
__initFlag = False
boardSize = 0
... |
from __future__ import unicode_literals
import warnings
from django import forms
from django.conf import settings
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.utils import (
display_for_field, flatten_fieldsets, help_text_for_field, label_for_field,
lookup_field,... |
import re
from collections import namedtuple
from io import BytesIO
from PIL import Image
from reportlab.lib import colors, pagesizes
from reportlab.lib.enums import TA_CENTER, TA_JUSTIFY, TA_LEFT, TA_RIGHT
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.units import cm
from reportlab.lib.utils impo... |
from docutils import nodes, utils
from docutils.parsers.rst import Directive
from pygments.lexers import get_lexer_by_name, PythonLexer
PythonLexer.name = 'Python 2'
def setup(app):
app.add_directive('switcher', SwitcherDirective)
app.add_directive('case', CaseDirective)
class SwitcherDirective(Directive):
... |
"""
Module implementing a user agent manager.
"""
from __future__ import unicode_literals
import os
from PyQt5.QtCore import pyqtSignal, QObject, QXmlStreamReader
from E5Gui import E5MessageBox
from Utilities.AutoSaver import AutoSaver
import Utilities
class UserAgentManager(QObject):
"""
Class implement... |
"""
Dummy database backend for Django.
Django uses this if the database ENGINE setting is empty (None or empty string).
Each of these API functions, except connection.close(), raises
ImproperlyConfigured.
"""
from django.core.exceptions import ImproperlyConfigured
from django.db.backends import *
from django.db.back... |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable
class InventoryModule(BaseInventoryPlugin, Cacheable):
NAME = 'testns.content_adj.statichost'
def __init... |
#!/usr/bin/env python
import sys
import os
from subprocess import *
if len(sys.argv) <= 1:
print('Usage: {0} training_file [testing_file]'.format(sys.argv[0]))
raise SystemExit
# svm, grid, and gnuplot executable files
is_win32 = (sys.platform == 'win32')
if not is_win32:
svmscale_exe = "../svm-scale"
svmtrain_... |
from __future__ import unicode_literals
"""
This module implements various transmuter classes.
Transmuters are essentially classes that generate TransformedStructures from
various data sources. They enable the high-throughput generation of new
structures and input files.
It also includes the helper function, batch_wr... |
# -*- coding: iso-8859-1 -*-
"""A sample implementation of SHA-1 in pure Python.
Framework adapted from Dinu Gherman's MD5 implementation by
J. Hallén and L. Creighton. SHA-1 implementation based directly on
the text of the NIST standard FIPS PUB 180-1.
"""
__date__ = '2004-11-17'
__version__ = 0.91 # Mo... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
determine_ext,
ExtractorError,
js_to_json,
strip_jsonp,
try_get,
unified_strdate,
update_url_query,
ur... |
"""clustering_stats
Extracts basic statistics (ie. number of clusters, incorrectly clustered spectra) from .clustering files.
This script only creates meaningful results if the .clustering file contains identification data which
will be used to evaluate correctly and incorrectly clustered spectra.
Usage:
clusteri... |
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils import six
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (as a number or string), and returns it as a string,
using formats ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... |
"""Tests for DecodeBmpOp."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import ima... |
"""
Allow users to set and activate scenes.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/scene/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_PLATFORM, SERVICE_TURN_ON)
from hom... |
"""Define the notification type and track sent notifications."""
import logging
from smtplib import SMTPException
from future.utils import python_2_unicode_compatible
from model_utils import Choices
from model_utils.fields import MonitorField
from model_utils.models import TimeStampedModel
from django.conf import se... |
import io
import os
import datetime
import sickbeard
from sickbeard import logger, helpers
from sickbeard.metadata import generic
from sickrage.helper.encoding import ek
from sickrage.helper.exceptions import ex, ShowNotFoundException
class TIVOMetadata(generic.GenericMetadata):
"""
Metadata generation class... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.