content stringlengths 4 20k |
|---|
"""SCons.Scanner.RC
This module implements the depenency scanner for RC (Interface
Definition Language) files.
"""
#
# 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 ... |
import unittest
import logging
from nose.tools import eq_
LOG = logging.getLogger('test_ofproto')
class TestOfprotCommon(unittest.TestCase):
""" Test case for ofproto
"""
def test_ofp_event(self):
import ryu.ofproto
reload(ryu.ofproto)
import ryu.controller.ofp_event
rel... |
#!/usr/bin/env python
"""This modules contains tests for clients API renderers."""
from grr.gui import api_test_lib
from grr.gui.api_plugins import client as client_plugin
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import test_lib
from grr.lib.rdfvalues import client a... |
"""Our workflows."""
from __future__ import absolute_import, division, print_function
from .hep_approval import HEPApproval
from .merge_approval import MergeApproval
from .author_approval import AuthorApproval |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Version.privacy_level'
db.add_column('builds_version', 'privacy_level',
... |
"""Tests for the legacy_api_password auth provider."""
import pytest
from homeassistant import auth, data_entry_flow
from homeassistant.auth import auth_store
from homeassistant.auth.providers import legacy_api_password
@pytest.fixture
def store(hass):
"""Mock store."""
return auth_store.AuthStore(hass)
@p... |
from oslo_log import versionutils
from keystone.auth.plugins import mapped
@versionutils.deprecated(
versionutils.deprecated.MITAKA,
what='keystone.auth.plugins.saml2.Saml2',
in_favor_of='keystone.auth.plugins.mapped.Mapped',
remove_in=+2)
class Saml2(mapped.Mapped):
"""Provide an entry point to ... |
from __future__ import (absolute_import, division, print_function)
import unittest
import mantid
from sans.state.slice_event import (StateSliceEvent, get_slice_event_builder)
from sans.state.data import get_data_builder
from sans.common.enums import (SANSFacility, SANSInstrument)
from state_test_helper import (assert_... |
"""Tool for adding anomalies to data sets."""
import random
import sys
from nupic.data.file_record_stream import FileRecordStream
USAGE = """
Usage:
python anomalyzer.py input output action extraArgs
Actions:
add
extraArgs: column start stop value
Adds value to each element in range [start, stop].
sca... |
'''
This file implements the test cases using GTK GUI
'''
# “Wrong continued indentation”: pylint: disable=bad-continuation
# pylint: disable=attribute-defined-outside-init
# pylint: disable=missing-function-docstring
# pylint: disable=missing-class-docstring
# pylint: disable=global-statement
# pylint: disable=wrong-i... |
"""
Module implementing a dialog to select multiple shelve names.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QDialog, QDialogButtonBox
from .Ui_HgShelvesSelectionDialog import Ui_HgShelvesSelectionDialog
class HgShelvesSelectionDialog(QDialog, Ui_HgShe... |
from sqlalchemy import (Table, Column, MetaData, Integer, String, Boolean,
PickleType, Text, create_engine, select)
from sqlalchemy.orm import scoped_session, sessionmaker
import urllib2
import json
import getpass
import pprint
import sys
import os.path
import time
DB_ENGINE = "sqlite:////tmp/... |
import netaddr
from oslo_config import cfg
from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron import context
import neutron.ipam as ipam
from neutron.ipam import subnet_alloc
from neutron import manager
from neutron.openstack.common im... |
import pytest
import re
import time
import uuid
from testutils.api import useradm
from testutils.api.client import ApiClient
from testutils.infra.container_manager.kubernetes_manager import isK8S
from testutils.infra.smtpd_mock import smtp_mock
from testutils.common import (
clean_mongo,
create_org,
mongo... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
from braces.views import LoginRequiredMixin
from rest_framework.generics import ListCreateAPIView
from rest_fram... |
"""MLCL data item."""
from .. import variables
from .base import DataItemBase
class MLCL(DataItemBase):
"""
Message length.
:Types:
- :class:`U8 <secsgem.secs.variables.U8>`
- :class:`U1 <secsgem.secs.variables.U1>`
- :class:`U2 <secsgem.secs.variables.U2>`
- :class:`U4 <secsg... |
import sys, os, inspect
from swiftclient.shell import main
def get_script_dir(follow_symlinks=True):
if getattr(sys, 'frozen', False): # py2exe, PyInstaller, cx_Freeze
path = os.path.abspath(sys.executable)
else:
path = inspect.getabsfile(get_script_dir)
if follow_symlinks:
... |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_LNA_XDXT_BUSINESS_EXTENSION').setMaster(sys.argv[2])
sc = SparkContext(conf... |
# You are given an array A of size N, and Q queries to deal with. For each query, you are given an integer X, and
# you're supposed to find out if X is present in the array A or not.
#
# Input:
# The first line contains two integers, N and Q, denoting the size of array A and number of queries. The second line
# contain... |
import os
import re
from TapConverter import TapConverter
import settings
import sandschreiber
from werkzeug import secure_filename
from flask import Flask, render_template, request, redirect, jsonify
app = Flask(__name__)
app.jinja_env.filters['basename'] = os.path.basename
ss = sandschreiber.AsyncSandschreiber(sett... |
#!/usr/bin/env python
"""
Tables Extension for Python-Markdown
====================================
Added parsing of tables to Python-Markdown.
A simple example:
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
Copyright 2009 - [Wa... |
class Deque:
"""
An implementation of a deck that allows pushing and popping from both the
front and the back of a doubly linked list.
"""
def __init__(self):
"""
Initializes an empty deque.
"""
self._length = 0
self._first = None
self._last = None
... |
keyCodes = {}
# Numbers
keyCodes["0"] = 0x30
keyCodes["1"] = 0x31
keyCodes["2"] = 0x32
keyCodes["3"] = 0x33
keyCodes["4"] = 0x34
keyCodes["5"] = 0x35
keyCodes["6"] = 0x36
keyCodes["7"] = 0x37
keyCodes["8"] = 0x38
keyCodes["9"] = 0x39
# Special
keyCodes["ENTER"] = 0x0D
keyCodes["`"] = 0xC0
keyCodes["T... |
import unittest
import unittest.mock
import pytest
from sqlalchemy.exc import SQLAlchemyError
from test.common_helper import get_config_for_testing
from web_interface import frontend_main
from web_interface.components import user_management_routes
from web_interface.components.user_management_routes import UserManage... |
#!BPY
"""
Name: 'WebGL JavaScript (.js)'
Blender: 244
Group: 'Export'
Tooltip: 'WebGL JavaScript'
"""
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2010 Dennis Ippel
#
# This program is free software; you can redistribute it and/or... |
"""Memory module for storing "nearest neighbors".
Implements a key-value memory for generalized one-shot learning
as described in the paper
"Learning to Remember Rare Events"
by Lukasz Kaiser, Ofir Nachum, Aurko Roy, Samy Bengio,
published as a conference paper at ICLR 2017.
"""
import numpy as np
import tensorflow a... |
import datetime
from errno import ENOENT, EACCES, EPERM
class CpuAcctStat:
'Class for cpu metric for a docker container'
cpuacctPath = '/sys/fs/cgroup/cpuacct/docker/'
def __init__(self, containerId, containerName):
self.containerId = containerId
self.containerName = containerName
self.t... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
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 limitation the... |
"""
Tools to identify collocations --- words that often appear consecutively
--- within corpora. They may also be used to find other associations between
word occurrences.
See Manning and Schutze ch. 5 at http://nlp.stanford.edu/fsnlp/promo/colloc.pdf
and the Text::NSP Perl package at http://ngram.sourceforge.net
Find... |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
# flake8: noqa
from __future__ import unicode_literals
from django import forms
# from django.contrib.auth.models import User
# from django.core.urlresolvers import reverse
from django.test import TestCase
from djangobmf.models import Configuration
from djangobmf.sites ... |
"""Test different accessory types: Switches."""
from datetime import timedelta
import pytest
from homeassistant.components.homekit.const import (
ATTR_VALUE, TYPE_FAUCET, TYPE_SHOWER, TYPE_SPRINKLER, TYPE_VALVE)
from homeassistant.components.homekit.type_switches import (
Outlet, Switch, Valve)
from homeassis... |
'''
Created on 23/8/2014
@author: Alberto
'''
from random import randrange
from details import Detail
import pygame as py
from settings import SCREEN_WIDTH, SCREEN_HEIGHT
class Scene(object):
def __init__(self):
self.upper_platform = py.image.load("resources/graphics/upper_platform.png").convert_alpha(... |
import sys
from purplescript.parser import Parser
input = sys.stdin
output = sys.stdout
class Compiler:
def __init__(self, tree, file = sys.stdout):
""" Compiler(tree, file=sys.stdout) -> None.
Prints the source for tree to file.
"""
self.f = file
self._indent = 0
self._variable = 'semi' # semi -> $ex... |
"""Test the binascii C module."""
from test_support import verbose
import binascii
# Show module doc string
print binascii.__doc__
# Show module exceptions
print binascii.Error
print binascii.Incomplete
# Check presence and display doc strings of all functions
funcs = []
for suffix in "base64", "hqx", "uu":
pre... |
from Gaudi.Configuration import *
from Configurables import DaVinci
from Configurables import FilterDesktop
from Configurables import CombineParticles
############# Global settings
down = False
evtmax = 100000
isMC = False
year = 2015
highMult = False
ns25 = True
#### Stripping filter
from Configurables imp... |
import logging
import numpy as np
from gensim.models import CoherenceModel
from pimlico.core.modules.base import BaseModuleExecutor
from pimlico.datatypes.corpora import is_invalid_doc
from pimlico.utils.progress import get_progress_bar
class ModuleExecutor(BaseModuleExecutor):
def execute(self):
topics... |
"""
Convenience module for connecting to Java
Author: Amanda Carpenter
"""
import sys
from contextlib import contextmanager
from traceback import format_exc
isPy4J = False
try:
from py4j.java_gateway import JavaGateway, GatewayParameters, CallbackServerParameters
isPy4J = True
except ImportErro... |
import numpy as np
import Graphics as artist
import matplotlib.pyplot as plt
from numpy.random import random_sample
from matplotlib import rcParams
from numpy.random import randint
from random import random
from itertools import izip_longest
from pprint import pprint
rcParams['text.usetex'] = True
#Connection matri... |
from django.contrib import admin
from dnd.models import *
# General
admin.site.register(Source)
admin.site.register(DieRoll)
admin.site.register(LibraryAccount)
# Rules
admin.site.register(Rule)
admin.site.register(Term)
admin.site.register(Article)
admin.site.register(Example)
#Items
class MaterialAdmin(admin.Model... |
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import object
from cgi import escape
from io import BytesIO as IO
import gzip
import functools
from flask import after_this_request, request
from flask_login import current_user
import wtforms
from wtforms.com... |
import os, sys
import unittest
if os.path.exists("extended_setup.py"):
print "-" * 75
print "You should not run the test suite from the pysqlite build directory."
print "This does not work well because the extension module cannot be found."
print "Just run the test suite from somewhere else, please!"
... |
"""
simple_service.py
Combine results from GA4GH and ExAC API to build
a simple web service.
"""
# Our web service will listen on an HTTP port for
# requests and uses the Flask (http://flask.pocoo.org)
# python module to handle communication.
import flask
app = flask.Flask(__name__)
# We'll also include ... |
import gevent
import zerorpc
from testutils import teardown, random_ipc_endpoint
def test_rcp_streaming():
endpoint = random_ipc_endpoint()
class MySrv(zerorpc.Server):
@zerorpc.rep
def range(self, max):
return range(max)
@zerorpc.stream
def xrange(self, max):
... |
import logging
from gettext import gettext as _
from gi.repository import GConf
import glib
from gi.repository import GObject
from gi.repository import Gtk
import dbus
from sugar3.graphics import style
from sugar3.graphics.icon import get_icon_state
from sugar3.graphics.tray import TrayIcon
from sugar3.graphics.palet... |
from platformio.exception import PlatformioException, UserSideException
class ProjectError(PlatformioException):
pass
class NotPlatformIOProjectError(ProjectError, UserSideException):
MESSAGE = (
"Not a PlatformIO project. `platformio.ini` file has not been "
"found in current working direc... |
from collections import Counter
from os import path
from string import ascii_lowercase
from zipfile import ZipFile, BadZipFile
def count_characters(filepath):
'''
Inputs:
filepath -- string, path to a zip file with (ascii) text files
Counts total occurences of ascii characters in compr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
OMERO.fs ServerFS module.
The Server class is a wrapper to the FileServer. It handles the ICE
formalities. It controls the shutdown.
Copyright 2009 University of Dundee. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
... |
"""
Downloader Middleware manager
See documentation in docs/topics/downloader-middleware.rst
"""
import six
from twisted.internet import defer
from scrapy.http import Request, Response
from scrapy.middleware import MiddlewareManager
from scrapy.utils.defer import mustbe_deferred
from scrapy.utils.conf import build_c... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.base.base import BaseDatabaseWrapper
from djan... |
"""SCons.Scanner
The Scanner package for the SCons software construction utility.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "So... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
import ast
PADDING = ' '
def member_filter(item):
if item in ('col_offset', 'lineno'):
return False
return not item.startswith("_")
def print_ast(a, pad=''):
if isinstance(a, (list, tuple)):
print '['
for i in a:... |
import pytest
from webdriver.transport import Response
from tests.support.asserts import assert_error, assert_same_element, assert_success
from tests.support.inline import inline
def find_elements(session, using, value):
return session.transport.send(
"POST", "session/{session_id}/elements".format(**var... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Testing vossanto.py
#
# Usage:
#
#
# Changes:
# 2016-06-12 (rja)
# - initial version
from __future__ import print_function
import re
import unittest
import vossanto
class TestVossanto(unittest.TestCase):
def test_many(self):
self.tv("Everybody knows that He... |
import sys
import os
import time
import atexit
from signal import SIGTERM
__author__ = 'pezza'
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
... |
import hashlib
import pickle
import socket
import time
from cgi import escape
from contextlib import contextmanager
from datetime import datetime
try:
# py3
from http.client import responses
from urllib.parse import urlparse, urlunparse
except ImportError:
from httplib import responses
from urlpar... |
import glob
import inspect
import os
import sys
from taf.foundation.api.plugins import CLIPlugin
from taf.foundation.api.plugins import WebPlugin
from taf.foundation.api.ui import AUT
from taf.foundation.api.ui import UIElement
from taf.foundation.conf import Configuration
class ServiceLocator(object):
_plugins ... |
from elyxer.io.fileline import *
from elyxer.util.trace import Trace
from elyxer.conf.config import *
from elyxer.parse.glob import *
class Position(Globable):
"""A position in a text to parse.
Including those in Globable, functions to implement by subclasses are:
skip(), identifier(), extract(), isout() and cu... |
__author__ = 'maartenbreddels'
import os
import sys
import warnings
import collections
import logging
import numpy as np
import vaex
from .convert import arrow_array_from_numpy_array
max_length = int(1e5)
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
try:
import pyarrow as pa
import pyarrow.parquet... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
class CallbackModule(CallbackBase):
'''
This is the default callback interface, whic... |
import os
import sqlalchemy as sa
from six import PY3
from pytest import mark
from sqlalchemy.ext.declarative import declarative_base
from tests import TestCase
@mark.skipif("os.environ.get('DB') == 'sqlite'")
class TestCustomSchema(TestCase):
def create_models(self):
self.Model = declarative_base(metadat... |
import xml.sax.saxutils
import zipfile
import ftplib
import time
import stat
import xml.dom.minidom
import xmlrpclib
import httplib
import os.path
import string
import sys
import re
import urlparse
def process_xml_file( input_file, output_file ):
utils.log( 'Processing test log "%s"' % input_file )
f = ... |
"""
Django settings for missioncontrol project.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import sys
import dj_database_url
from decouple import C... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <<EMAIL>>
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 limitation the rights
to use, copy, mo... |
'''
Copyright (c) <2012> Tarek Galal <<EMAIL>>
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 limitation the rights to use, copy, modify,
merge, publish,... |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard librar... |
"""
Tests for representation module
Author: Chad Fulton
License: Simplified-BSD
References
----------
Kim, Chang-Jin, and Charles R. Nelson. 1999.
"State-Space Models with Regime Switching:
Classical and Gibbs-Sampling Approaches with Applications".
MIT Press Books. The MIT Press.
"""
from __future__ import division... |
"""A more advanced example, of building an RNN-based time series model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from os import path
import numpy
import tensorflow as tf
from tensorflow.contrib.timeseries.python.timeseries impor... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.contrib.gis.db.models import Field
from treemap.models import InstanceUser, Role, Plot, MapFeature
"""
Tools to assist in resolving permissions, specifically when the type of
the thing you are che... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Mike Place <<EMAIL>>`
'''
# Import python libs
from __future__ import absolute_import
# Import Salt Testing libs
from salttesting import TestCase, skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import patch, NO_MOCK, NO_MOCK_REASON
e... |
# Add the upper directory (where the nodebox module is) to the search path.
import os, sys; sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics import *
from nodebox.gui import *
# A panel is a container for other GUI controls.
# Controls can be added to the panel,
# and organized by setting the contro... |
"""Base class for Netatmo entities."""
import logging
from typing import Dict, List
from homeassistant.core import CALLBACK_TYPE, callback
from homeassistant.helpers.entity import Entity
from .const import DOMAIN, MANUFACTURER, MODELS, SIGNAL_NAME
from .data_handler import NetatmoDataHandler
_LOGGER = logging.getLog... |
"""
@file tables.py
@author Yun-Pang Wang
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-03-18
@version $Id: calStatistics.py 2008-03-18$
This file defines global tables used to:
- define the parameters in link cost functions
- define link cost functions
- conduct significance tests
SUMO, Sim... |
from __future__ import unicode_literals
import inspect
import os
import signal
import sys
import threading
import weakref
from wcwidth import wcwidth
from six.moves import range
__all__ = (
'Event',
'DummyContext',
'get_cwidth',
'suspend_to_background_supported',
'is_conemu_ansi',
'is_windows... |
import numpy as np
from numba import cuda, int32, int64, float32, float64
from numba.cuda.testing import unittest, CUDATestCase, skip_on_cudasim
from numba.core import config
def useful_syncwarp(ary):
i = cuda.grid(1)
if i == 0:
ary[0] = 42
cuda.syncwarp(0xffffffff)
ary[i] = ary[0]
def use_s... |
""" This converter works with classes protected by a namespace with
SWIG pointers (Python strings). To use it to wrap classes in
a C++ namespace called "ft", use the following:
class ft_converter(cpp_namespace_converter):
namespace = 'ft::'
"""
from __future__ import absolute_import, print_functio... |
#!/usr/bin/env python
import argparse
import os
import sys
import subprocess
from config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
def execute(argv):
try:
return subprocess.check_outpu... |
#!/usr/bin/env python
import argparse
import sys
from benchmark.benchmarker import Benchmarker
from setup.linux.unbuffered import Unbuffered
###################################################################################################
# Main
#######################################################################... |
import asyncio
import aiohttp
import json
import logging
import datetime
from .utils import dumps
from .db import history
import sys, traceback
logger = logging.getLogger(__name__)
run_date = datetime.datetime.now()
def print_exception():
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_tb(... |
###############################################################################
#
# ActiveUser object class
#
###############################################################################
__doc__ = """ ActiveUser
ActiveUser is a component of a SerialConsoleDevice
$id: $"""
__version__ = "$Revision: 1.1 $"[11:-2]
... |
"""
Django settings for hostfootprint project.
Generated by 'django-admin startproject' using Django 1.11.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
imp... |
import sys, os, re, subprocess, codecs, optparse
CMD_PYTHON = sys.executable
QOOXDOO_PATH = '../../../thirdparty/qooxdoo/qooxdoo-2.1.1-sdk'
QX_PYLIB = "tool/pylib"
##
# A derived OptionParser class that ignores unknown options (The parent
# class raises in those cases, and stops further processing).
# We need this, a... |
#!/usr/bin/env python
from time import time
from collections import deque
from twisted.web.server import Site, NOT_DONE_YET
from twisted.web.resource import Resource
from twisted.internet import reactor
class Root(Resource):
def __init__(self):
Resource.__init__(self)
self.concurrent = 0
... |
__version__ = "0.1"
import array, string
import Image, ImageFile
#
# Bitstream parser
class BitStream:
def __init__(self, fp):
self.fp = fp
self.bits = 0
self.bitbuffer = 0
def next(self):
return ord(self.fp.read(1))
def peek(self, bits):
while self.bits < bits:... |
"""Implementation of magic functions for matplotlib/pylab support.
"""
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full lice... |
"""
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left
node that shares the same parent node) or empty, flip it upside down and turn it into a tree
where the original right nodes turned into left leaf nodes. Return the new root.
1 4
/ \ /... |
""" Integrate Bokeh extensions into Sphinx autodoc.
Ensures that autodoc directives such as ``autoclass`` automatically make use of
Bokeh-specific directives when appropriate. The following Bokeh extensions are
configured:
* :ref:`bokeh.sphinxext.bokeh_color`
* :ref:`bokeh.sphinxext.bokeh_enum`
* :ref:`bokeh.sphinxex... |
import logging
from gym.envs.doom import doom_env
logger = logging.getLogger(__name__)
class DoomCorridorEnv(doom_env.DoomEnv):
"""
------------ Training Mission 2 - Corridor ------------
This map is designed to improve your navigation. There is a vest
at the end of the corridor, with 6 enemies (3 gr... |
"""
SGMLParser-based Link extractors
"""
import six
from six.moves.urllib.parse import urljoin
import warnings
from sgmllib import SGMLParser
from w3lib.url import safe_url_string
from scrapy.selector import Selector
from scrapy.link import Link
from scrapy.linkextractors import FilteringLinkExtractor
from scrapy.util... |
# [reg_dep]
# 1,35652,1,COMP,8500::
# 2,35656,1,COMP,0:,1:
# 3,35660,1,LOAD,1748752,4,74,500:,2:
# 4,35660,1,COMP,0:,3:
# 5,35664,1,COMP,3000::,4
# 6,35666,1,STORE,1748752,4,74,1000:,3:,4,5
# 7,35666,1,COMP,3000::,4
# 8,35670,1,STORE,1748748,4,74,0:,6,3:,7
# 9,35670,1,COMP,500::,7
import protolib
import sys
# Import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
Install cx_Freeze: http://cx-freeze.sourceforge.net/
Copy script to the web2py directory
c:\Python27\python standalone_exe_cxfreeze.py build_exe
"""
from cx_Freeze import setup, Executable
from gluon.import_all import base_modules, contributed_module... |
"""Module containing index utilities"""
from functools import wraps
import os
import struct
import tempfile
from git.compat import is_win
import os.path as osp
__all__ = ('TemporaryFileSwap', 'post_clear_cache', 'default_index', 'git_working_dir')
#{ Aliases
pack = struct.pack
unpack = struct.unpack
#} END alias... |
"""
Views used by XQueue certificate generation.
"""
import json
import logging
from django.contrib.auth.models import User
from django.db import transaction
from django.http import HttpResponse, Http404, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http impor... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserLayerList'
db.create_table('layers_userlayerlist', (
('active', self.g... |
#
# example_site/books/urls.py
#
try:
from django.urls import re_path
except:
from django.conf.urls import url as re_path
from example_site.books import views
urlpatterns = [
# Publisher
re_path(r'^publisher-create/$', views.publisher_create_view,
name='publisher-create'),
re_path(r'^pub... |
"""Installs or updates prebuilt tools.
Must be tested with Python 2 and Python 3.
The stdout of this script is meant to be executed by the invoking shell.
"""
from __future__ import print_function
import argparse
import json
import os
import platform
import re
import subprocess
import sys
def parse(argv=None):
... |
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QFontMetrics, QIcon, QColor
from qtlib.column import Column
from qtlib.table import Table
from hscommon.trans import trget
tr = trget("ui")
class ExcludeListTable(Table):
"""Model for exclude list"""
COLUMNS = [
Column("marked", defaultWidth=... |
#!/usr/bin/env python
from __future__ import print_function, division
from sympy.core.compatibility import xrange
from random import random
from sympy import factor, I, Integer, pi, simplify, sin, sqrt, Symbol, sympify
from sympy.abc import x, y, z
from timeit import default_timer as clock
def bench_R1():
"real(... |
import os
import shutil
import tempfile
from django import conf
from django.test import SimpleTestCase
from django.test.utils import extend_sys_path
class TestStartProjectSettings(SimpleTestCase):
def setUp(self):
self.temp_dir = tempfile.TemporaryDirectory()
self.addCleanup(self.temp_dir.cleanup... |
import os
import time
from unittest import TestCase
import zmq
from zmq.tests import PollZMQTestCase, have_gevent, GreenTest
def wait():
time.sleep(.25)
class TestPoll(PollZMQTestCase):
Poller = zmq.Poller
def test_pair(self):
s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
# Sle... |
"""
An NLTK interface for SentiWordNet
SentiWordNet is a lexical resource for opinion mining.
SentiWordNet assigns to each synset of WordNet three
sentiment scores: positivity, negativity, and objectivity.
For details about SentiWordNet see:
http://sentiwordnet.isti.cnr.it/
>>> from nltk.corpus import sentiwordn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.