content stringlengths 4 20k |
|---|
import goocanvas
import core
import math
import pango
import gtk
class Axes(object):
def __init__(self, viz):
self.viz = viz
self.color = 0x8080C0FF
self.hlines = goocanvas.Path(parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color)
self.hlines.lower(None)
self.vl... |
""" Extended prompt library functions."""
import gdb
import os
def _prompt_pwd(ignore):
"The current working directory."
return os.getcwdu()
def _prompt_object_attr(func, what, attr, nattr):
"""Internal worker for fetching GDB attributes."""
if attr is None:
attr = nattr
try:
obj ... |
"""Viewfinder watchdog scenario.
"""
__author__ = '<EMAIL> (Matt Tracy)'
import logging
import json
import os
import re
import time
import urllib
from viewfinder.backend.base import util, secrets
from viewfinder.backend.base.environ import ServerEnvironment
from viewfinder.backend.www import www_util
from tornado.io... |
"""A collection of modules for building different kinds of trees from HTML
documents.
To create a treebuilder for a new type of tree, you need to do
implement several things:
1. A set of classes for various types of elements: Document, Doctype, Comment,
Element. These must implement the interface of ``base.treebui... |
class EAMatchTablePresenter(object):
def __init__(self, view):
self.view = view
self.table_entries = []
def update_table(self, entry):
index = self.find_entry_index(entry)
if index != -1:
self.remove_entry(index)
self.table_entries.append(entry)
self... |
"""Verifies that Google Test warns the user when not initialized properly."""
__author__ = '<EMAIL> (Zhanyong Wan)'
import gtest_test_utils
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_')
def Assert(condition):
if not condition:
raise AssertionError
def AssertEq(expected, act... |
from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
from django.db import transaction
from osf.models import Node, BaseFileNode, TrashedFileNode
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def remove_logs_and_files(node_guid)... |
import time
from threading import Thread
from log import LogFactory
log = LogFactory().get_log(__name__)
class AbstractAsyncScheduledTask:
"""
Exposes the contract to follow to implement a scheduled task to be executed by the ScheduledExecutor
"""
def execute_task(self):
"""
Overrid... |
from cupy import reduction
def amin(a, axis=None, out=None, keepdims=False, dtype=None):
"""Returns the minimum of an array or the minimum along an axis.
Args:
a (cupy.ndarray): Array to take the minimum.
axis (int): Along which axis to take the minimum. The flattened array
is use... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
__version__ = '${version}'
from distutils.version import LooseVersion
try:
import requests
except ImportError:
REQUESTS_FOUND = False
else:
REQUESTS_FOUND = True
#
... |
"""
Test cases for the editor module.
"""
from functools import wraps
from nose.tools import eq_
from diffscuss.support import editor
class patch(object):
"""
Quick and dirty patching. Use it as a decorator or as a context manager.
"""
PATCH_REMOVE = object()
def __init__(self, obj, attr, new):... |
"""
Provides functionality to group entities.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/group/
"""
import asyncio
import logging
import os
import voluptuous as vol
from homeassistant import config as conf_util, core as ha
from homeassistant.const... |
#!/usr/bin/env python
'''
browse.py
=========
Sample shows how to implement a simple hi resolution image navigation
Usage
-----
browse.py [image filename]
'''
# Python 2/3 compatibility
from __future__ import print_function
import sys
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
import numpy as np
i... |
from __future__ import print_function
import unittest as ut
import espressomd
import numpy as np
class Layered(ut.TestCase):
S = espressomd.System(box_l=[1.0, 1.0, 1.0])
def setUp(self):
self.S.part.clear()
self.S.cell_system.set_layered()
def test_resort(self):
n_part = 2351
... |
import importlib, os
import multiprocessing as mp
from IPython.lib.deepreload import reload as dreload
import gmane as g, percolation as P
G=g
importlib.reload(g.listDataStructures)
importlib.reload(g.loadMessages)
importlib.reload(g.triplifyList)
importlib.reload(P.rdf)
importlib.reload(P.utils)
importlib.reload(g.ut... |
import sys
from twisted.python import log
from twisted.internet import reactor, defer
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.websocket import listenWS
from autobahn.wamp import exportRpc, \
WampServerFactory, \
WampServ... |
# coding: utf8
{
'!langcode!': 'af',
'!langname!': 'Afrikaanse',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'%s %%{row} deleted': '%s rows deleted',
'%s %%{row} updated': '%s rows updated',
'(requires internet access)': '(vereis internet toegang)',
'(something like "it-it")': '(iets soos "it-it")... |
import mock
from novaclient import exceptions as nova_exc
from oslo.config import cfg
from oslo.utils import excutils
from neutron import context as n_context
from neutron.i18n import _LE
from neutron import manager
from neutron.openstack.common import log as logging
from neutron.openstack.common import uuidutils
from... |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.utils.translation import ugettext as _
import bleach
from celery import task
from kitsune.announcements.models import Announcement
from kitsune.sumo.decorators import timeit
from kitsu... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
"""
.. dialect:: mssql+adodbapi
:name: adodbapi
:dbapi: adodbapi
:connectstring: mssql+adodbapi://<username>:<password>@<dsnname>
:url: http://adodbapi.sourceforge.net/
.. note::
The adodbapi dialect is not implemented SQLAlchemy versions 0.6 and
above at this time.
"""
import datetime
from s... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.theorem
~~~~~~~~~~~~~~~~~~~~~~~
Lexers for theorem-proving languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from ..lexer import RegexLexer, default, words
from ..token i... |
import datetime
import time
from datetime import timedelta, datetime
# import boto3
# from boto3.dynamodb.conditions import Key
from bin import messageHandler
from bin.selectobjects import *
class Initialization(object):
def runbot(runLoop):
testgroup = SelectObjects.selectgroup(groupy.Group.list()) #... |
from __future__ import absolute_import
import time
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
#... |
import os
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetry.core.platform import profiler
class AndroidTraceviewProfiler(profiler.Profiler):
"""Collects a Traceview on Android."""
_DEFAULT_DEVICE_DIR = '/data/local/tmp/traceview'
def __init__(sel... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# #Estimate how many TB of data are served by IOOS
# <markdowncell>
# Estimate dataset size from the OPeNDAP DDS. Here we use regular expressions to parse the DDS and just the variable size (32 or 64 bit Int or Float) by their shapes. This represe... |
"""
This module provides some useful functions for working with
scrapy.http.Response objects
"""
import os
import re
import weakref
import webbrowser
import tempfile
from twisted.web import http
from twisted.web.http import RESPONSES
from w3lib import html
from scrapy.http import Response, HtmlResponse
def body_or_... |
"""
Classes that represent database functions.
"""
from django.db.models import (
DateTimeField, Func, IntegerField, Transform, Value,
)
class Coalesce(Func):
"""
Chooses, from left to right, the first non-null expression and returns it.
"""
function = 'COALESCE'
def __init__(self, *expressio... |
"""Tests for Minio Hass related code."""
import asyncio
import json
import pytest
from homeassistant.components.minio import (
CONF_ACCESS_KEY,
CONF_HOST,
CONF_LISTEN,
CONF_LISTEN_BUCKET,
CONF_PORT,
CONF_SECRET_KEY,
CONF_SECURE,
DOMAIN,
QueueListener,
)
from homeassistant.core impo... |
from dependencies.dependency import _createObjectByType
from lims.utils import tmpID
from lims.testing import BIKA_FUNCTIONAL_TESTING
from lims.tests.base import BikaFunctionalTestCase
from lims.idserver import renameAfterCreation
from dependencies.dependency import login, logout
from dependencies.dependency import TES... |
import argparse
import csv
import suite
desc = suite.SUITE_NAME + "/calculate_percentage " + suite.SUITE_VERSION
desc += """\nCalculates the percentage of selected patients who are negative
for both estrogen and progesterone receptors."""
def are_negative_for(percent, what):
'''Returns a formatted string for ou... |
"""SCons.Tool.zip
Tool-specific initialization for zip.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# P... |
# coding: utf-8
from __future__ import unicode_literals
from ...gold import biluo_tags_from_offsets
from ...tokens.doc import Doc
import pytest
def test_gold_biluo_U(en_vocab):
orths_and_spaces = [('I', True), ('flew', True), ('to', True),
('London', False), ('.', True)]
doc = Doc(en... |
import shutil
import Nucleo
import multiprocessing
import time
class Interfaz:
def __init__(self, center=(0, 0)):
self.archivos = Archivos()
self.altura = shutil.get_terminal_size().lines - 2
self.anchura = shutil.get_terminal_size().columns - 2
self.carga = self.cargar() # [0]ca... |
from essentia_test import *
class TestBpmHistogramDescriptors(TestCase):
def testEmpty(self):
bpm1, weight1, spread1, bpm2, weight2, spread2 = BpmHistogramDescriptors()([])
self.assertEqual(bpm1, 0)
self.assertEqual(weight1, 0)
self.assertEqual(spread1, 0)
self.assertEqual(... |
import re
from time import time
import datetime
from frames import Frames
from knowledge import Knowledge
#from map import Map
from geo import Geo
from graph import Graph
class DB(object):
"Link to MongoDB + model factory"
def __init__(self, db_conn, db_name):
from pymongo import MongoClient
... |
#!/usr/bin/python
"""Thermistor Value Lookup Table Generator
Generates lookup to temperature values for use in a microcontroller in C format based on:
http://en.wikipedia.org/wiki/Steinhart-Hart_equation
The main use is for Arduino programs that read data from the circuit board described here:
http://reprap.org/wiki/... |
{
'name': 'Argentina Localization Chart Account',
'version': '1.0',
'description': """
Argentinian accounting chart and tax localization.
==================================================
Plan contable argentino e impuestos de acuerdo a disposiciones vigentes
""",
'author': ['Cubic ERP'],
'we... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'
}
DOCUMENTATION = r'''
---
author: Ansible Core Team (@ansible)
module: import_tasks
short_description: Import a task ... |
import sys
import kmldom
import kmlengine
def ReadFile(filename):
f = open(filename, 'r')
data = f.read()
return data
# Program main: read the file to memory, parse it, get and visit
# the root feature if such exists.
def main(inputkml):
feature = kmlengine.GetRootFeature(kmldom.ParseKml(ReadFile(inputkml)))
... |
@VOLT.Command(
bundles = VOLT.ServerBundle('rejoin',
needs_catalog=False,
supports_live=True,
default_host=False,
safemode_available=False,
supports_daemon=... |
from __future__ import absolute_import
from dirtyfields import DirtyFieldsMixin
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from djangoplugins.signals import django_plugin_enabled, django_plugin_disabled
from .utils ... |
"""Unit test for dev_appserver_task_thread.py"""
import unittest
import wx
import launcher
class DevAppServerTaskThreadTest(unittest.TestCase):
def setUp(self):
# Some tests wander into wx, so we need a wx.App cranked up.
self.app = wx.PySimpleApp()
def RunStateChanged(self, project):
"""We use ou... |
__author__ = 'jdaniel'
from AthenaOpt.configuration import Configuration
from AthenaOpt.configuration import encode_configuration
from os import urandom
import json
__author__ = 'jldaniel'
algorithm = 'SERIAL'
model = 'ZDT1'
pop_size = 2048
conv_tol = 0
crossover_index = 15
mutation_index = 20
crossover_probability ... |
#Functions that handle the logic of solving a sudoku
def sudokuEqual(one,two):
if one != "" and len(one.split(" ")) == 1:
if one == two:
return True
return False
def checkRows(sudoku):
for row in sudoku:
for i in range(len(row)):
for j in range(i+1,len(row)):
... |
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.tests
~~~~~~~~~~~~~~~~~~~~~~
Who tests the tests?
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import unittest
from jinja2.testsuite import JinjaTestCase
from jinja2 import Markup, Environment
env = Environm... |
"""
Second coroutine closing demonstration::
>>> fin_coro = demo_finally()
>>> next(fin_coro)
-> coroutine started
>>> fin_coro.send(11)
-> coroutine received: 11
>>> fin_coro.send(22)
-> coroutine received: 22
>>> fin_coro.close()
-> coroutine ending
Second coroutin... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
qualities,
)
class WrzutaIE(InfoExtractor):
IE_NAME = 'wrzuta.pl'
_VALID_URL = r'https?://(?P<uploader>[0-9a-zA-Z]+)\.wrzuta\.pl/(?P<typ>film|audio)/(?P<id>... |
import unittest
from telemetry import decorators
_counter = 0
class Foo(object):
@decorators.Cache
def GetCountCached(self, _):
global _counter
_counter = _counter + 1
return _counter
def CreateFooUncached(_):
return Foo()
@decorators.Cache
def CreateFooCached(_):
return Foo()
class Decora... |
#!/usr/bin/python
from string import strip
from sys import stdin
targets = {}
smilies = {'slowdown': '☹' , 'speedup': '☺'}
for line in stdin:
line = map(strip, filter(None, line.split(' ')))
if 9 == len(line):
target, name = line[0:2]
factor, dir = line[-2:]
name = name.split('-')
name, size ... |
from rest_framework import serializers
from ..models.content import Post, Comment
from ..models.author import Author
from author import CompactAuthorSerializer
from django.conf import settings
from api_settings import settings as api_settings
class SourceSerializer(serializers.URLField):
# Get path this post obje... |
from django.http import HttpResponse, HttpResponseForbidden
from django.template import loader, RequestContext
import encryption
import decimal
from bitcp2.models import Coupon, Beneficiary
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def cashIn(request):
if... |
import delivery_sale_order
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import os
import sys
import smtplib
import ssl
try:
from email import encoders
import email.utils
from email.utils import parseaddr, formataddr
from email.mime.base import MIMEBase
from mail.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
except ImportError:
from em... |
'''
=============================
Byteswapping and byte order
=============================
Introduction to byte ordering and ndarrays
==========================================
The ``ndarray`` is an object that provide a python array interface to data
in memory.
It often happens that the memory that you want to v... |
import sys
import os
import signal
import socket
import logging
try:
import configparser
except ImportError:
import ConfigParser as configparser
import tornado.web
import tornado.ioloop
import _
from . import handlers
ioloop = tornado.ioloop.IOLoop.instance()
class Application(tornado.web.Application):
... |
"""Implementation of an S3-like storage server based on local files.
Useful to test features that will eventually run on S3, or if you want to
run something locally that was once running on S3.
We don't support all the features of S3, but it does work with the
standard S3 client for the most basic semantics. To use t... |
__author__ = 'Tom Schaul, <EMAIL>'
from random import choice
from scipy import zeros
from .twoplayergame import TwoPlayerGame
# TODO: undo operation
class CaptureGame(TwoPlayerGame):
""" the capture game is a simplified version of the Go game: the first player to capture a stone wins!
Pass moves are forbi... |
#!/usr/bin/env python
import os
# Copyright 2009-2013 Max J. Hoffmann (<EMAIL>)
# This file is part of kmos.
#
# kmos 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 Lic... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label... |
"""
Registration page (create a new account)
"""
from bok_choy.page_object import PageObject
from . import BASE_URL
from .dashboard import DashboardPage
class RegisterPage(PageObject):
"""
Registration page (create a new account)
"""
def __init__(self, browser, course_id):
"""
Course... |
import os.path
from pynpact import parsing
from pynpact.steps import allplots
from pynpact.util import which
def test_binfile_exists():
assert allplots.BIN
assert os.path.exists(allplots.BIN)
def test_build_allplotsdef(gbkconfig):
parsing.length(gbkconfig)
lines = allplots.build_allplots_def(gbkconf... |
from django.db import connection, models
class CurrentTranslation(models.ForeignObject):
"""
Creates virtual relation to the translation with model cache enabled.
"""
# Avoid validation
requires_unique_target = False
def __init__(self, to, on_delete, from_fields, to_fields, **kwargs):
... |
'''
Created on 2017. 4. 7.
@author: Byoungho Kang
'''
import numpy as np
import pickle
from Common.mnist import load_mnist
from Common.functions import sigmoid, softmax
'''
load mnist data set
'''
def getData():
(trainImg, trainLbl),(testImg, testLbl) = \
load_mnist(normalize=True, ... |
from __future__ import print_function
import os
import sys
import pyrax
import pyrax.exceptions as exc
pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
dns = pyrax.cloud_dns
cs = pyrax.cloudservers
# Be sure to s... |
"""Provides device triggers for sensors."""
import voluptuous as vol
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.components.homeassistant.triggers import (
nume... |
"""
csv.py - read/write/investigate CSV files
"""
import re
from functools import reduce
from _csv import Error, __version__, writer, reader, register_dialect, \
unregister_dialect, get_dialect, list_dialects, \
field_size_limit, \
QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONN... |
"""Definition of various recurrent neural network cells."""
__all__ = ['VariationalDropoutCell']
from ...rnn import BidirectionalCell, SequentialRNNCell, ModifierCell
from ...rnn.rnn_cell import _format_sequence, _get_begin_state
class VariationalDropoutCell(ModifierCell):
"""
Applies Variational Dropout on ... |
"""Test running bitcoind with -reindex and -reindex-chainstate options.
- Start a single node and generate 3 blocks.
- Stop the node and restart it with -reindex. Verify that the node has reindexed up to block 3.
- Stop the node and restart it with -reindex-chainstate. Verify that the node has reindexed up to block 3.... |
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.univention_umc import (
umc_module_for_add,
umc_module_for_edit,
ldap_search,
base_dn,
)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
def... |
from django.conf.urls import patterns, url
from kitsune.dashboards import api
urlpatterns = patterns(
'kitsune.dashboards.views',
url(r'^localization$', 'localization', name='dashboards.localization'),
url(r'^contributors$', 'contributors', name='dashboards.contributors'),
url(r'^contributors-old$', ... |
r"""
Penn Treebank Tokenizer
The Treebank tokenizer uses regular expressions to tokenize text as in Penn Treebank.
This implementation is a port of the tokenizer sed script written by Robert McIntyre
and available at http://www.cis.upenn.edu/~treebank/tokenizer.sed.
"""
import re
from nltk.tokenize.api import Tokeni... |
"""The hypervisors admin extension."""
import webob.exc
from nova.api.openstack import extensions
from nova import compute
from nova import context as nova_context
from nova import exception
from nova.i18n import _
from nova import servicegroup
authorize = extensions.extension_authorizer('compute', 'hypervisors')
... |
import os
def statvfs():
docker_path = '/var/lib/docker'
if not os.path.exists(docker_path):
docker_path = '/'
return os.statvfs(docker_path)
def get_meminfo():
with open('/proc/meminfo') as f:
return f.readlines()
def get_disk_usage():
# This is the location where Docker store... |
import os.path
from pathlib import Path, PurePath
# os.PathLike
class A:
def __fspath__(self) -> str:
pass
a = A()
open(a)
os.fspath(a)
os.fsencode(a)
os.fsdecode(a)
Path(a)
PurePath(a)
os.path.abspath(a)
# not os.PathLike
class B:
pass
b = B()
open(<warning descr="Expected type 'Union[str, b... |
from __future__ import unicode_literals
try:
from urllib import parse as urlparse
except ImportError:
import urlparse # Python 2
from django.forms.models import modelform_factory
from django.test import TestCase
from django.utils import safestring
from django.utils.html import escape
from django_countries i... |
import json
from abc import ABCMeta, abstractmethod
import numpy as np
from pychemia.utils.computing import deep_unicode
from numbers import Integral, Real
class PyChemiaJsonable(object):
"""
Abstract base class specifying how to convert objects from/to dictionaries.
PyChemiaJsonable objects must implemen... |
"""
Constants specific to the SQL storage portion of the ORM.
"""
import re
# Valid query types (a set is used for speedy lookups). These are (currently)
# considered SQL-specific; other storage systems may choose to use different
# lookup types.
QUERY_TERMS = {
'exact', 'iexact', 'contains', 'icontains', 'gt', '... |
import unittest
from django.utils import html
class TestUtilsHtml(unittest.TestCase):
def check_output(self, function, value, output=None):
"""
Check that function(value) equals output. If output is None,
check that function(value) equals value.
"""
if output is None:
... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.bbcode
~~~~~~~~~~~~~~~~~~~~~~~~~~
BBcode formatter.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.util import get_bool_opt
__al... |
from django.db.models.query_utils import Q
from django.core.cache import cache
from django.db import models
import operator
import random
from datetime import timedelta
from django_facebook.utils import compatible_datetime as datetime
from django.contrib.contenttypes.models import ContentType
import logging
from open_f... |
from openerp.osv import osv, fields
from openerp.tools.translate import _
import openerp.netsvc as netsvc
import time
class mrp_production(osv.Model):
_inherit = 'mrp.production'
def action_finish(self, cr, uid, ids, context={}):
res = super(mrp_production, self).action_finish(
cr, uid, ... |
import threading
import weakref
from django.utils.inspect import func_accepts_kwargs
def _make_id(target):
if hasattr(target, '__func__'):
return (id(target.__self__), id(target.__func__))
return id(target)
NONE_ID = _make_id(None)
# A marker for caching
NO_RECEIVERS = object()
class Signal:
... |
"""
an htpasswd-backed bouncer with crypt passwords
"""
import random
from twisted.python import components
from twisted.internet import defer
from flumotion.common import interfaces, keycards, log, errors
from flumotion.component import component
from flumotion.component.bouncers import bouncer
from flumotion.twist... |
"""The tests for the Rfxtrx cover platform."""
import unittest
import pytest
from homeassistant.setup import setup_component
from homeassistant.components import rfxtrx as rfxtrx_core
from tests.common import get_test_home_assistant, mock_component
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
class Tes... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.blocktools import *
SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31)
SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 mean... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 30 19:07:37 2017
@author: AmatVictoriaCuramIII
"""
#Changes are pretty much immaterial, use VXV/VIX
import numpy as np
import random as rand
import pandas as pd
import time as t
from DatabaseGrabber import DatabaseGrabber
from YahooGrabber import YahooGrabbe... |
import gc
import pprint
import sys
import unittest
from test import test_support
class TestGetProfile(unittest.TestCase):
def setUp(self):
sys.setprofile(None)
def tearDown(self):
sys.setprofile(None)
def test_empty(self):
self.assertIsNone(sys.getprofile())
def test_setget(... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import stats
from tensorflow.contrib import distributions as distributions_lib
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tenso... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import os
import sys
# Make sure we import from working tree
pynagbase = os.path.dirname(os.path.realpath(__file__ + "/.."))
sys.path.insert(0, pynagbase)
import unittest2 as unittest
import time
im... |
scope = "Audit Implied"
description = """
A user with the ProgramEditor role for a private program will also have this
role in the audit context for any audit created for that program.
"""
permissions = {
"read": [
"Request",
"Comment",
"Assessment",
"Issue",
"Documenta... |
data = (
'wek', # 0x00
'wet', # 0x01
'wep', # 0x02
'weh', # 0x03
'wi', # 0x04
'wig', # 0x05
'wigg', # 0x06
'wigs', # 0x07
'win', # 0x08
'winj', # 0x09
'winh', # 0x0a
'wid', # 0x0b
'wil', # 0x0c
'wilg', # 0x0d
'wilm', # 0x0e
'wilb', # 0x0f
'wils', # 0x10
'wilt', # 0x... |
import socket
import SocketServer
import threading
try:
import ujson as json
except:
import json
from . import constants
from ..objects import peer
STARTUP_REQUEST = "V8 test peer starting up"
STARTUP_RESPONSE = "Let's rock some tests!"
EXIT_REQUEST = "V8 testing peer going down"
def GetOwnIP():
s = socket.s... |
"""
The Quick Insert panel widget.
"""
import weakref
from PyQt5.QtCore import QSettings
from PyQt5.QtWidgets import (QComboBox, QHBoxLayout, QLabel, QToolBox,
QToolButton, QVBoxLayout, QWidget)
import app
import userguide.util
import icons
import symbols
import gadgets.toolboxwheeler
... |
"""This file contains the default (English) substitutions for the
PyAIML kernel. These substitutions may be overridden by using the
Kernel.loadSubs(filename) method. The filename specified should refer
to a Windows-style INI file with the following format:
# lines that start with '#' are comments
# T... |
import os
from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration
from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from opus_core.configurations.baseyear_cache_configuration impo... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class SztvHuIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www\.)?sztv\.hu|www\.tvszombathely\.hu)/(?:[^/]+)/.+-(?P<id>[0-9]+)'
_TEST = {
'url': 'http://sztv.hu/hirek/cserkeszek-nepszerusitettek-a-kornyezettud... |
__author__ = 'Brian Quinlan (<EMAIL>)'
import collections
import functools
import logging
import threading
import time
FIRST_COMPLETED = 'FIRST_COMPLETED'
FIRST_EXCEPTION = 'FIRST_EXCEPTION'
ALL_COMPLETED = 'ALL_COMPLETED'
_AS_COMPLETED = '_AS_COMPLETED'
# Possible future states (for internal use by the futures pack... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import libvirt
except ImportError:
HAS_VIRT = False
else:
HAS_VIRT = True
... |
"""Support for guages from flood monitoring API."""
from datetime import timedelta
import logging
from aioeafm import get_station
import async_timeout
from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_METERS
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.upd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.