content string |
|---|
"""
ZMQ example using python3's asyncio
Bitcoin should be started with the command line arguments:
bitcoind -testnet -daemon \
-zmqpubrawtx=tcp://127.0.0.1:28332 \
-zmqpubrawblock=tcp://127.0.0.1:28332 \
-zmqpubhashtx=tcp://127.0.0.1:28332 \
... |
from openerp import models, api
class better_zip_geonames_import(models.TransientModel):
_inherit = 'better.zip.geonames.import'
@api.model
def select_or_create_state(
self, row, country_id, code_row_index=4, name_row_index=3
):
return super(better_zip_geonames_import, self).select_or... |
"""Layout tests module that is necessary for the layout analyzer.
Layout tests are stored in an SVN repository and LayoutTestCaseManager collects
these layout test cases (including description).
"""
import copy
import csv
import locale
import re
import sys
import urllib2
import pysvn
# LayoutTests SVN root location... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
########################################################
import datetime
import os
import platform
import random
import shutil
import socket
import sys
import time
from ansible.errors import AnsibleOptionsError
from ansible.cli im... |
import datetime
import time
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_followup_stat_by_partner(osv.osv):
_name = "account_followup.stat.by.partner"
_description = "Follow-up Statistics by Partner"
_rec_name = 'partner_id'
_auto = ... |
class BlockDeviceType(object):
"""
Represents parameters for a block device.
"""
def __init__(self,
connection=None,
ephemeral_name=None,
no_device=False,
volume_id=None,
snapshot_id=None,
status=None,... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from yaml.constructor import SafeConstructor, ConstructorError
from yaml.nodes import MappingNode
from ansible.module_utils._text import to_bytes
from ansible.parsing.yaml.objects import AnsibleMapping, AnsibleSequence, AnsibleUni... |
import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
interface TestIncompleteTypes {
attribute FooInterface attr1;
FooInterface method1(FooInterface arg);
};
interface FooInterface {
};
""")
results = parser.finish()
harness.ok(True, "T... |
from matplotlib import pyplot
from os import listdir
def is_numeric(x):
try:
float(x)
except ValueError:
return False
return True
avg_lap_time = {}
avg_pos = {}
avg_speed = {}
avg_top = {}
total_rescued = {}
tests = len(listdir('../../batch'))-1
for file in listdir('... |
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.checks import Error
from django.core.exceptions import FieldDoesNotExist, FieldError
from django.db import models
from django.test import TestCase
from d... |
"""
Tests for the inotify wrapper in L{twisted.internet.inotify}.
"""
from twisted.internet import defer, reactor
from twisted.python import filepath, runtime
from twisted.python.reflect import requireModule
from twisted.trial import unittest
if requireModule('twisted.python._inotify') is not None:
from twisted.i... |
import numpy
try:
# try importing the C version
from ._hypervolume import hv as hv
except ImportError:
# fallback on python version
from ._hypervolume import pyhv as hv
def hypervolume(front, **kargs):
"""Returns the index of the individual with the least the hypervolume
contribution. The prov... |
'''
>>> story.run()
True
>>> print output.getvalue()
Story: Faked Story #1
In order to write specifications
As a python developer
I want to write them in Python language
<BLANKLINE>
Scenario 1: Fake scenario
Given I run it ... OK
When I type X ... OK
Then it shows me X ... OK
<BLANKLINE>
Ran 1 scenario with... |
"""Principal Component Analysis Base Classes"""
# Olivier Grisel <<EMAIL>>
# Mathieu Blondel <<EMAIL>>
# Denis A. Engemann <<EMAIL>>
# Kyle Kastner <<EMAIL>>
#
# License: BSD 3 clause
import numpy as np
from scipy import linalg
from ..base import BaseEstimator, TransformerMixin
from .... |
from sqlalchemy.testing import fixtures
from sqlalchemy.sql.ddl import SchemaGenerator, SchemaDropper
from sqlalchemy import MetaData, Table, Column, Integer, Sequence, ForeignKey
from sqlalchemy import schema
from sqlalchemy.testing.mock import Mock
class EmitDDLTest(fixtures.TestBase):
def _mock_connection(sel... |
import os
import sys
if os.name == 'posix':
def become_daemon(our_home_dir='.', out_log='/dev/null',
err_log='/dev/null', umask=022):
"Robustly turn into a UNIX daemon, running in our_home_dir."
# First fork
try:
if os.fork() > 0:
sys.exit(0... |
#!/usr/bin/env python
import re
import json
# http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
... |
import json
from subprocess import Popen, PIPE
import os
import shutil
import sys
from ask_amy.cli.code_gen.code_generator import CodeGenerator
from time import sleep
class DeployCLI(object):
def create_template(self, skill_name, aws_role='', intent_schema_nm=None):
with open(intent_schema_nm) as json_dat... |
# -*- coding: utf-8 -*-
__author__ = 'Jace Xu'
__version__ = "0.3"
from .autoit import options, properties, commands
from .autoit import AutoItError
from .autoit import error
from .autoit import auto_it_set_option
from .autoit import clip_get
from .autoit import clip_put
from .autoit import is_admin
from .autoit imp... |
from .base import TestBase
from ..object import ObjectFile
from ..object import Relocation
from ..object import Section
from ..object import Symbol
class TestObjectFile(TestBase):
def get_object_file(self):
source = self.get_test_binary()
return ObjectFile(filename=source)
def test_create_from... |
# -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from hyde.fs import File, Folder
from hyde.generator import Generator
from hyde.site import Site
from pyquery import PyQuery
from nose.tools import nottest
TEST_SITE = File(__file__).parent.parent.child_folder('_test')
class TestAutoExtend... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from contextlib import contextmanager
from django.test import TestCase
from cms.api import create_page
from cms.signals import urls_need_reloading
class SignalTester(object):
def __init__(self):
self.call_count = 0
self.calls = []
... |
"""Script to check that the Windows 8 SDK has been appropriately patched so that
it can be used with VS 2010.
In practice, this checks for the presence of 'enum class' in asyncinfo.h.
Changing that to 'enum' is the only thing needed to build with the WinRT
headers in VS 2010.
"""
import os
import sys
de... |
"""SCons.Tool.ifl
Tool-specific initialization for the Intel Fortran compiler.
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... |
{
'name': 'Singapore - Accounting',
'version': '1.0',
'author': 'Tech Receptives',
'website': 'http://www.techreceptives.com',
'category': 'Localization/Account Charts',
'description': """
Singapore accounting chart and localization.
=======================================================
After... |
"""
Extension for building Qt-like documentation.
- Method lists preceding the actual method documentation
- Inherited members documented separately
- Members inherited from Qt have links to qt-project documentation
- Signal documentation
"""
def setup(app):
# probably we will be making a wrapper around au... |
#!/usr/bin/env python
from validictory.validator import (SchemaValidator, FieldValidationError,
ValidationError, SchemaError)
__all__ = ['validate', 'SchemaValidator', 'FieldValidationError',
'ValidationError', 'SchemaError']
__version__ = '0.9.3'
def validate(data, sch... |
"""This class stores all of the samples for training. It is able to
construct randomly selected batches of phi's from the stored history.
It allocates more memory than necessary, then shifts all of the
data back to 0 when the samples reach the end of the allocated memory.
"""
import pyximport
import numpy as np
pyxi... |
""" Tests for barbante.maintenance.tasks.py.
"""
import datetime as dt
import nose.tools
import barbante.maintenance.tasks as tasks
from barbante.maintenance.tests.fixtures.MaintenanceFixture import MaintenanceFixture
import barbante.tests as tests
class TestTasks(MaintenanceFixture):
""" Test class for mainten... |
from m5.params import *
from m5.proxy import *
from BaseCPU import BaseCPU
from KvmVM import KvmVM
class BaseKvmCPU(BaseCPU):
type = 'BaseKvmCPU'
cxx_header = "cpu/kvm/base.hh"
abstract = True
@classmethod
def export_method_cxx_predecls(cls, code):
code('#include "cpu/kvm/base.hh"')
... |
# -*- coding: utf-8 -*-
"""
Polish administrative units as in http://pl.wikipedia.org/wiki/Podzia%C5%82_administracyjny_Polski
"""
ADMINISTRATIVE_UNIT_CHOICES = (
('wroclaw', u'Wrocław'),
('jeleniagora', u'Jelenia Góra'),
('legnica', u'Legnica'),
('boleslawiecki', u'bolesławiecki'),
('dzierzoniows... |
#!/usr/bin/env python
"""Simple source code checks, e.g. trailing whitespace."""
from __future__ import with_statement
import bisect
import re
import sys
import violations
RULE_TRAILING_WHITESPACE = 'whitespace.trailing'
RULE_TEXT_TRAILING_WHITESPACE = 'Trailing whitespace is not allowed.'
RULE_TODO_ONE_SPACE = '... |
from datetime import datetime
class Activity(object):
def __init__(self, connection=None):
self.connection = connection
self.start_time = None
self.end_time = None
self.activity_id = None
self.progress = None
self.status_code = None
self.cause = None
... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.network.avi.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ... |
"""Simple example to show how to use weave.inline on SWIG2 wrapped
objects. SWIG2 refers to SWIG versions >= 1.3.
To run this example you must build the trivial SWIG2 extension called
swig2_ext. To do this you need to do something like this::
$ swig -c++ -python -I. -o swig2_ext_wrap.cxx swig2_ext.i
$ g++ -Wall ... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import errno
import os
import shutil
import tarfile
from pants.util.contextutil import open_tar
from pants.util.dirutil import safe_mkdir, safe_mkdir_for, safe_walk
... |
'''
tableCodeEval.py - Solution to Problem Multiplication Tables (Category - Easy)
Copyright (C) 2013, Shubham Verma
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 ... |
from __future__ import print_function, division
from pyglet.gl import *
from pyglet.window import Window
from pyglet.clock import Clock
from threading import Thread, Lock
gl_lock = Lock()
class ManagedWindow(Window):
"""
A pyglet window with an event loop which executes automatically
in a separate thre... |
from django.db import connections
from django.db.models.query import sql
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import aggregates as gis_aggregates
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.contri... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 12:21:17 2019
@author: zijiazhang
"""
import itertools
import xml.etree.ElementTree as ET
from ast import literal_eval as make_tuple
from string import Template
def findcontain(elem, tag):
for child in elem:
if tag in child.tag:
... |
"""
Support to communicate with a Buderus KM200 unit.
"""
import logging
import base64
import json
import binascii
import urllib.request, urllib.error, urllib.parse
import voluptuous as vol
from io import StringIO
from Crypto.Cipher import AES
from homeassistant.helpers import config_validation as cv
fr... |
"""Test suite for the profile module."""
import sys
import pstats
import unittest
from difflib import unified_diff
from io import StringIO
from test.support import run_unittest
import profile
from test.profilee import testfunc, timer
class ProfileTest(unittest.TestCase):
profilerclass = profile.Profile
met... |
"""
Testing for the partial dependence module.
"""
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import if_matplotlib
from sklearn.ensemble.partial_dependence import partial_dependence
from sklearn.ensemble.partial_dependence... |
from oslo_config import cfg
from nova.tests.functional.api_sample_tests import api_sample_base
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class SecurityGroupDefaultRulesSampleJsonTest(
api_sample_base.ApiSampleTestBaseV21):
... |
"""
Matplotlib Exporter
===================
This submodule contains tools for crawling a matplotlib figure and exporting
relevant pieces to a renderer.
"""
import warnings
import io
from . import utils
import matplotlib
from matplotlib import transforms
from matplotlib.backends.backend_agg import FigureCanvasAgg
clas... |
""" robotparser.py
Copyright (C) 2000 Bastian Kleineidam
You can choose between two licenses when using this package:
1) GNU GPLv2
2) PSF license for Python 2.2
The robots.txt Exclusion Protocol is implemented as specified in
http://www.robotstxt.org/norobots-rfc.txt
"""
import ... |
try:
from dl import RTLD_LAZY, RTLD_GLOBAL
except ImportError:
# dl doesn't seem to be available on 64bit systems
try:
from DLFCN import RTLD_LAZY, RTLD_GLOBAL
except ImportError:
pass
import os
import sys
import gc
import unittest
import pygtk
pygtk.require('2.0')
import gobject
try:
... |
import types
class LazyFactory(object):
def __init__(self, module_str, callable_str):
self.module_str = module_str
self.callable_str = callable_str
self.factory = None
def resolve(self):
if self.factory == None:
self.factory = reduce(lambda x, y: getattr(x, y),
... |
from __future__ import unicode_literals
from django.core.urlresolvers import reverse_lazy
from django.views import generic
from django.shortcuts import redirect
from django.contrib.auth import get_user_model
from django.contrib import auth
from django.contrib import messages
from authtools import views as authviews
fro... |
"""
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
import itertools
# Fallback for Python 2.4, Python 2.5
def product(*args, **kwds):
"""
Taken from http://docs... |
def new_section(concept_title, concept_description):
html_a = '''
<div class="concept">
<div class="concept-title">
<h3>''' + concept_title + '</h3>'
html_b= '''
</div>
<div class="concept-description">
<p>
''' +... |
""" A script for testing DraftRegistrationApprovals. Automatically approves all pending
DraftRegistrationApprovals.
"""
import sys
import logging
from framework.celery_tasks.handlers import celery_teardown_request
from website.app import init_app
from website.project.model import DraftRegistration, Sanction
logger =... |
"""
Django settings for ccswm project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# ... |
from pyflink.dataset.execution_environment import ExecutionEnvironment
from pyflink.datastream.stream_execution_environment import StreamExecutionEnvironment
from pyflink.table.table_environment import BatchTableEnvironment, StreamTableEnvironment
class MLEnvironment(object):
"""
The MLEnvironment stores the ... |
"""Subclass of CloudBucket used for testing."""
from tests.rendering_test_manager import cloud_bucket
class MockCloudBucket(cloud_bucket.CloudBucket):
"""Subclass of CloudBucket used for testing."""
def __init__(self):
"""Initializes the MockCloudBucket with its datastore.
Returns:
An instance of... |
"""
PyCounters is a light weight library to monitor performance in production system.
It is meant to be used in scenarios where using a profile is unrealistic due to the overhead it requires.
Use PyCounters to get high level and concise overview of what's going on in your production code.
See #### (read the docs) for... |
"""
Template tags and helper functions for displaying breadcrumbs in page titles
based on the current micro site.
"""
from django import template
from django.conf import settings
from microsite_configuration import microsite
from django.templatetags.static import static
register = template.Library()
def page_title_b... |
"""Test core types like Molecule and Atom."""
from chemlab.core import Molecule, Atom
from chemlab.core import System, subsystem_from_molecules, subsystem_from_atoms
from chemlab.core import merge_systems
from chemlab.core import crystal, random_lattice_box
import numpy as np
from nose.tools import eq_, assert_equals
f... |
import inspect
import os
import pkgutil
import warnings
from importlib import import_module
from threading import local
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils._os import upath
from django.utils.deprecation import RemovedIn... |
import unittest
from django.contrib.gis.gdal import HAS_GDAL
from django.db import connection
from django.test import skipUnlessDBFeature
from django.utils import six
from .utils import SpatialRefSys, oracle, postgis, spatialite
test_srs = ({
'srid': 4326,
'auth_name': ('EPSG', True),
'auth_srid': 4326,
... |
"""Add roles and permissions tables
Revision ID: 3bf5430a8c6f
Revises: None
Create Date: 2013-06-27 03:25:26.571232
"""
# revision identifiers, used by Alembic.
revision = '3bf5430a8c6f'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('roles',
sa.Column('id'... |
# -*- coding: utf-8 -*-
""" Commerce app tests package. """
import datetime
import json
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from freezegun import freeze_time
import httpretty
import jwt
import mock
from ecommerce_api_client import auth
from... |
from django.template.defaultfilters import urlizetrunc
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class UrlizetruncTests(SimpleTestCase):
@setup({'urlizetrunc01':
'{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% en... |
import sys, os, arcgisscripting, subprocess
def return_classification(classification):
if (classification == "created, never classified (0)"):
return "0"
if (classification == "unclassified (1)"):
return "1"
if (classification == "ground (2)"):
return "2"
if (classifica... |
#!/usr/bin/python -u
import socket
import time
import os
import sys
from subprocess import call
import random
FILENAME_BREAK = "/tmp/break.tmp"
FILENAME_OVERLOAD = "/tmp/load.tmp"
IP_ADDRESS = socket.gethostbyname(socket.gethostname())
MEMORY_LIMIT = "50"
FIXED_STRING = "event FIXED " +... |
from .. import mparser
class AstVisitor:
def __init__(self) -> None:
pass
def visit_default_func(self, node: mparser.BaseNode) -> None:
pass
def visit_BooleanNode(self, node: mparser.BooleanNode) -> None:
self.visit_default_func(node)
def visit_IdNode(self, node: mparser.IdNo... |
import numpy as np
from ase.units import Bohr
from ase.parallel import paropen
from ase.utils import prnt
from gpaw.spherical_harmonics import Y
from gpaw.utilities.tools import coordinates
class Multipole:
"""Expand a function on the grid in multipole moments
relative to a given center.
center: Vector... |
"""This code example runs a report equal to the "Whole network report" on the
DFP website.
"""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
import tempfile
# Import appropriate modules from the client library.
from googleads import dfp
from googleads import errors
def main(client):
# Initialize ... |
#!/usr/bin/env python
# NOT FINISHED (Needs tidying, can only follow OpaqueRefs, whereas some references are by uuid)
# This is supposed to be a general xapi database graphing tool.
# I've got a bit distracted, so I'm checking it in so it doesn't get lost.
# sample command line
# ./graphxapi.py | dot -Tpng >doom.png ;... |
import os
import re
import time
HAS_XMPP = True
try:
import xmpp
except ImportError:
HAS_XMPP = False
def main():
module = AnsibleModule(
argument_spec=dict(
user=dict(required=True),
password=dict(required=True),
to=dict(required=True),
msg=dict(re... |
#!/usr/bin/env python
"""
An example using networkx.Graph().
miles_graph() returns an undirected graph over the 128 US cities from
the datafile miles_dat.txt. The cities each have location and population
data. The edges are labeled with the distance betwen the two cities.
This example is described in Section 1.1 in ... |
'''
radio module
'''
# pylint: disable=line-too-long
# pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-arguments
# pylint: disable=trailing-whitespace
import time
import serial
import sensor
ONEBIT = 0b1
#-------------------------------------------------------------------
# Let's Setup ... |
"""BibFormat element - Prints reprinted editions
"""
__revision__ = "$Id$"
def format_element(bfo, separator):
"""
Prints the reprinted editions of a record
@param separator: a separator between reprinted editions
@see: place.py, publisher.py, imprint.py, date.py, pagination.py
"""
reprints =... |
import delivery
import mgn
import mgn_referential
import partner
import product
import product_attributes
import product_images
import sale
import wizard |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network_common import ComplexList
from ansible.module_utils.eos import load_config, get_con... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import patch, MagicMock
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.executor.play_iterator import HostState, PlayIterator
from ansible.playbook ... |
#! /bin/python
# -*- coding: UTF-8 -*-
import urllib2, json, datetime, time
import dateutil.parser
global latitude
global longitude
api=json.loads(urllib2.urlopen("http://freegeoip.net/json/").read().decode("UTF-8"))
latitude=str(api['latitude'])
longitude=str(api["longitude"])
def getsunrise(lat="", lng="", formatt... |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import re
from ansible.module_utils.nxos import get_config, load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_util... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
def is_quoted(data):
return len(data) > 1 and data[0] == data[-1] and data[0] in ('"', "'") and data[-2] != '\\'
def unquote(data):
''' removes first and last quotes from a string, if the string starts and ends with the ... |
def __boot():
import sys, imp, os, os.path
PYTHONPATH = os.environ.get('PYTHONPATH')
if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
PYTHONPATH = []
else:
PYTHONPATH = PYTHONPATH.split(os.pathsep)
pic = getattr(sys,'path_importer_cache',{})
stdpath = sys.... |
from typing import Any
from django.db import ProgrammingError
from confirmation.models import generate_realm_creation_url
from zerver.lib.management import ZulipBaseCommand, CommandError
from zerver.models import Realm
class Command(ZulipBaseCommand):
help = """
Outputs a randomly generated, 1-time-use link ... |
# -*- coding: utf-8 *-*
import pyglet
from . import util, resources
# update and collision helper functions
def process_sprite_group(group, dt):
"""
calls update for the whole group and removes after who returns True
"""
for item in set(group):
try:
if item.update(dt):
... |
from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class PythonListAsValue (TestCase):
def testSettingPythonList(self):
defaults = NSUserDefaults.standardUserDefaults()
defaults.setObject_forKey_([b'a'.decode('ascii'), b'b'.decode('... |
"""
Discrete Fourier Transform (:mod:`numpy.fft`)
=============================================
.. currentmodule:: numpy.fft
Standard FFTs
-------------
.. autosummary::
:toctree: generated/
fft Discrete Fourier transform.
ifft Inverse discrete Fourier transform.
fft2 Discrete Fourier tr... |
import inspect
import logging
from gloria.service.runnable import Task, Service
on_task_wrapped = None
on_service_wrapped = None
class _WrapperHelper(object):
def __call__(self, klass, base, _enabled, _autostart, _respawn):
return type(klass.__name__, (base,), dict(klass.__dict__, enabled=_enabled, autos... |
import os, sys
script_dir = os.path.dirname(__file__)
os.chdir(os.path.abspath(script_dir))
print("Boost.Geometry is making .qbk files in %s" % os.getcwd())
if 'DOXYGEN' in os.environ:
doxygen_cmd = os.environ['DOXYGEN']
else:
doxygen_cmd = 'doxygen'
if 'DOXYGEN_XML2QBK' in os.environ:
doxygen_xml2qbk_cm... |
from openerp.osv import fields,osv
from openerp.tools.sql import drop_view_if_exists
class report_timesheet_line(osv.osv):
_name = "report.timesheet.line"
_description = "Timesheet Line"
_auto = False
_columns = {
'name': fields.char('Year', required=False, readonly=True),
'user_id': fi... |
"""
Implementation module for the I{mailmail} command.
"""
import os
import sys
import rfc822
import getpass
from ConfigParser import ConfigParser
try:
import cStringIO as StringIO
except:
import StringIO
from twisted.copyright import version
from twisted.internet import reactor
from twisted.mail import smtp... |
"""Restricted Boltzmann Machine
"""
# Authors: Yann N. Dauphin <<EMAIL>>
# Vlad Niculae
# Gabriel Synnaeve
# Lars Buitinck
# License: BSD 3 clause
import time
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator
from ..base import TransformerMixin
from ..externals... |
import functools
from rest_framework import serializers
from amcat.models.task import IN_PROGRESS
from amcat.models import Task
from amcat.tools import amcattest
from api.rest.serializer import AmCATModelSerializer
__all__ = ("TaskSerializer", "TaskResultSerializer")
class TaskSerializer(AmCATModelSerializer):
""... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para piratestreaming
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import urlparse
from core import config
f... |
"""
Reorganisation step: cleanup all local data.
Cleanup the local data (for the whole data-set) created during copy_to_local step.
Configuration variables used:
* :reorganisation:copy_to_local section
* OUTPUT_FOLDER: destination folder for the local copy
"""
from datetime import timedelta
from textwrap imp... |
"""Tests for setuptools.find_packages()."""
import os
import sys
import shutil
import tempfile
import unittest
import platform
import setuptools
from setuptools import find_packages
from setuptools.tests.py26compat import skipIf
find_420_packages = setuptools.PEP420PackageFinder.find
def has_symlink():
bad_symli... |
print("""Enter 'C' or 'c' for Celsius,
'K' or 'k' for Kelvin,
'F' or 'f' for Fahrenheit\n\n""")
converted=0
fr=input("I want converter from: \n")
value1=input("Enter value: \n")
to=input("to: \n")
try:
value1=float(value1)
if(fr=='C' or fr=='c'):
if(to=='F' or to=='f'):
... |
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.views.generic.base import TemplateResponseMixin, View
from django.views.generic.detail import (SingleObjectMixin,
SingleObjectTemplateRe... |
import collections
import threading
import grpc
from grpc import _common
from grpc._cython import cygrpc
class AuthMetadataContext(
collections.namedtuple('AuthMetadataContext', (
'service_url', 'method_name',)), grpc.AuthMetadataContext):
pass
class AuthMetadataPluginCallback(grpc.AuthMeta... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
from django.core import checks
from django.core.checks.registry import registry
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = "Checks the entire Django project for p... |
#!/usr/bin/env python3
import argparse
import os
import sys
import boto3
import json
def get_entity_sizes(bucket, prefix):
s3 = boto3.client("s3")
prefix = f"{prefix}social_network/csv/raw/composite-merged-fk/dynamic/"
more = True
token = None
sizes = {}
while more:
resp = s3.list_obj... |
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, NetworkThread
from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.script... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.