content stringlengths 4 20k |
|---|
from Orange.testing import testing
from Orange.testing.testing import datasets_driven, test_on_data
from Orange.feature import scoring
try:
import unittest2 as unittest
except:
import unittest
@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS,
preprocess=testing.DISCRETIZE_DOMAIN)
cla... |
from __future__ import division, absolute_import, print_function
from numpy.distutils.ccompiler import simple_version_match
from numpy.distutils.fcompiler import FCompiler
compilers = ['SunFCompiler']
class SunFCompiler(FCompiler):
compiler_type = 'sun'
description = 'Sun or Forte Fortran 95 Compiler'
#... |
from superdesk.tests import TestCase
from superdesk.celery_app import try_cast, loads
from bson import ObjectId
from datetime import datetime
from eve.utils import date_to_str
class CeleryTestCase(TestCase):
_id = ObjectId('528de7b03b80a13eefc5e610')
def test_cast_objectid(self):
self.assertEqual(tr... |
"""
Software API adapter for markdown.py
This module provides a function based API to markdown.py
since markdown.py only provides a CLI.
"""
from subprocess import Popen, PIPE, STDOUT
from tempfile import NamedTemporaryFile
import os
# This is here so there's one line to change if I want to swap
# out a different sc... |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <<EMAIL>>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into RTF markup
'''
import os
import re
import cStringIO
from lxml import etree
from calibre.ebooks.metadata import authors_to_string
from calibre.utils.magi... |
""" Test Codecs (used by test_charmapcodec)
Written by Marc-Andre Lemburg (<EMAIL>).
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,... |
#!/usr/bin/env python
import io
import unittest
from pycoin.block import Block
from pycoin.serialize import b2h_rev, h2b
class BlockTest(unittest.TestCase):
def test_block(self):
expected_checksum = '0000000000089F7910F6755C10EA2795EC368A29B435D80770AD78493A6FECF1'.lower()
block_data = h2b('0100... |
# -*- coding: utf-8 -*-
"""
flask.sessions
~~~~~~~~~~~~~~
Implements cookie based sessions based on itsdangerous.
:copyright: (c) 2012 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import uuid
import hashlib
from datetime import datetime
from werkzeug.http import http_date, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
existing_types = []
sample_types = []
sample_type_file = open("sampleType.txt")
existing_types_file = open("currentSampleTypes.txt")
results = open("output/sampleTypeOutput.txt", 'w')
def write_massive_type_of_sample():
results.write("\nPaste following... |
import os
import json
from functools import partial
import xdg.BaseDirectory
from gi.repository import Gio, Gtk
from rsr import config
from rsr.connections.manager import ConnectionManager
from rsr.mainwin import MainWindow
from rsr.preferences import PreferencesDialog
class Application(Gtk.Application):
def _... |
# -*- coding: utf-8 -*-
"""
Production Configurations
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis for cache
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
from... |
import sys
from collections import namedtuple
import py
import pytest
from _pytest.pytester import LineMatcher
pytest_plugins = 'pytester',
THIS = py.path.local(__file__)
STORAGE = THIS.dirpath('test_storage')
@pytest.fixture
def testdir(testdir, monkeypatch):
return namedtuple('testdir', 'tmpdir,run')(
... |
"""Subset of inspect module from upstream python
We use this instead of upstream because upstream inspect is slow to import, and
significanly contributes to numpy import times. Importing this copy has almost
no overhead.
"""
from __future__ import division, absolute_import, print_function
import types
__all__ = ['g... |
from django.utils.translation import ugettext_noop
from corehq.apps.products.models import Product
from django.template.loader import render_to_string
from corehq.apps.reports.commtrack.standard import CommtrackReportMixin
from corehq.apps.reports.standard.maps import GenericMapReport
from corehq.apps.style.decorators ... |
"""
Test cases for packstack.installer.core.parameters module.
"""
from unittest import TestCase
from ..test_base import PackstackTestCaseMixin
from packstack.installer.core.parameters import *
class ParameterTestCase(PackstackTestCaseMixin, TestCase):
def setUp(self):
super(ParameterTestCase, self).set... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError
from ..compat import compat_urlparse
class TuneInBaseIE(InfoExtractor):
_API_BASE_URL = 'http://tunein.com/tuner/tune/'
@staticmethod
def _extract_urls(webpage):
... |
import logging
import requests
import simplejson
from common.cloud.environment_names import Environment
from common.cloud.instance import CloudInstance
from common.common_consts.timeouts import SHORT_REQUEST_TIMEOUT
LATEST_AZURE_METADATA_API_VERSION = "2019-04-30"
AZURE_METADATA_SERVICE_URL = (
"http://169.254.1... |
from __future__ import division, absolute_import, unicode_literals
import os
from qtpy import QtCore
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from .. import core
from .. import gitcmds
from .. import icons
from .. import qtutils
from ..i18n import N_
from ..interaction import Interaction
from . import de... |
import volatility.utils as utils
import volatility.obj as obj
import volatility.plugins.common as common
import volatility.win32.modules as modules
import volatility.win32.tasks as tasks
import volatility.debug as debug
import volatility.plugins.malware.malfind as malfind
import volatility.exceptions as exceptions
from... |
import numpy as np
__all__ = ['fit_cubic', 'fit_quartic', 'findroot']
def rms(A):
if A.size == 0:
return None
return np.sqrt(np.sum(A ** 2) / A.size)
def pinv(A, log=lambda _: None):
U, D, V = np.linalg.svd(A)
thre = 1e3
thre_log = 1e8
gaps = D[:-1] / D[1:]
try:
n = np.f... |
"""Tests for tensorflow.ops.stack_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from... |
import sys
import os
import socket
from struct import unpack
from twisted.python.sendmsg import recvmsg
def recvfd(socketfd):
"""
Receive a file descriptor from a L{sendmsg} message on the given C{AF_UNIX}
socket.
@param socketfd: An C{AF_UNIX} socket, attached to another process waiting
to ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import cl.lib.model_helpers
import cl.lib.storage
class Migration(migrations.Migration):
dependencies = [
('search', '0008_load_new_courts'),
('search', '0009_blankify_fields'),
]
o... |
import numpy as np
est = dict(
rank = 13,
N = 758,
Q = .0150568875809373,
J = 11.41312078635046,
J_df = 2,
k_1 = 13,
converged = 1,
has_xtinst = 0,
type = 1,
n_eq = 1,
k = 13,
n_moments =... |
from __future__ import absolute_import, unicode_literals
import errno
import socket
import unittest
from mock import Mock, patch, sentinel
from mopidy.internal import network
from mopidy.internal.gi import GObject
from tests import any_int
class ServerTest(unittest.TestCase):
def setUp(self): # noqa: N802
... |
"""
Generator for draw* tests.
This file needs to be run in its folder.
"""
import sys
_DO_NOT_EDIT_WARNING = """<!--
This file is auto-generated from draw_test_generator.py
DO NOT EDIT!
-->
"""
_HTML_TEMPLATE = """<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>WebGL ... |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <<EMAIL>>
Task Coach 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) ... |
"""
Implementation of an SSH2 "message".
"""
import struct
import cStringIO
from paramiko import util
class Message (object):
"""
An SSH2 I{Message} is a stream of bytes that encodes some combination of
strings, integers, bools, and infinite-precision integers (known in python
as I{long}s). This cl... |
import logging
from django.shortcuts import get_object_or_404
from django.views.generic import ListView, DetailView
from django.http import HttpResponsePermanentRedirect
from django.conf import settings
from django.core.urlresolvers import reverse
from rest_framework.renderers import JSONRenderer
from readthedocs.bui... |
import unittest
from cubes.cells import Cell, PointCut, SetCut, RangeCut
from cubes.cells import string_from_path, cut_from_string, path_from_string
from cubes.cells import cut_from_dict
from cubes.errors import CubesError, ArgumentError
from cubes.errors import HierarchyError, NoSuchDimensionError
from .common impor... |
#
# For help on setting up your machine and configuring this TestScript go to
# http://docs.bitbar.com/testing/appium/
#
import os
import time
import unittest
import subprocess
from appium import webdriver
from device_finder import DeviceFinder
from selenium.common.exceptions import WebDriverException
from testdroid_u... |
"""Balanced neuron example
-----------------------------
This script simulates a neuron driven by an excitatory and an
inhibitory population of neurons firing Poisson spike trains. The aim
is to find a firing rate for the inhibitory population that will make
the neuron fire at the same rate as the excitatory populatio... |
__doc__ = """
dbm compatibility module for Python versions that don't have dbm.
This does not not NOT (repeat, *NOT*) provide complete dbm functionality.
It's just a stub on which to hang just enough pieces of dbm functionality
that the whichdb.whichdb() implementstation in the various 2.X versions of
Python won't blo... |
import datetime
import os
import boto3
__all__ = [
'ec2_instance_attributes',
'export_name_bindings_to_file',
'export_name_bindings_to_environment',
'rebind_all',
'get_ec2_name_bindings',
'AWS_CONFIG_FILE'
]
# Constants
# Locations
AWS_CONFIG_DIR = os.path.expanduser('~/.ec2x')
AWS_CONFIG_FI... |
import netaddr
from nova import db
from nova import exception
from nova import flags
from nova import log as logging
from nova.network.quantum import melange_connection
LOG = logging.getLogger(__name__)
FLAGS = flags.FLAGS
def get_ipam_lib(net_man):
return QuantumMelangeIPAMLib()
class QuantumMelangeIPAMLib... |
import re
SU_PROMPT_LOCALIZATIONS = [
'Password',
'암호',
'パスワード',
'Adgangskode',
'Contraseña',
'Contrasenya',
'Hasło',
'Heslo',
'Jelszó',
'Lösenord',
'Mật khẩu',
'Mot de passe',
'Parola',
'Parool',
'Pasahitza',
'Passord',
'Passwort',
'Salasana',
... |
import pytest
from tests.support.asserts import assert_error, assert_files_uploaded, assert_success
from tests.support.inline import inline
from . import map_files_to_multiline_text
def element_send_keys(session, element, text):
return session.transport.send(
"POST", "/session/{session_id}/element/{elem... |
import xml.dom.minidom
from geopy.geocoders.base import Geocoder
from geopy.point import Point
from geopy.location import Location
from geopy import util
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
util.logger.warn("BeautifulSoup was not found. " \
"The SemanticMediaWiki geocoder... |
from openerp.addons.crm import crm
from openerp.osv import fields, osv
from openerp import tools
class crm_lead_report(osv.Model):
""" CRM Lead Analysis """
_name = "crm.lead.report"
_auto = False
_description = "CRM Lead Analysis"
_rec_name = 'date_deadline'
_inherit = ["crm.tracking.mixin"]
... |
#!/usr/bin/env python
from __future__ import absolute_import
import locale
import logging
import os
import optparse
import warnings
import sys
import re
from pip.exceptions import InstallationError, CommandError, PipError
from pip.utils import get_installed_distributions, get_prog
from pip.utils import deprecation, ... |
"""Helper functions for pickling and unpickling. Most functions assist in
determining the type of an object.
"""
from __future__ import absolute_import, division, unicode_literals
import base64
import collections
import io
import operator
import time
import types
import inspect
from . import tags
from .compat import ... |
import pytest
from csp import * #noqa
def test_backtracking_search():
assert (backtracking_search(australia) is not None) == True
assert (backtracking_search(australia, select_unassigned_variable=mrv) is not None) == True
assert (backtracking_search(australia, order_domain_values=lcv) is not None) == Tr... |
#!/usr/bin/env python
'''
show times when signal is lost
'''
import sys, time, os
# allow import from the parent directory, where mavlink.py is
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
from optparse import OptionParser
parser = OptionParser("sigloss.py [options]")
parser.a... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import tempfile
import unittest
from pants.backend.jvm.subsystems.shader import Shader, Shading
from pants.java.distribution.distribution import Distributio... |
#!/usr/bin/python
# Import the utility functions from the URL handling library
from django.conf.urls import url
# Import auth_views for login and logout methods
from django.contrib.auth import views as auth_views
from . import views
from . import api_imports
from . import api_exports
from . import apiV2
urlpatterns... |
"""GCS file system configuration for TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from tensorflow.contrib.cloud.python.ops import gen_gcs_config_ops
from tensorflow.python.framework import dtypes
from tensorflow.pyth... |
"""Unittest that directly tests the output of the pure-Python protocol
compiler. See //google/protobuf/reflection_test.py for a test which
further ensures that we can use Python protocol message objects as we expect.
"""
__author__ = '<EMAIL> (Will Robinson)'
import unittest
from google.protobuf.internal import test... |
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
import logging
import os
import subprocess
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.configuration import (
Configuration... |
from sympy import Symbol, Integer
from sympy.physics.quantum.qexpr import QExpr, _qsympify_sequence
from sympy.physics.quantum.hilbert import HilbertSpace
from sympy.core.containers import Tuple
x = Symbol('x')
y = Symbol('y')
def test_qexpr_new():
q = QExpr(0)
assert q.label == (0,)
assert q.hilbert_spa... |
import unittest
import unittest.mock
import test.support
import os
import os.path
import contextlib
import sys
import ensurepip
import ensurepip._uninstall
# pip currently requires ssl support, so we ensure we handle
# it being missing (http://bugs.python.org/issue19744)
ensurepip_no_ssl = test.support.import_fresh_m... |
"""
GNU Radio flowgraph blocks for use by ShinySDR.
This module is not an external API and not guaranteed to have a stable
interface.
"""
from __future__ import absolute_import, division
import math
import os
from zope.interface import Interface, implementer
from gnuradio import gr
from gnuradio import blocks
from... |
"""JSON token scanner
"""
import re
def _import_c_make_scanner():
try:
from simplejson._speedups import make_scanner
return make_scanner
except ImportError:
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))... |
"""
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import os
from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation
class PDFInput(InputFormatPlugin):
name = 'PDF Input'
author = 'Kovid Go... |
#!/usr/bin/python2.7
import os
import shutil
import tempfile
from google.apputils import basetest
from googleapis.codegen.filesys import files
class FilesTest(basetest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
for name in 'abc':
open(os.path.join(self.tempdir, name), 'w').write(... |
"""Test configs for rfft2d."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import ExtraTocoOptions
from te... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.ipa import IPAClient
class GroupIPAClient(IPAClien... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible.plugins.loader import lookup_loader
@pytest.mark.parametrize('env_var,exp_value', [
('foo', 'bar'),
('equation', 'a=b*100')
])
def test_env_var_value(monkeypatch, env_var, exp_value):
monke... |
class User(object):
def __init__(self, parent=None, id='', name=''):
if parent:
parent.owner = self
self.type = None
self.id = id
self.name = name
def __repr__(self):
return self.id
def startElement(self, name, attrs, connection):
return None
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_ut... |
# -*- coding:utf-8 -*-
"""
tests.backend
~~~~~~~~~~~~~
:copyright: (c) 2015 by Jason Lai.
:license: BSD, see LICENSE for more details.
"""
from faker import Factory
from functools import partial
fake = Factory.create()
def test_redis_backend_basic(rb, fake_manager, fake_coll):
fake_manager.co... |
#!/usr/bin/env python3
"""
Tests to validate redis list functionality is working properly with micropython
"""
# Notes:
#
# 1. These tests should be run with a cpython interpreter with the redislite module installed.
# 2. The micropython executable should be accesible in the path.
import logging
import redis
import red... |
"""Test the generation of UTXO snapshots using `dumptxoutset`.
"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_raises_rpc_error
import hashlib
from pathlib import Path
class DumptxoutsetTest(BitcoinTestFramework):
def set_test_params(self):
... |
from os import environ
from django.core.management.base import BaseCommand, CommandError
from registrations.models import SubscriptionRequest
from seed_services_client import StageBasedMessagingApiClient
from ._utils import validate_and_return_url
class Command(BaseCommand):
help = ("This command will loop al... |
import time
from datetime import datetime
from openerp.osv import osv
from openerp.report import report_sxw
from openerp.tools import amount_to_text_en
class payroll_advice_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payroll_advice_report, self).__init__(cr, uid, na... |
"""Command parsing module for TensorFlow Debugger (tfdbg)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import ast
import re
import sys
_BRACKETS_PATTERN = re.compile(r"\[[^\]]*\]")
_QUOTES_PATTERN = re.compile(r"(\"[^\"]*\"|\'[^\']*\... |
import copy, re
from anki.utils import intTime, joinFields, splitFields, ids2str,\
checksum, json
from anki.lang import _
from anki.consts import *
from anki.hooks import runHook
import time
# Models
##########################################################################
# - careful not to add any lists/dicts/... |
"""Self-test suite for Crypto.Hash.SHA"""
from Crypto.Util.py3compat import *
# Test vectors from various sources
# This is a list of (expected_result, input[, description]) tuples.
test_data = [
# FIPS PUB 180-2, A.1 - "One-Block Message"
('a9993e364706816aba3e25717850c26c9cd0d89d', 'abc'),
# FIPS PUB 1... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr
from frappe import _
from frappe.model.document import Document
class CustomField(Document):
def autoname(self):
self.set_fieldname()
self.name = self.dt + "-" + self.fieldname
def set_fieldname(self):
if not self.fieldname:
... |
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.timezone import now
from autoslug.fields import AutoSlugField
from funfactory.urlresolvers import reverse
from funfactory.utils import absolutify
from tower import ugettext as _
from tower import ugettext_lazy as _lazy
f... |
"""
Unit tests for user_management management commands.
"""
import sys
import ddt
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.core.management import call_command, CommandError
from django.test import TestCase
TEST_EMAIL = '<EMAIL>'
TE... |
"""Device function for replicated training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.core.framework import node_def_pb2
from tensorflow.python.framework import device as pydev
from tensorflow.python.platform import tf_lo... |
'''
Provide serialization and de-serialization of Google's protobuf Messages into/from JSON format.
'''
# groups are deprecated and not supported;
# Note that preservation of unknown fields is currently not available for Python (c) google docs
# extensions is not supported from 0.0.5 (due to gpb2.3 changes)
__version... |
'''
Copyright (C) 2014 Parrot SA
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following di... |
#!/usr/bin/env python
# Test whether a valid CONNECT results in the correct CONNACK packet using an
# SSL connection with client certificates required.
import subprocess
import socket
import ssl
import sys
import time
if sys.version < '2.7':
print("WARNING: SSL not supported on Python 2.6")
exit(0)
import i... |
"""More logging into task_instance
Revision ID: 338e90f54d61
Revises: 13eb55f81627
Create Date: 2015-08-25 06:09:20.460147
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '338e90f54d61'
down_revision = '13eb55f81627'
branch_labels = None
depends_on = None
def ... |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:par... |
from tensorflow.python.ops import array_ops
from keras import backend as K
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras.engine.topology import Layer
from keras import regularizers
class SoftAttnGRU(Layer):
def __init__(self,... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name='closure_linter',
version='2.3.14',
description='Closure Linter',
license='Apache',
author='The Closure Linter Authors',
author_email='<EMAIL>',
url='http://code.google.com/p/cl... |
"""Generate Google Mock classes from base classes.
This program will read in a C++ source file and output the Google Mock
classes for the specified classes. If no class is specified, all
classes in the source file are emitted.
Usage:
gmock_class.py header-file.h [ClassName]...
Output is sent to stdout.
"""
__aut... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.six import iteritems
from ansible.plugins.action import ActionBase
from ansible.utils.boolean import boolean
from ansible.utils.vars import isidentifier
class ActionModule(ActionBase):
TRANSFERS_FILES = ... |
"""
A few practical conventions common to all printers.
"""
from __future__ import print_function, division
import re
import collections
def split_super_sub(text):
"""Split a symbol name into a name, superscripts and subscripts
The first part of the symbol name is considered to be its actual
'nam... |
#!/usr/bin/env python3
##########################################################################################
# Date Started: 2017-01-01 (This is my new year's resolution)
# Purpose: Train recurrent neural network
##########################################################################################
##########... |
import atexit
import contextlib
import sys
from .ansitowin32 import AnsiToWin32
orig_stdout = None
orig_stderr = None
wrapped_stdout = None
wrapped_stderr = None
atexit_done = False
def reset_all():
if AnsiToWin32 is not None: # Issue #74: objects might become None at exit
AnsiToWin32(orig_stdout)... |
"""
GooglereseTranslator class for the Speaking in Tongues problem
for Google Code Jam 2012
Qualification
Link to problem description:
http://code.google.com/codejam/contest/1460488/dashboard#s=p0
author:
Christos Nitsas
(chrisn654)
language:
Python 3.2.1
date:
April, 2012
"""
from string import ascii_lowercase
... |
"""This module represents the Uyghur language.
.. seealso:: http://en.wikipedia.org/wiki/Uyghur_language
"""
from translate.lang import common
class ug(common.Common):
"""This class represents Uyghur."""
listseperator = u"، "
puncdict = {
u",": u"،",
u";": u"؛",
u"?": u"؟",
... |
#!/usr/bin/env python
import optparse
import os
import subprocess
def main():
p = optparse.OptionParser(
usage='%prog [options] [-x addon-1.0.xpi] [-c /path/to/addon-1.0/]')
p.add_option('-x', '--extract',
help='Extracts xpi into current directory',
action='store_true... |
print("hello world".index("ll"))
print("hello world".index("ll", None))
print("hello world".index("ll", 1))
print("hello world".index("ll", 1, None))
print("hello world".index("ll", None, None))
print("hello world".index("ll", 1, -1))
try:
print("hello world".index("ll", 1, 1))
except ValueError:
print("Raised... |
"""The Poisson distribution class."""
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.framework import ops
from tensorflow.python.frame... |
import textwrap
from unittest import TestCase
import xarray as xr
import numpy as np
from pysd.functions import cache
from numbers import Number
def runner(string, ns=None):
code = compile(string, '<string>', 'exec')
if not ns:
ns = dict()
ns.update({'cache': cache, 'xr': xr, 'np': np})
exec (... |
__author__ = 'api.jscudder (Jeff Scudder)'
import unittest
import getpass
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
import gdata.base.service
import gdata.service
import atom.service
import gdata.base
import atom
from gdata import test_data
username = ''
pass... |
from shinken_test import *
class TestNullInheritance(ShinkenTest):
def setUp(self):
self.setup_with_file('etc/shinken_nullinheritance.cfg')
# We search to see if null as value really delete the inheritance
# of a property
def test_null_inheritance(self):
svc = self.sched.services.find... |
"""
Dialogs.
Cross-platform and cross-application compatible. Some of them anyway.
(Not all dialogs work on PCs outside of FontLab. Some dialogs are for FontLab only. Sorry.)
Mac and FontLab implementation written by the RoboFab development team.
PC implementation by Eigi Eigendorf and is (C)2002 Eigi Eigendorf.
"""... |
from __future__ import absolute_import
from __future__ import print_function
import mock
from twisted.trial import unittest
from buildbot_worker.scripts import start
from buildbot_worker.test.util import misc
class TestStartCommand(unittest.TestCase, misc.IsWorkerDirMixin):
"""
Test buildbot_worker.script... |
"""
The GDAL/OGR library uses an Envelope structure to hold the bounding
box information for a geometry. The envelope (bounding box) contains
two pairs of coordinates, one for the lower left coordinate and one
for the upper right coordinate:
+----------o Upper right; (max_x, max_y)
... |
import netrc, os, unittest, sys
from test import test_support
TEST_NETRC = """
machine foo login log1 password pass1 account acct1
macdef macro1
line1
line2
macdef macro2
line3
line4
default login log2 password pass2
"""
temp_filename = test_support.TESTFN
class NetrcTestCase(unittest.TestCase):
def setUp (... |
import pytest
from ...tests import context_wrap
from ..chkconfig import ChkConfig
from insights.parsers import SkipException
SERVICES = """
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kdump 0... |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import reverse_lazy
from django.views.i18n import JavaScriptCatalog
admin.autodiscover()
urlpatterns = [
url(r'^', include('caffeine.urls... |
"""
Better Figures & Images
------------------------
This plugin:
- Adds a style="width: ???px; height: auto;" to each image in the content
- Also adds the width of the contained image to any parent div.figures.
- If RESPONSIVE_IMAGES == True, also adds style="max-width: 100%;"
- Corrects alt text: if alt == imag... |
"""SCons.exitfuncs
Register functions which are executed when SCons exits for any reason.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.