content stringlengths 4 20k |
|---|
import sys
import imp
import marshal
from distutils.version import StrictVersion
from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN
from setuptools.extern import six
__all__ = [
'Require', 'find_module', 'get_module_constant', 'extract_constant'
]
class Require:
"""A prerequisite to building o... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import markupfield.fields
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODE... |
"""
Common mixins for Course API Tests
"""
from datetime import datetime
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.factories import ToyCourseFactory
TEST_PASSWORD = u'edx'
class CourseApiFactoryMixin(object):
"""
Mixin to allow creation of test courses and users.
"... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.facts.namespace import PrefixFactNamespace
from ansible.module_utils.facts import default_collectors
from ansible.module_utils.facts import ansible_collector
def get_all_facts(module):
'''compat api ... |
'''OpenGL extension NV.vertex_array_range
This module customises the behaviour of the
OpenGL.raw.WGL.NV.vertex_array_range to provide a more
Python-friendly API
Overview (from the spec)
The goal of this extension is to permit extremely high vertex
processing rates via OpenGL vertex arrays even when the CPU lack... |
#!/usr/bin/python
from numpy import *
from matplotlib.pylab import *
def mag_calibration(mag,gyros=None,LH=200,LV=500):
""" Calibrates the magnetometer data by fitting it to a sphere,
ideally when constantly turning to spread the data around that
sphere somewhat evenly (or at least in a horizo... |
"""Tests for contrib.layers.python.layers.normalization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.framework.python.ops import variables as contrib_variables
from tensorflow.contrib.layers.python.layers i... |
"""
Call Stack Manager deals with tracking call stacks of functions/methods/classes(Django Model Classes)
Call Stack Manager logs unique call stacks. The call stacks then can be retrieved via Splunk, or log reads.
classes:
CallStackManager - stores all stacks in global dictionary and logs
CallStackMixin - used for Mo... |
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# In this test we simulate broken server, where it always sends
# stale=true with all 401 responses. We should expect pjsip to
# retry the authentication until PJSIP_MAX_STALE_COUNT is
# exceeded. When pjsip retries the authentication, it should
# use the new nonce fr... |
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.distributed.DistributedObjectBase import DistributedObjectBase
#from PyDatagram import PyDatagram
#from PyDatagramIterator import PyDatagramIterator
# Values for DistributedObjectOV.activeState
# these should match DistributedObject.ES*
ESNe... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core import mail
from django.utils.encoding import smart_str
import mock
from nose.tools import eq_
import mkt.site.tests
from mkt.ratings.cron import email_daily_ratings
from mkt.ratings.models import Review
from mkt.site.fixtures import fixture
fr... |
#!/usr/bin/env python
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, Noah Spurrier <<EMAIL>>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PURPOSE WITH OR WITHOUT F... |
from keys import (Data, Key)
from runnable import Runnable
import threading
import time
import logging
logger = logging.getLogger(__name__)
class InputProcessor(object):
'''Object to process key presses.'''
def process_input(self, inputEvent):
'''Processes given event.
Should return as fast ... |
import securionpay as api
import requests
class Resource(object):
def name(self):
return self.__class__.__name__.lower()
def _get(self, path, params=None):
return self.request('GET', path, params)
def _post(self, path, params=None):
return self.request('POST', path, params)
... |
import os
import struct
import shutil
import marshal
import io
try:
from CodernityDB import __version__
except ImportError:
from __init__ import __version__
class StorageException(Exception):
pass
class DummyStorage(object):
"""
Storage mostly used to fake real storage
"""
def create(... |
# -*- coding: utf-8 -*-
try:
import configparser
except ImportError:
# Due to PY27 compatibility
import ConfigParser as configparser
import os
from warnings import warn
def _give_default_file_path():
HOME = os.path.expanduser('~')
filepath = os.path.join(HOME, '.chemcoordrc')
return filepath
... |
from cmakefile_editor import CMakeFileEditor
from code_generator import GRMTemplate
from grc_xml_generator import GRCXMLGenerator
from modtool_base import ModTool, ModToolException, get_class_dict
from modtool_add import ModToolAdd
from modtool_disable import ModToolDisable
from modtool_info import ModToolInfo
from mod... |
from django.template.defaultfilters import cut
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class CutTests(SimpleTestCase):
@setup({'cut01': '{% autoescape off %}{{ a|cut:"x" }} {{ b|cut:"x" }}{% endautoescape %}'})
def test_cut01(self):
... |
# -*- coding: utf-8 -*-
"""
slice3.py - plot 3D data on a uniform tensor-product grid as a set of
three adjustable xy, yz, and xz plots
Copyright (c) 2013 Greg von Winckel
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and ... |
import re
try:
from inspect import Parameter, signature
except ImportError:
signature = None
from inspect import getfullargspec
_EMPTY_SENTINEL = object()
def inc(x):
""" Add one to the current value """
return x + 1
def dec(x):
""" Subtract one from the current value """
return x - 1
... |
import unittest
import inspect
import sys
from unittest.mock import Mock, MagicMock, _magics
class TestMockingMagicMethods(unittest.TestCase):
def test_deleting_magic_methods(self):
mock = Mock()
self.assertFalse(hasattr(mock, '__getitem__'))
mock.__getitem__ = Mock()
self.asser... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .turner import TurnerBaseIE
from ..utils import (
int_or_none,
parse_iso8601,
)
class TruTVIE(TurnerBaseIE):
_VALID_URL = r'https?://(?:www\.)?trutv\.com/(?:shows|full-episodes)/(?P<series_slug>[0-9A-Za-z-]+)/(?:videos/(?P<clip_slug>... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... |
#!/usr/bin/env python
"""API renderer for rendering descriptors of GRR data structures."""
from grr.gui import api_call_renderers
from grr.gui import api_value_renderers
from grr.lib import rdfvalue
from grr.lib.rdfvalues import structs as rdf_structs
from grr.proto import api_pb2
class ApiRDFValueReflectionRende... |
# This file is generated by /io/numpy/setup.py
# It contains system_info results at the time of building this package.
__all__ = ["get_info","show"]
lapack_opt_info={'libraries': ['openblas', 'openblas'], 'library_dirs': ['/usr/local/lib'], 'language': 'c', 'define_macros': [('HAVE_CBLAS', None)]}
blas_opt_info={'libr... |
import os,sys
from waflib import Configure,Options,Utils
from waflib.Tools import ccroot
from waflib.Configure import conf
@conf
def find_emxx(conf):
cxx=conf.find_program(['em++'], var = "CXX")
cxx=conf.cmd_to_list(cxx)
conf.env.CXX_NAME='emcc'
conf.env.CXX=cxx
@conf
def emxx_common_flags(conf):
v=con... |
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.executive_mock import MockExecutive
class MockSCM(object):
executable_name = "MockSCM"
def __init__(self, filesystem=None, executive=None):
self.checkout_root = "/mock-checkout/third_party/WebKit"
se... |
from __future__ import with_statement
from django.test import TestCase
from models import Person
class AssertNumQueriesContextManagerTests(TestCase):
def test_simple(self):
with self.assertNumQueries(0):
pass
with self.assertNumQueries(1):
Person.objects.count()
... |
from __future__ import absolute_import
from django.core.management.base import NoArgsCommand
from django.contrib.auth.models import User,Group
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.utils.translation import ugettext as _
from django.utils impo... |
"""
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations ... |
from __future__ import absolute_import
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.exceptions import CommandError
class HelpCommand(Command):
"""Show help for commands"""
name = 'help'
usage = """
%prog <command>"""
su... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import socket
from ansible.module_utils.six import StringIO
from ansible.module_utils.six.moves.http_cookiejar import Cookie
from ansible.module_utils.six.moves.http_client import HTTPMessage
from ansible.module_utils.urls import fe... |
from __future__ import division
from builtins import str
import numpy as np
import pycuda.driver as drv
from neon import logger as neon_logger
from neon.backends.nervanagpu import NervanaGPU
from neon.backends.nervanacpu import NervanaCPU
from neon.backends.convolution import (_ceil_div,
FpropCuda, Bprop... |
import csv
csvfile1=file('simpl.csv','rb')
fin1=csv.reader(csvfile1)
label_dict={'back.':0,'buffer_overflow.':1,'ftp_write.':2,'guess_passwd.':3,'imap.':4,'ipsweep.':5,'land.':6,'loadmodule.':7,
'multihop.':8,'neptune.':9,'nmap.':10,'normal.':11,'perl.':12,'phf.':13,'pod.':14,'portsweep.':15,'rootkit.':16,... |
from PyQt5.QtCore import QTimer
from UM.Extension import Extension
from UM.Preferences import Preferences
from UM.Application import Application
from UM.Resources import Resources
from UM.Logger import Logger
class AutoSave(Extension):
def __init__(self):
super().__init__()
Preferences.getInstanc... |
from __future__ import absolute_import
import argparse
import sys
class FixedArgumentParser(argparse.ArgumentParser):
'''
fixes argparse's handling of empty string arguments
and changes @filename behaviour to accept multiple arguments on each line
'''
def _read_args_from_files(self, arg_strings)... |
"""Base64 content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode arbitrary 8-bit data using the three 8-bit bytes in four 7-bit
characters encoding known as Base64.
It is used in the MIME standards for email to attach images, audio, and tex... |
import os.path
import re
import shutil
import sys
import tempfile
import zipfile
from distutils import dist
from glob import iglob
from ..bdist_wheel import bdist_wheel
from ..wheelfile import WheelFile
from . import WheelError, require_pkgresources
egg_info_re = re.compile(r'''
(?P<name>.+?)-(?P<ver>.+?)
(-(... |
import requests
import sqlite3
import web
import time
import os
import sys
# 加密?-> 出租服务器
"""
Using two server to provide wechat subscription service,
one for acquring token, one for processing request
"""
PATH = os.path.abspath(os.path.dirname(sys.argv[0])) # The path of this file
timer=os.times()
web.config.debug = ... |
import operator
from ..node import NodeVisitor
from ..parser import parse
class Compiler(NodeVisitor):
"""Compiler backend that evaluates conditional expressions
to give static output"""
def compile(self, tree, expr_data, data_cls_getter=None, **kwargs):
"""Compile a raw AST into a form with con... |
#!/usr/bin/python3
# pylint: disable=invalid-name, line-too-long, import-error, no-member, missing-docstring, broad-except
import argparse
import sys
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def payload... |
from decimal import Decimal
from tests.compat import unittest
from boto.compat import six
from boto.dynamodb import types
from boto.dynamodb.exceptions import DynamoDBNumberError
class TestDynamizer(unittest.TestCase):
def setUp(self):
pass
def test_encoding_to_dynamodb(self):
dynamizer = ty... |
'''
Created on 2. okt. 2010
@author: Yngve
'''
"""Report Renego patched/unpatched based on Alexa ranking only sites with EV certificates"""
import sys,os,subprocess,time,os.path
sys.path.insert(1, os.path.join(".."))
import libinit
from optparse import OptionParser
import probedb.standalone
import probedb.probeda... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import subprocess
import sys
from collections import Mapping
from six import iteritems
from ansible import constants as C
from ansible.errors import *
from ansible.inventory.host import Host
from ansible.inventory.group... |
'''Metrics to compare disaggregation performance against ground truth
data.
All metrics functions have the same interface. Each function takes
`predictions` and `ground_truth` parameters. Both of which are
nilmtk.MeterGroup objects. Each function returns one of two types:
either a pd.Series or a single float. Most... |
from py4j.protocol import Py4JJavaError
from pyspark.rdd import RDD
from pyspark.storagelevel import StorageLevel
from pyspark.serializers import AutoBatchedSerializer, PickleSerializer, PairDeserializer, \
NoOpSerializer
from pyspark.streaming import DStream
from pyspark.streaming.dstream import TransformedDStrea... |
# spinner_thread.py
# credits: Adapted from Michele Simionato's
# multiprocessing example in the python-list:
# https://mail.python.org/pipermail/python-list/2009-February/538048.html
# BEGIN SPINNER_THREAD
import threading
import itertools
import time
import sys
class Signal: # <1>
go = True
def spin(msg, s... |
#!/usr/bin/env python
"""A module with API handlers related to the YARA memory scanning."""
from grr_response_core.lib.rdfvalues import structs as rdf_structs
from grr_response_proto.api import yara_pb2
from grr_response_server import data_store
from grr_response_server.gui import api_call_context
from grr_response_se... |
from src.priority import Priority
TEST_LIST = [
(2, 1),
(5, 1),
(1, 1),
(2, 2),
(1, 2),
(2, 3),
(5, 2),
(4, 1),
(6, 1),
(8, 1),
(1, 3),
(2, 4),
]
def test_pri_push():
test_pri = Priority()
test_pri.push((1, 'a'))
assert test_pri.plist[0] == (1, 'a')
def te... |
"""Tests for Python ops defined in math_grad.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class SquaredDifferenceOpTest(tf.test.TestCase):
def _testGrad(self, left_shape, right_shape):
if len(le... |
from mediawords.util.perl import decode_object_from_bytes_if_needed
# MC_REWRITE_TO_PYTHON: rename back to ExtractorArguments after rewrite
class PyExtractorArguments(object):
"""Arguments to process_extracted_story() that define how story is to be extracted."""
# MC_REWRITE_TO_PYTHON: remake into data class... |
__author__ = "Felix Brezo, Yaiza Rubio <<EMAIL>>"
__version__ = "2.0"
from osrframework.utils.platforms import Platform
class Myeloma(Platform):
"""A <Platform> object for Myeloma"""
def __init__(self):
self.platformName = "Myeloma"
self.tags = ["opinions"]
########################
... |
from __future__ import unicode_literals
from django.template.defaultfilters import filesizeformat
from django.test import SimpleTestCase
from django.utils import translation
class FunctionTests(SimpleTestCase):
def test_formats(self):
self.assertEqual(filesizeformat(1023), '1023\xa0bytes')
self.... |
from test_framework.test_framework import KoreTestFramework
from test_framework.util import *
class TxnMallTest(KoreTestFramework):
def add_options(self, parser):
parser.add_option("--mineblock", dest="mine_block", default=False, action="store_true",
help="Test double-spend of 1-... |
# ---------------------------------------------------------------------
# Model 1 : Random Geometric Graph
# Python script to generate data using model-1 and perform greedy pivot
# algorithm.
#
# Note: All Indices, whatsoever, start from 0.
# ---------------------------------------------------------------------
import... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import sys
import matplotlib
matplotlib.use("QT4Agg")
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from gnuradio.ctrlport.GNURadioControlPortClient import (
GNURadioControlPortC... |
import os
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
class Command(LabelCommand):
help = "Creates a Django app directory structure for the given app name in the current directory."
args = "[appname]"
label = 'application... |
from django import shortcuts
import django.views.decorators.vary
import horizon
from horizon import base
from horizon import exceptions
def get_user_home(user):
dashboard = None
if user.is_superuser:
try:
dashboard = horizon.get_dashboard('admin')
except base.NotRegistered:
... |
"""
This is a class implementing a flexible metric-store and an HTTP
thread for browsing the numbers.
"""
##############################################################################
LICENSE = """\
This file is part of pagekite.py.
Copyright 2010-2013, the Beanstalks Project ehf. and Bjarni Runar Einarsson
This prog... |
# vim: set sw=4 ts=4 softtabstop=4 expandtab:
from collections import namedtuple
import logging
import pprint
import re
_logger = logging.getLogger(__name__)
# Possibe run outcomes
SuccessfulExecution = namedtuple("SuccessfulExecution", ["msg"])
ASanError = namedtuple("ASanError", ["msg", "type", "stack_trace"])
UBSa... |
__all__ = [
'safe_hasattr',
'try_import',
'try_imports',
]
import sys
def try_import(name, alternative=None, error_callback=None):
"""Attempt to import ``name``. If it fails, return ``alternative``.
When supporting multiple versions of Python or optional dependencies, it
is useful to be... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging as loggers
logging = loggers.getLogger(__name__)
from . import MiniBatches
import numpy as np
from deepy.utils import global_rand, FakeGenerator
class BunchSequences(MiniBatches):
"""
Arrange sequences in bunch mode.
See http://mi.eng.cam.ac.uk... |
# -*- coding: utf-8 -*-
import webapp2
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
from collections import OrderedDict, Counter
from wtforms import fields
from bp_includes import forms
from bp_includes.lib.basehandler import BaseHandler
class AdminUserGeoChartHan... |
"""
SRVis Copyright (C) 2015 Niklas Berliner
"""
import sys
import numpy as np
import tifffile as Tiff
from localisationClass import rapidstormLocalisations, XYTLocalisations
#from visualiseLocalisations import QuadTree
class dataHandler():
"""
Interface between the data and the SRVis application
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# http://binux.me
# Created on 2014-12-08 22:23:10
import time
import logging
logger = logging.getLogger('bench')
from pyspider.scheduler import Scheduler
from pyspider.fetcher.tornado_fetcher import Fetcher
from ... |
import os
try:
from pyvcloud.vcloudair import VCA
HAS_PYVCLOUD = True
except ImportError:
HAS_PYVCLOUD = False
from ansible.module_utils.basic import AnsibleModule
SERVICE_MAP = {'vca': 'ondemand', 'vchs': 'subscription', 'vcd': 'vcd'}
LOGIN_HOST = {'vca': 'vca.vmware.com', 'vchs': 'vchs.vmware.com'}
DEF... |
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import re
from datetime import datetime
from asn1crypto.util import int_from_bytes, timezone
from asn1crypto.x509 import Certificate
from ._cipher_suites import CIPHER_SUITE_MAP
from .errors import TLSVerificationError... |
from nose import SkipTest
from sprox.sa.provider import SAORMProvider
from sprox.test.base import setup_database, setup_records, SproxTest
from sprox.test.model import *
from sprox.sa.widgetselector import SAWidgetSelector
import sqlalchemy
from sqlalchemy.orm import mapper, lazyload
from sqlalchemy import MetaData, Ta... |
"""Modifies column `tag.value`."""
from invenio.legacy.dbquery import run_sql
depends_on = ['invenio_2012_11_15_hstRECORD_marcxml_longblob']
def info():
"""Return upgrade recipe information."""
return "Modifies column tag.value"
def do_upgrade():
"""Carry out the upgrade."""
create_statement = run... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_say
version_added: "2.3"
short_description: Text to speech module for Windows to speak messages and optionally play sounds
description:
- U... |
#!/usr/bin/env python
"""demonstrate pycairo and pygame
method1: use an intermediate Python array object
"""
import array
import math
import sys
import cairo
import pygame
def draw(surface):
x,y, radius = (250,250, 200)
ctx = cairo.Context(surface)
ctx.set_line_width(15)
ctx.arc(x, y, radius, 0, 2.0 * math.p... |
from urlparse import urlparse
from cgi import parse_qs
from urllib import unquote
import signal, thread, threading, time
import BaseHTTPServer, SocketServer, mimetypes
# **************************************************************************************************
# Globals
global done, server, consoleCommand, ph... |
import unittest.mock
import pytest
from google.cloud.ndb import _datastore_types
from google.cloud.ndb import exceptions
class TestBlobKey:
@staticmethod
def test_constructor_bytes():
value = b"abc"
blob_key = _datastore_types.BlobKey(value)
assert blob_key._blob_key is value
@s... |
"""
Unit tests for stub EdxNotes implementation.
"""
import urlparse
import json
import unittest
import requests
from uuid import uuid4
from ..edxnotes import StubEdxNotesService
class StubEdxNotesServiceTest(unittest.TestCase):
"""
Test cases for the stub EdxNotes service.
"""
def setUp(self):
... |
import os
import sys
import serial
import struct
import array
import time
import binascii
def crc(s): # CRC-32 of string s
return binascii.crc32(s) & 0xffffffff
from PIL import Image, ImageChops
def fetch8(pix, x, y, ser):
difference = ord(ser.read(1))
if (difference & 1) == 0:
assert 0, "diffe... |
'''Test functions and SearchEngine class in SearchEngine.py.'''
# With mock replacements, the module does not use any gui widgets.
# The use of tk.Text is avoided (for now, until mock Text is improved)
# by patching instances with an index function returning what is needed.
# This works because mock Text.get does not ... |
import datetime
import os
import shutil
import sys
import time
import urllib
import urllib.request
import zipfile
from os.path import dirname, abspath
"""
This tool builds a release from the a given elasticsearch plugin branch.
It is basically a wrapper on top of launch_release.py which:
- tries to get a more re... |
""" submit failure or test session information to a pastebin service. """
import pytest
import sys
import tempfile
def pytest_addoption(parser):
group = parser.getgroup("terminal reporting")
group._addoption('--pastebin', metavar="mode",
action='store', dest="pastebin", default=None,
choices=[... |
from unittest import TestCase
from scrapy.http import Response, Request
from scrapy.spider import BaseSpider
from scrapy.contrib.spidermiddleware.httperror import HttpErrorMiddleware, HttpError
class TestHttpErrorMiddleware(TestCase):
def setUp(self):
self.spider = BaseSpider('foo')
self.mw = Ht... |
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class StaticInitializers(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(archs="aarch64", oslist=["freebsd", "linux"],
bugnumber="https... |
# -*- coding: utf-8 -*-
# See the "Code officiel géographique" on the INSEE website <www.insee.fr>.
from __future__ import unicode_literals
DEPARTMENT_CHOICES = (
# Metropolitan departments
('01', '01 - Ain'),
('02', '02 - Aisne'),
('03', '03 - Allier'),
('04', '04 - Alpes-de-Haute-Provence'),
... |
from __future__ import unicode_literals
from django.contrib.sites.models import Site
from django.db import models
from django.test import TestCase
from .models.publication import Publication
from .models.article import Article
class Advertisement(models.Model):
customer = models.CharField(max_length=100)
pu... |
"""Filename matching with shell patterns.
fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.
The functions operate by translating the pattern into a regular
expression. They cache the compiled regular expressions for speed.
The function... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import copy
import logging
from math import ceil
from flask import jsonify, request
from sqlalchemy.orm.exc import NoResultFound
from flexget.api import api, APIResource
from ... |
import unittest
from mock import patch, Mock, call, ANY
from sh import Command, CommandNotFound
from pycalico.datastore import DatastoreClient
from etcd import EtcdResult, EtcdException, Client
from calico_ctl import diags
class TestDiags(unittest.TestCase):
@patch('calico_ctl.diags.tempfile', autospec=True)
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from nose import tools
from ansible.compat.tests import unittest
from ansible.parsing.splitter import unquote
# Tests using nose's test generators cannot use unittest base class.
# http://nose.readthedocs.org/en/latest/writing_t... |
"""
Created on Aug 02 2016
@author: Linh Van Nguyen (<EMAIL>)
"""
import numpy as np
from netCDF4 import Dataset
def data_preprocess(sspacing, tspacing):
"""
Load coupled input-output of LR and HR from file and normalize to zero-mean
and one- standard deviation
Parameters
----------
sspacing... |
import gtkutils
import gtk
import os
import paths
class PackagesWidget(gtk.Table):
def __init__(self, project):
gtk.Table.__init__(self, 2, 2)
self.project = project
self.packages_list = gtkutils.SimpleList([("Available packages", str)])
self.selected_list = gtkutils.SimpleList([(... |
# -*- coding: utf-8 -*-
"""
pygments.styles.tango
~~~~~~~~~~~~~~~~~~~~~
The Crunchy default Style inspired from the color palette from
the Tango Icon Theme Guidelines.
http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines
Butter: #fce94f #edd400 #c4a000
Orange: #fcaf3e ... |
import os
import struct
import signal
from datetime import datetime
from collections import namedtuple
from devlib.utils.misc import memoized
from wa.framework.resource import Executable, NO_ONE, ResourceResolver
from wa.utils.exec_control import once_per_class
GENERAL_MODE = 0
GAMEPAD_MODE = 1
u16_struct = struc... |
from __future__ import absolute_import
from collections import OrderedDict
from linchpin.InventoryFilters.InventoryFilter import InventoryFilter
class Inventory(InventoryFilter):
# DEFAULT_HOSTNAMES = ['public_dns_name', 'public_ip', 'private_ip']
def get_host_data(self, res, cfgs):
"""
Retu... |
import os
from os import path
from shutil import copyfileobj, move, rmtree
from multiprocessing.dummy import Pool
from io import IOBase
from hashlib import md5
from datetime import datetime
from PIL import Image
from . import photo_storage
from .application import app
thumb_width = int(app.config['THUMB_WIDTH'])
def... |
from collections import defaultdict
from telemetry.timeline import bounds
from telemetry.timeline import slice as slice_module
class MissingData(Exception):
pass
class NoBeginFrameIdException(Exception):
pass
class RenderingFrame(object):
"""Object with information about the triggering of a BeginMainFrame ... |
from __future__ import print_function, division
from sympy import Expr, sympify, Symbol, Matrix
from sympy.printing.pretty.stringpict import prettyForm
from sympy.core.containers import Tuple
from sympy.core.compatibility import is_sequence, string_types, u
from sympy.physics.quantum.dagger import Dagger
from sympy.p... |
import subprocess
import string
import fileinput
import json
import time
import sys
currencies = ['BTC', 'BCC', 'ETH', 'STRAT', 'XMR', 'OMG', 'LTH', 'GNT', 'WAVES','QTUM', 'PIVX', 'SC', 'NEO', 'LTC', 'DASH', 'PAY', 'GBYTE', 'FCT', 'ETC', 'XVG']
update_rate_mins = 5
if (len(sys.argv) > 1):
update_rate_mins = int(flo... |
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright (c) 2010 The Echo Nest. All rights reserved.
Created by Scotty Vercoe on 2010-08-25.
The Catalog module loosely covers http://developer.echonest.com/docs/v4/catalog.html
Refer to the official api documentation if you are unsure about something.
"""
try:
import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script to migrate GoogleDrive credentials from user settings object to external
account objects.
Changes:
- Create external account for authorized user settings
- Attach external account to user settings
- Attach external account to all node settings
"""
import sys... |
"""Seq2seq loss operations for use in sequence models.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.pyt... |
"""Built-in instance properties."""
import re
import uuid
from oslo.config import cfg
from nova import context
from nova import db
from nova import exception
from nova.openstack.common.db import exception as db_exc
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.