content string |
|---|
#=========================================================================
# StrSearchFunc_test.py
#=========================================================================
#
# PyMTL Functional Model of strsearch.
from pymtl import *
from StrSearchOO_test import strings, docs, reference
#---------------------... |
""" Functions for converting from DOS to UNIX line endings
"""
from __future__ import division, absolute_import, print_function
import sys, re, os
def dos2unix(file):
"Replace CRLF with LF in argument files. Print names of changed files."
if os.path.isdir(file):
print(file, "Directory!")
ret... |
#!/usr/bin/env python
"""
A distutils installation script for txBOM.
"""
from distutils.core import setup
import txbom
long_description = """txBOM is a Python Twisted package that lets you retrieve forecasts
and observations from the Australian Bureau of Meteorology (BOM).
Use it to integrate non blocking retrieva... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import os.path
import oauth2 as oauth
import json
from font_colors import font_colors
import getrel
import setfav
import time
from torrentApi import torrent_api as api
#name of config file where all keys get stored
config = '~/.config/getrel/getrel.json'
nzb_pa... |
# -*- coding: utf-8 -*-
from django.contrib.sites.models import Site
from django.test.utils import override_settings
from cms.models import Page
from cms.api import create_page, assign_user_to_page
from cms.cache.permissions import (get_permission_cache, set_permission_cache,
clear_u... |
import logging
import os
import codecs
import simplejson as json
from nose.tools import nottest
from onlinelinguisticdatabase.tests import TestController, url
import onlinelinguisticdatabase.model as model
from onlinelinguisticdatabase.model import Phonology
from onlinelinguisticdatabase.model.meta import Session
impor... |
import numpy
import chainer
from chainer import cuda
from chainer import function
from chainer import utils
from chainer.utils import type_check
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
_mode = cudnn.cudnn.CUDNN_ACTIVATION_RELU
class GuidedReLU(function.Function):
"""Rectified Linear Unit."""
# T... |
from pyspark.sql import Row
from pyspark.testing.sqlutils import ReusedSQLTestCase
class GroupTests(ReusedSQLTestCase):
def test_aggregator(self):
df = self.df
g = df.groupBy()
self.assertEqual([99, 100], sorted(g.agg({'key': 'max', 'value': 'count'}).collect()[0]))
self.assertEqu... |
# -*- coding: utf-8 -*-
"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
Native Python implementation the C module is not compiled.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from markupsafe import Markup
from markupsafe._compat import text_type
def escape(... |
"""Tests for fused_batch_norm related functionality in tensorflow.ops.nn."""
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.ops import array_ops
from tensorflow.... |
# -*- coding: utf-8 -*-
from cms.models import CMSPlugin, Placeholder
from cms.models.aliaspluginmodel import AliasPluginModel
from cms.models.placeholderpluginmodel import PlaceholderReference
from cms.plugin_base import CMSPluginBase, PluginMenuItem
from cms.plugin_pool import plugin_pool
from cms.plugin_rendering im... |
from __future__ import division
"""
Author: Keith Bourgoin, Emmett Butler
"""
__license__ = """
Copyright 2015 Parse.ly, Inc.
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.o... |
"""
=========================================
Comparison of Manifold Learning methods
=========================================
An illustration of dimensionality reduction on the S-curve dataset
with various manifold learning methods.
For a discussion and comparison of these algorithms, see the
:ref:`manifold module... |
from datetime import datetime, timedelta
import uuid
from odoo import fields, models, api, registry, _
from odoo.addons.base.models.res_partner import _tz_get
from odoo.exceptions import UserError
from odoo.tools.misc import _format_time_ago
from odoo.http import request
from odoo.osv import expression
class Website... |
"""Add principal group system
Revision ID: 1d84b7d16aa9
Revises: 179651effcbd
Create Date: 2015-08-07 00:05:42.996683
"""
# revision identifiers, used by Alembic.
revision = '1d84b7d16aa9'
down_revision = '179651effcbd'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def u... |
"""
Classes to support XML for serial devices
http://libvirt.org/formatdomain.html#elementCharSerial
"""
from virttest.libvirt_xml import base, accessors, xcepts
from virttest.libvirt_xml.devices.character import CharacterBase
class Serial(CharacterBase):
__slots__ = ('protocol_type', 'target_port', 'target_ty... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import ansible.constants as C
from ansible.compat.six import string_types
from ansible.compat.six.moves.urllib.error import HTTPError
from ansible.compat.six.moves.urllib.parse import quote as urlquote, urlencode
from ... |
import sys, dia, string
def _log(s, append=1) :
pass
if append :
mode = "a"
else :
mode = "w"
f = open("c:\\temp\\otypes.log", mode)
f.write(s)
def otypes_cb(data, flags) :
if data :
diagram = None # we may be running w/o GUI
else :
diagram = dia.new("Object Types.dia")
data = diagram.data
layer = ... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
def parse_vgs(data):
vgs = []
for line in data.splitlines():
parts = line.strip().split(';')
vgs.append({
'name': parts[0],
'pv_count': int(p... |
from __future__ import unicode_literals
from .common import InfoExtractor
class FoxgayIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P<id>\d+)\.shtml'
_TEST = {
'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml',
'md5': '80d72beab5d04e1655a56ad37... |
import uno
import string
import unohelper
import xmlrpclib
from com.sun.star.task import XJobExecutor
if __name__<>"package":
from lib.gui import *
from lib.error import ErrorDialog
from lib.functions import *
from lib.logreport import *
from lib.rpc import *
from ServerParameter import *
da... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vyos import get_config, load_config
from ansible.module_utils.vyos import vyos_argument_spec... |
import sys, os
from subprocess import call as subcall
class Detect():
doc_path = ''
icon = ''
def open_method(filename):
pass
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and sto... |
import unittest
from test import support
# For scope testing.
g = "Global variable"
class DictComprehensionTest(unittest.TestCase):
def test_basics(self):
expected = {0: 10, 1: 11, 2: 12, 3: 13, 4: 14, 5: 15, 6: 16, 7: 17,
8: 18, 9: 19}
actual = {k: k + 10 for k in range(10)... |
import FreeCAD
import Units
# Systems of length units
LENGTH_UNITS = ('mm', 'm', 'in', 'in')
MASS_UNITS = ('kg', 'kg', 'lb', 'lb')
TIME_UNITS = ('s', 's', 's', 's')
ANGLE_UNITS = ('deg', 'deg', 'deg', 'deg')
def getLengthUnits():
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units")
units_id ... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_iso8601,
int_or_none,
xpath_attr,
xpath_element,
)
class TwentyFourVideoIE(InfoExtractor):
IE_NAME = '24video'
_VALID_URL = r'''(?x)
https?://
... |
class _NsiqCppStyleState(object):
"""Maintains module-wide state.."""
def __init__(self):
self.error_count = 0 # global count of reported errors
# filters to apply when emitting error messages
self.checkers = []
self.errorPerChecker = {}
self.errorPerFile = {}
... |
__author__ = 'Vic Fryzel <<EMAIL>>'
import unittest
import atom.core
from gdata import test_data
import gdata.calendar_resource.data
import gdata.test_config as conf
class CalendarResourceEntryTest(unittest.TestCase):
def setUp(se... |
''' The resources module provides the Resources class for easily configuring
how BokehJS code and CSS resources should be located, loaded, and embedded in
Bokeh documents.
Also provides some pre-configured Resources objects:
Attributes:
CDN : load minified BokehJS from CDN
INLINE : provide minified BokehJS fr... |
"""
websubmit database models.
"""
# General imports.
from invenio.ext.sqlalchemy import db
# Create your models here.
class SbmACTION(db.Model):
"""Represents a SbmACTION record."""
__tablename__ = 'sbmACTION'
lactname = db.Column(db.Text, nullable=True)
sactname = db.Column(db.Char(3), nullable=Fal... |
""" Python 'unicode-escape' Codec
Written by Marc-Andre Lemburg (<EMAIL>).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is intended.
... |
import os
import sys
import time
import subprocess
import threading
from itertools import chain
from werkzeug._internal import _log
from werkzeug._compat import PY2, iteritems, text_type
def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules,... |
#!/usr/bin/env python
"""JSON token scanner
"""
import re
def _import_c_make_scanner():
try:
from mapreduce.lib.simplejson._speedups import make_scanner
return make_scanner
except ImportError:
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner']
NUMBER_RE = ... |
# syscat.py - parses some system catalogs
# inspired from the PostgreSQL tutorial
# adapted to Python 1995 by Pascal ANDRE
print """
__________________________________________________________________
MODULE SYSCAT.PY : PARSES SOME POSTGRESQL SYSTEM CATALOGS
This module is designed for being imported from python prom... |
"""Allow Google Apps domain administrators to manage groups, group members and group owners.
GroupsService: Provides methods to manage groups, members and owners.
"""
__author__ = '<EMAIL>'
import urllib
import gdata.apps
import gdata.apps.service
import gdata.service
API_VER = '2.0'
BASE_URL = '/a/feeds/group/... |
"""
An auto-completion window for IDLE, used by the AutoComplete extension
"""
from tkinter import *
from idlelib.MultiCall import MC_SHIFT
from idlelib.AutoComplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES
HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>"
HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>")
KEYPR... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'RestrictedCourse.disable_access_check'
db.add_column('emb... |
''' Plugin for CudaText editor
Authors:
Andrey Kvichansky (kvichans on github.com)
Alexey Torgashin (CudaText)
Version:
'0.8.9 2021-04-05'
'''
import os
import cudatext as app
from cudatext import ed
import cudatext_cmd as cmds
import cudax_lib as apx
from .cd_p... |
from __future__ import absolute_import, print_function, unicode_literals, division
from jormungandr import i_manager
from jormungandr.interfaces.v1.ResourceUri import ResourceUri
from jormungandr.interfaces.parsers import default_count_arg_type
from jormungandr.interfaces.v1.decorators import get_obj_serializer
from jo... |
import logging
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Textarea
from django.template import loader
from django.utils import six, translation
# Creating a template context that contains Django settings
# values n... |
import attr
from navmazing import NavigateToAttribute
from navmazing import NavigateToSibling
from cfme.common import Taggable
from cfme.common import TaggableCollection
from cfme.common import TagPageView
from cfme.containers.provider import ContainerObjectAllBaseView
from cfme.containers.provider import ContainerObj... |
import os
from threading import Lock
from whoosh.compat import BytesIO
from whoosh.index import _DEF_INDEX_NAME
from whoosh.store import Storage
from whoosh.support.filelock import FileLock
from whoosh.filedb.structfile import StructFile
class ReadOnlyError(Exception):
pass
class FileStorage(Storage):
"""S... |
from neutron_lib import constants
from oslo_utils import uuidutils
import testscenarios
from neutron.agent.common import ovs_lib
from neutron.agent.linux import bridge_lib
from neutron.agent.linux import tc_lib
from neutron.agent.linux import utils
from neutron.services.qos import qos_consts
from neutron.tests.fullsta... |
from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
'A simplified logging system'
DEBUG = 0
INFO = 1
WARN = 2
ERROR = 3
import sys, traceback, cStringIO
from functools import partial
from threading import RLock
from calibr... |
from test_osv import *
from test_translate import *
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# XXX Earlier version of this test also tested put, get, eval on the
# engine, however this introduced action at a distance where aspects
# of the sys state changed (notably sys.stdin.newlines), which then
# impacted test_univnewlines later in the regrtest.
#
# For now, there may be limits in how much we can test Jytho... |
"""
:Author: Joshua Morton
"""
class And(object):
"""
represents a set of prerequisites that must be taken together
"""
def __init__(self, *components):
"""
initializes the And object
self - the And
components: List[Union[Course, Or]] - the set of prerequisites that
... |
"""Tests for Clip Operations."""
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 ops
from tensorflow.python.framework import test_util
from tensorflow.python.ops imp... |
import base64
from oslo_config import cfg
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class UserDataJsonTest(api_sample_base.Api... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Unit tests for meaning.py"""
import meaning
import unittest
class KnownValues(unittest.TestCase):
knownParserValues = (
("*German: [[wichtig]]",
[('de','wichtig','',1,False,'')]
),
("*[[Esperanto]]:... |
"""
Tests related to the Microsites feature
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from courseware.tests.helpers import LoginEnrollmentTestCase
from course_modes.models import CourseMode
from... |
#! test fragment decomposition + to/from_dict
import numpy as np
import psi4
from psi4.driver import qcdb
psi4.set_output_file("output.dat", False)
def test_chgmult(expected, cgmpdict, label):
rc, rfc, rm, rfm = expected
qcdb.compare_integers(rc, cgmpdict['molecular_charge'], label + ': c')
qcdb.compare_... |
{
'name': 'Hungarian - Accounting',
'version': '1.0',
'category': 'Localization/Account Charts',
'description': """
Base module for Hungarian localization
==========================================
This module consists :
- Generic Hungarian chart of accounts
- Hungarian taxes
- Hungarian Bank info... |
#
# On Unix we run a server process which keeps track of unlinked
# semaphores. The server ignores SIGINT and SIGTERM and reads from a
# pipe. Every other process of the program has a copy of the writable
# end of the pipe, so we get EOF when all other processes have exited.
# Then the server process unlinks any remai... |
NAME = 'PyYAML'
VERSION = '3.06'
DESCRIPTION = "YAML parser and emitter for Python"
LONG_DESCRIPTION = """\
YAML is a data serialization format designed for human readability and
interaction with scripting languages. PyYAML is a YAML parser and
emitter for Python.
PyYAML features a complete YAML 1.1 parser, Unicode s... |
import math
def limit(number, lower, upper):
assert lower < upper or (lower is None or upper is None)
if lower and number < lower:
number = lower
if upper and number > upper:
number = upper
# TODO: remove these asserts and make tests
assert number <= upper or not upper
assert nu... |
import unittest
import mock
from oauth2client import _pkce
class PKCETests(unittest.TestCase):
@mock.patch('oauth2client._pkce.os.urandom')
def test_verifier(self, fake_urandom):
canned_randomness = (
b'\x98\x10D7\xf3\xb7\xaa\xfc\xdd\xd3M\xe2'
b'\xa3,\x06\xa0\xb0\xa9\xb4\x8f... |
# -*- coding: utf-8 -*-
import unittest
import textwrap
import antlr3
import antlr3.tree
import testbase
import sys
from StringIO import StringIO
class T(testbase.ANTLRTest):
def setUp(self):
self.oldPath = sys.path[:]
sys.path.insert(0, self.baseDir)
def tearDown(self):
sys.path = s... |
"""Test that inheriting from something which is not
a class emits a warning. """
# pylint: disable=no-init, import-error, invalid-name
# pylint: disable=missing-docstring, too-few-public-methods, no-absolute-import
from missing import Missing
if 1:
Ambiguous = None
else:
Ambiguous = int
class Empty(object):... |
"""Internationalization and localization support.
This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.
I18N refers to the operation by which a program is made aware of multiple
languages. L10N r... |
from __future__ import print_function
import unittest
import numpy as np
np.random.seed(1337)
from keras.models import Graph, Sequential
from keras.layers import containers
from keras.layers.core import Dense, Activation
from keras.utils.test_utils import get_test_data
X = np.random.random((100, 32))
X2 = np.random.r... |
from rekall import addrspace
from rekall import obj
from rekall import testlib
from rekall import session
class CustomRunsAddressSpace(addrspace.RunBasedAddressSpace):
def __init__(self, runs=None, data=None, **kwargs):
super(CustomRunsAddressSpace, self).__init__(**kwargs)
self.base = addrspace.B... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
url_or_none,
urlencode_postdata,
)
class HiDiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hidive\.com/s... |
from sqlalchemy import select, Column, Integer, MetaData, Table
from nova import exception
from nova import flags
FLAGS = flags.FLAGS
def upgrade_libvirt(instances, instance_types):
# Update instance_types first
tiny = None
for inst_type in instance_types.select().execute():
if inst_type['name']... |
import logging
import re
import sys
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger('check-whitespace')
CR_RE = re.compile(r'\r')
LEADING_WHITESPACE_RE = re.compile(r'\s+')
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
NO_NEWLINE_RE... |
""" The common module contains general-purpose functions potentially used by multiple modules in the system."""
import uuid
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure, InvalidName
from werkzeug.contrib.cache import SimpleCache
from voluptuous import Invalid, MultipleInvalid
from hashl... |
"""
This should be runned in a cron to process search histories and compute stats
"""
from optparse import make_option
from django.core.management.base import BaseCommand
from sesql import config
from sesql.lemmatize import lemmatize
from sesql.models import SearchHit
from sesql.models import SearchQuery
from sesql.m... |
import logging
import openerp
from openerp.osv import fields, osv, orm
from datetime import date, datetime, time, timedelta
from openerp.addons.base.ir.ir_cron import _intervalTypes
from openerp import SUPERUSER_ID
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.http import request
from openerp.to... |
import os, sys, re
this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(this_dir, "..")))
from common import dict_has_non_empty_member
# We package the python markdown module already in /support/module/support/markdown.
module_support_dir = os.path.abspath(os.path.join(t... |
'''
Created on May 25, 2017
This file is subject to the terms and conditions defined in the
file 'LICENSE.txt', which is part of this source code package.
@author: David Moss
'''
# Organization short name, which allows us to send emails to this organization's administrators
ORGANIZATION_SHORT_NAME = "family"
# NOTE... |
# encoding: utf-8
"""
Styles object, container for all objects in the styles part.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from warnings import warn
from . import BabelFish
from .latent import LatentStyles
from ..shared import ElementProxy
from .style import Ba... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import shutil
import sys
from setuptools import setup
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("_... |
"""
=========================================================
The Iris Dataset
=========================================================
This data sets consists of 3 different types of irises'
(Setosa, Versicolour, and Virginica) petal and sepal
length, stored in a 150x4 numpy.ndarray
The rows being the samples and th... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_config
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosConfigModule(TestNxosModule):
module = nxo... |
#!usr/bin/python
# -*- coding: utf-8 -*-
__plugins__ = ('LowContrast', 'HiContrast', 'OverExposed', 'UnderExposed')
__version__ = '2011-03-20'
__author__ = 'Karol Będkowski'
__copyright__ = "Copyright (c) Karol Będkowski, 2011"
import ImageEnhance
from photomagick.common.base_filter import BaseFilter
from photomagic... |
import os
import sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(
os.path.join(BASE_DIR, 'apps')
)
# Quick-start development settings - unsuitable for production... |
"This is the locale selecting middleware that will look at accept headers"
from django.conf import settings
from django.core.urlresolvers import (
LocaleRegexURLResolver, get_resolver, get_script_prefix, is_valid_path,
)
from django.http import HttpResponseRedirect
from django.utils import translation
from django.... |
import unittest
import IECore
import IECoreRI
import os.path
import os
class DoubleSidedTest( IECoreRI.TestCase ) :
def test( self ) :
r = IECoreRI.Renderer( "test/IECoreRI/output/testDoubleSided.rib" )
self.assertEqual( r.getAttribute( "doubleSided" ), IECore.BoolData( True ) )
r.setAttribute( "doubleSided"... |
from base64 import b64encode
import json
from redash.models import DataSource
def convert_p12_to_pem(p12file):
from OpenSSL import crypto
with open(p12file, 'rb') as f:
p12 = crypto.load_pkcs12(f.read(), "notasecret")
return crypto.dump_privatekey(crypto.FILETYPE_PEM, p12.get_privatekey())
if __... |
#!/usr/bin/env python
"""
Auxiliary functions for f2py2e.
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <<EMAIL>>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) LICENSE.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
$D... |
from esc import NUL, blank
import escargs
import esccmd
import escio
from esctypes import Point, Rect
from escutil import AssertEQ, AssertScreenCharsInRectEqual, GetCursorPosition, knownBug
class ELTests(object):
def prepare(self):
"""Initializes the screen to abcdefghij on the first line with the cursor
on ... |
"""Generic Node base class for all workers that run on hosts."""
import errno
import logging as std_logging
import os
import random
import signal
import sys
import time
try:
# Importing just the symbol here because the io module does not
# exist in Python 2.6.
from io import UnsupportedOperation # noqa
e... |
from keystone.common import kvs
class Ec2(kvs.Base):
# Public interface
def get_credential(self, credential_id):
credential_ref = self.db.get('credential-%s' % credential_id)
return credential_ref
def list_credentials(self, user_id):
credential_ids = self.db.get('credential_list',... |
#!/usr/bin/env python3
def func1():
if j < 0:
if (32768 >> (-j-1)) < x1:
return y2
else:
return x1 << -j
else:
return x1 >> j
def func2():
if j < 0:
return y >> -j
else:
return y << j
x1 = int(input())
x0 = 0
a = 0
y = 0
... |
from __future__ import unicode_literals
import six
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from openid.consumer import consumer
from openid.consumer.discover import DiscoveryFailure
from openid.extensions import ax, pape, sreg
from openid.server.... |
#!/usr/bin/env python
"""Some solvers"""
# KaFKA A fast Kalman filter implementation for raster based datasets.
# Copyright (c) 2017 J Gomez-Dans. All rights reserved.
#
# This file is part of KaFKA.
#
# KaFKA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licens... |
# -*- coding: utf-8 -*-
import importlib
import inspect
import os
import sys
from itertools import chain
from os.path import dirname, join as jp, splitext
CWD = dirname(sys.modules[__name__].__file__)
sys.path.insert(0, jp(CWD, '..'))
from chibitest import runner, TestCase, Benchmark
help_message = """\
Options:
... |
from django.contrib.auth.models import User
from django.core import urlresolvers
from django.db.models.signals import post_save
from django.test import override_settings
from mock import patch
from malaria24.ona.models import (
ReportedCase,
new_case_alert_ehps,
new_case_alert_mis, new_case_alert_jembi)
f... |
from django.core.management.base import LabelCommand
from django.template import loader
from django.template import TemplateDoesNotExist
import sys
from django_extensions.management.utils import signalcommand
def get_template_path(path):
try:
template = loader.find_template(path)
if template[1]:
... |
import os
import tempfile
from cerbero.packages.osx.info_plist import ComponentPropertyPlist
from cerbero.utils import shell
class PackageBuild(object):
''' Wrapper for the packagebuild application '''
CMD = 'pkgbuild'
def create_package(self, root, pkg_id, version, title, output_file,
... |
import osc.core
import osc.oscerr
import os
import sys
from common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'addfile_fixtures')
def suite():
import unittest
return unittest.makeSuite(TestAddFiles)
class TestAddFiles(OscTestCase):
def _get_fixtures_dir(self):
return FIXTURES_DIR... |
import unittest
import decimal
import ddt
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from util.testing import UrlResetMixin
from embargo.test_utils import restrict_course
from xmodule.modul... |
from time import sleep
from airflow.exceptions import AirflowException, AirflowSensorTimeout, \
AirflowSkipException
from airflow.models import BaseOperator
from airflow.utils import timezone
from airflow.utils.decorators import apply_defaults
class BaseSensorOperator(BaseOperator):
"""
Sensor operators ... |
from __future__ import print_function
from pylearn2.models.s3c import S3C
from pylearn2.models.s3c import E_Step_Scan
from pylearn2.models.s3c import Grad_M_Step
from pylearn2.models.s3c import E_Step
from pylearn2.utils import contains_nan
from theano import function
import numpy as np
from theano.compat.six.moves im... |
#!/usr/bin/env python
import sys
from AlgsSedgewickWayne.Selection import Sort
from AlgsSedgewickWayne.testcode.ArrayHistory import chk
from AlgsSedgewickWayne.testcode.ArrayHistory import ArrayHistory
from AlgsSedgewickWayne.testcode.InputArgs import cli_get_array
def test_wk2_lec(prt=sys.stdout):
"""Example fro... |
import os
import sys
import argparse
import collections
import multiprocessing as mp
import glob
import subprocess
import shlex
import re
import sz_collapse
import sz_acount
import sz_mergeAC
import sz_filter
import sz_fisher
import sz_cmh
import sz_plotting
import sz_overlap
import sz_prepVCF
import sz_view
import sz... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import sys
import time
from termios import tcflush, TCIFLUSH
from ansible.errors import *
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
''' pauses execution for a length or tim... |
"""Operations often used for initializing tensors.
All variable initializers returned by functions in this file should have the
following signature:
def _initializer(shape, dtype=dtypes.float32, partition_info=None):
Args:
shape: List of `int` representing the shape of the output `Tensor`. Some
initialize... |
from __future__ import print_function, division
import argparse
import os
import re
import struct
import sys
import hashlib
import binascii
MAX_PARTITION_LENGTH = 0xC00 # 3K for partition data (96 entries) leaves 1K in a 4K sector for signature
SHA256_PARTITION_BEGIN = b"\xEB\xEB" + b"\xFF" * 14 # The first 2 bytes... |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.