content string |
|---|
from spack import *
class Dyninst(Package):
"""API for dynamic binary instrumentation. Modify programs while they
are executing without recompiling, re-linking, or re-executing."""
homepage = "https://paradyn.org"
git = "https://github.com/dyninst/dyninst.git"
version('develop', branch='ma... |
import logging
import os
from oslo_concurrency import processutils as putils
from oslo_config import cfg
from taskflow.patterns import linear_flow as lf
from taskflow import task
from glance import i18n
_ = i18n._
_LI = i18n._LI
_LE = i18n._LE
_LW = i18n._LW
LOG = logging.getLogger(__name__)
convert_task_opts = [
... |
"""tarball
Tool-specific initialization for tarball.
"""
## Commands to tackle a command based implementation:
##to unpack on the fly...
##gunzip < FILE.tar.gz | tar xvf -
##to pack on the fly...
##tar cvf - FILE-LIST | gzip -c > FILE.tar.gz
import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Ut... |
from __future__ import with_statement
import sys
import os
from chunk import Chunk
import struct
from itertools import izip
class ZMergeError(Exception):
pass
def main(argv=sys.argv):
zinpath, savpath, zoutpath = argv[1:]
data = ''
with open(savpath, 'rb') as savf:
form = Chunk(savf)
... |
"""
Implementation of Charikar similarity hashes in Python.
Most useful for creating 'fingerprints' of documents or metadata
so you can quickly find duplicates or cluster items.
Part of python-hashes by sangelone. See README and LICENSE.
"""
from hashtype import hashtype
class simhash(hashtype):
def create_hash... |
# -*- coding: utf-8 -*-
import sys,os
notconvert=['Autoelektrik','Brauereibedarf', 'Bildhauer', 'Bauelemente', 'Feuerwehren']
format = sys.argv[1]
CalcFiles = os.listdir('./')
print CalcFiles
for onefile in CalcFiles:
if onefile[len(onefile)-4:] == '.xls':
os.system('unoconvCSV.py ' + one... |
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
import testtools
from magnum.tests.functional.common import base
from magnum.tests.functional.common import datagen
class BayModelTest(base.BaseMagnumTest):
"""Tests for baymodel CRUD."""
def __init__(self, *args, **kwargs):... |
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import helpers
from django.contrib.admin.util import (display_for_field, flatten_fieldsets,
label_for_field, lookup_field, NestedObject... |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse, reverse_lazy
from django.forms import ValidationError
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
from django.utils.translation i... |
import sys
class VendorImporter:
"""
A PEP 302 meta path importer for finding optionally-vendored
or otherwise naturally-installed packages from root_name.
"""
def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
self.root_name = root_name
self.vendored_names = set(v... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from collections import MutableSet
from datetime import datetime
from sqlalchemy import Column, Unicode, Integer, DateTime, or_, func, Boolean
from sqlalchemy.or... |
"""
Support for GCC (GNU Compiler Collection) as toolchain compiler.
:author: Stijn De Weirdt (Ghent University)
:author: Kenneth Hoste (Ghent University)
"""
import re
from distutils.version import LooseVersion
import easybuild.tools.systemtools as systemtools
from easybuild.tools.build_log import EasyBuildError
fr... |
import os
import importlib
import base64
import logging
from logging.handlers import TimedRotatingFileHandler
import sys
import asyncio
from cryptography import fernet
from pymongo import MongoClient
from bson.objectid import ObjectId
from wtforms import form, fields, validators
from flask import Flask, url_for, redir... |
from citrination_client.models.columns.base import BaseColumn
class AlloyCompositionColumn(BaseColumn):
"""
An alloy composition column configuration for a data view. Parameterized
with the basic column options, plus the balance element for the column
and the basis value for the composition.
"""
... |
"""OAuth 2.0 WSGI server middleware providing MyProxy certificates as access tokens
"""
__author__ = "W van Engen"
__date__ = "01/11/12"
__copyright__ = "(C) 2011 FOM / Nikhef"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__revision__ = "$Id$"
from base64 import b64decode
from... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## onoff-application.h: ns3::OnOffApplication [class]
module.add_class('OnOffApplication', parent=root_module['ns3::Application'])
## Register a nested... |
import pytest
from airflow.providers.google.cloud.example_dags.example_dataproc import BUCKET, PYSPARK_MAIN, SPARKR_MAIN
from tests.providers.google.cloud.utils.gcp_authenticator import GCP_DATAPROC_KEY
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest, provide_gcp_context
GCS_URI = f... |
"""
This module defines a generic session class. All connection instances
(both on Portal and Server side) should inherit from this class.
"""
import time
#------------------------------------------------------------
# Server Session
#------------------------------------------------------------
class Session(objec... |
"""
This Configuration implementation allows for persistent configuration updates
stored in ``nupic-custom.xml`` in the site conf folder.
"""
from __future__ import with_statement
from copy import copy
import errno
import logging
import os
import sys
import traceback
from xml.etree import ElementTree
from nupic.sup... |
from test.test_support import TestFailed, verbose
t = (1, 2, 3)
l = [4, 5, 6]
class Seq:
def __getitem__(self, i):
if i >= 0 and i < 3: return i
raise IndexError
a = -1
b = -1
c = -1
# unpack tuple
if verbose:
print 'unpack tuple'
a, b, c = t
if a != 1 or b != 2 or c != 3:
raise TestFail... |
import copy
import logging
class StoryDatabase(object):
# callbacks you can register listeners against
EVENT_PRE_STORY_SAVE = "preStorySave"
EVENT_POST_STORY_SAVE = "postStorySave"
def __init__(self):
self._logger = logging.getLogger(__name__)
self._db = None
def storyExists(sel... |
import gensim
from collections import (
Counter,
defaultdict as deft
)
from multiprocessing import cpu_count
from tqdm import tqdm
class WordEmbeddings:
def __init__(
self,
dimensions=100,
window=5,
min_count=1,
workers=1,
# workers=cpu_count(),
... |
import theano
import theano.tensor as T
from theano.tensor.nnet import binary_crossentropy, categorical_crossentropy
def mse(x, t):
"""Calculates the MSE mean across all dimensions, i.e. feature
dimension AND minibatch dimension.
:parameters:
- x : predicted values
- t : target values
... |
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import EUCKRDistributionAnalysis
from .mbcssm import EUCKR_SM_MODEL
class EUCKRProber(MultiByteCharSetProber):
def __init__(self):
super(EUCKRProber, self).__init__()
self.... |
import unittest
class TestResourceRecordSet(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.dns.resource_record_set import ResourceRecordSet
return ResourceRecordSet
def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)
... |
#!/usr/bin/env python
#
# Wrapper script for invoking the jar.
#
# This script is written for use with the Conda package manager.
import subprocess
import sys
import os
from os import access, getenv, path, X_OK
# Expected name of the VarScan JAR file.
JAR_NAME = 'fgbio.jar'
PKG_NAME = 'fgbio'
# Default options pass... |
"""
Django settings for youtube project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
f... |
from __future__ import absolute_import
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.comments import signals
from django.contrib.comments.models import Comment
from . import CommentTestCase
from ..models import Article, Book
post_redirect_re = re.compile... |
import datetime
import unittest
class Test_Assertions(unittest.TestCase):
def test_AlmostEqual(self):
self.assertAlmostEqual(1.00000001, 1.0)
self.assertNotAlmostEqual(1.0000001, 1.0)
self.assertRaises(self.failureException,
self.assertAlmostEqual, 1.0000001, 1.0... |
"""General statistical or mathematical functions."""
import math
def TruncatedMean(data_set, truncate_percent):
"""Calculates the truncated mean of a set of values.
Note that this isn't just the mean of the set of values with the highest
and lowest values discarded; the non-discarded values are also weighted
... |
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_... |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... |
# /**
# * Definition for singly-linked list.
# * public class ListNode {
# * int val;
# * ListNode next;
# * ListNode(int x) { val = x; }
# * }
# */
# public class Solution {
# public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
# Stack<Integer> s1 = new Stack<Integer>();
# ... |
"""
This is the REST framework test class for the iris-packagedb project REST API.
"""
#pylint: disable=no-member,missing-docstring,invalid-name
#E:397,18: Instance of 'HttpResponse' has no 'data' member (no-member)
#C: 36, 0: Missing function docstring (missing-docstring)
#C: 96, 8: Invalid variable name "d" (invalid... |
import BoostBuild
###############################################################################
#
# test_building_file_from_specific_project()
# ------------------------------------------
#
###############################################################################
def test_building_file_from_specific_project(... |
from __future__ import print_function
from optparse import OptionParser
import gc
import json
import os
import pdb
import pickle
from queue import Queue
import random
import sys
from threading import Thread
import h5py
import numpy as np
import pandas as pd
import pysam
import tensorflow as tf
if tf.__version__[0] ... |
import logging
logger = logging.getLogger(__name__)
import os
from urllib2 import urlparse
import httplib
import socket
try:
import xml.etree.cElementTree as ETree
except:
import xml.etree.ElementTree as ETree
from xl import (
event,
main,
playlist,
xdg
)
from xl.radio import *
from xl.nls impor... |
from django import http
from django.contrib import messages
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_POST
from django.db import transaction
from airmozilla.main.models import (
Approval,
Event,
SuggestedEvent
)
from airmozilla.manage ... |
"""Implements the wrapper for the Astropy test runner.
This is for backward-compatibility for other downstream packages and can be removed
once astropy-helpers has reached end-of-life.
"""
import os
import stat
import shutil
import subprocess
import sys
import tempfile
from contextlib import contextmanager
from setu... |
# -*- coding: utf-8 -*-
"""
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import os
import re
import time
import hashlib
import threading
import warnings
from base64 import b64encode
from .compat import urlparse, str, basestring
from .cookies import extract_cookies_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from string import ascii_letters, digits
from ansible.module_utils._text import to_text
from ansible.config.manager import ConfigManager
config = ConfigManager()
# Generate constants from config
for setting in config.data.get_se... |
import pytest
from airflow.providers.google.marketing_platform.example_dags.example_search_ads import GCS_BUCKET
from tests.providers.google.cloud.utils.gcp_authenticator import GMP_KEY
from tests.test_utils.gcp_system_helpers import MARKETING_DAG_FOLDER, GoogleSystemTest, provide_gcp_context
# Requires the following... |
import mock
import pytest
@pytest.fixture
def app(monkeypatch):
monkeypatch.setenv('SENDGRID_API_KEY', 'apikey')
monkeypatch.setenv('SENDGRID_SENDER', '<EMAIL>')
import main
main.app.testing = True
return main.app.test_client()
def test_get(app):
r = app.get('/')
assert r.status_code =... |
microcode = '''
def macroop SAL_R_I
{
slli reg, reg, imm, flags=(CF,OF,SF,ZF,PF)
};
def macroop SAL_M_I
{
ldst t1, seg, sib, disp
slli t1, t1, imm, flags=(CF,OF,SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAL_P_I
{
rdip t7
ldst t1, seg, riprel, disp
slli t1, t1, imm, flags=(CF,OF,SF,ZF,... |
import unittest2 as unittest
from webkitpy.common.host_mock import MockHost
from .committervalidator import CommitterValidator
class CommitterValidatorTest(unittest.TestCase):
def test_flag_permission_rejection_message(self):
validator = CommitterValidator(MockHost())
self.assertEqual(validator._... |
"""Implementation of scheduling for Groc format schedules.
A Groc schedule looks like '1st,2nd monday 9:00', or 'every 20 mins'. This
module takes a parsed schedule (produced by Antlr) and creates objects that
can produce times that match this schedule.
A parsed schedule is one of two types - an Interval or a Specifi... |
"""
Physical units and dimensions.
The base class is Unit, where all here defined units (~200) inherit from.
"""
from sympy import Rational, pi
from sympy.core import AtomicExpr
class Unit(AtomicExpr):
"""
Base class for all physical units.
Create own units like:
m = Unit("meter", "m")
"""
i... |
from google.net.proto import ProtocolBuffer
import array
import dummy_thread as thread
__pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
unusednames=printElemNumber,debug_strs no-special"""
from google.appengine.api.api_base_pb import *
import google.appengine.api.api_base_pb
class MailServ... |
"""Helper to create SSL contexts."""
from os import environ
import ssl
import certifi
def client_context() -> ssl.SSLContext:
"""Return an SSL context for making requests."""
# Reuse environment variable definition from requests, since it's already a requirement
# If the environment variable has no valu... |
import sys
import time
sys.path.append(".")
from IPython import embed
import opcua
class SubHandler(opcua.SubscriptionHandler):
def __init__(self, *args):
opcua.SubscriptionHandler.__init__(self, *args)
self.val = MessageSecurityMode::None
def data_change(self, handle, node, val, attr):
... |
import argparse
import codecs # for codecs.open(..., 'utf-8')
import glob
import json # for json.load()
import os # for os.path()
import subprocess # for subprocess.check_call()
from common import InputError
from common import read_json_file
# Store parsed command-line arguments in global variab... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
HAS_PYVMOMI = False
try:
import pyVmomi
from pyVmomi import vim
H... |
class EventListener:
def __init__(self, events=[]):
self._events=events
def append(self, event):
self._events.append(event)
def fire(self, e):
for _event in self._events:
_event(e)
class IndexedDB:
def __init__(self):
if not __BRYTHON__.has_indexedDB:
... |
import collections
import types
# The goal of this class is to store a set of unique items in the order in
# which they are inserted. This is important for the final makefile, where
# we want to make sure the image decoders are in a particular order. See
# images.gyp for more information.
class OrderedSet(object):
"... |
#!/usr/bin/env python
# Script: dump2pdb.py
# Purpose: convert a LAMMPS dump file to PDB format
# Syntax: dump2pdb.py dumpfile Nid Ntype Nx Ny Nz pdbfile template
# dumpfile = LAMMPS dump file in native LAMMPS format
# Nid,Ntype,Nx,Ny,Nz = columns #s for ID,type,x,y,z
# ... |
from django.db import migrations, models
import multiselectfield.db.fields
from memoize import delete_memoized
from defivelo.roles import user_cantons
def ws_to_vs(apps, schema_editor):
UserManagedState = apps.get_model("user", "UserManagedState")
for ums in UserManagedState.objects.filter(canton="WS"):
... |
from __future__ import unicode_literals
from selenium.common.exceptions import NoSuchElementException
from .helpers import SeleniumTestCase
class IgnoredMetatagTest(SeleniumTestCase):
def test_ignored_metatag_pjaxr(self):
self.browser_get_reverse('index')
self.assert_title('index-title')
... |
"""Wrappers for gsutil, for basic interaction with Google Cloud Storage."""
import contextlib
import cStringIO
import hashlib
import logging
import os
import subprocess
import sys
import tarfile
import urllib2
from telemetry.core import platform
from telemetry.util import path
PUBLIC_BUCKET = 'chromium-telemetry'
P... |
import os
from debtcollector import removals
from migrate import exceptions as versioning_exceptions
from migrate.versioning import api as versioning_api
from migrate.versioning.repository import Repository
import sqlalchemy
from oslo_db._i18n import _
from oslo_db import exception
_removed_msg = (
'sqlalchemy-... |
"""CPU, Memory, and FPS performance test for <video>.
Calculates decoded fps, dropped fps, CPU, and memory statistics while playing
HTML5 media element. The test compares results of playing a media file on
different video resolutions.
"""
import logging
import os
import psutil
import pyauto_media
import pyauto
impor... |
""" Python Character Mapping Codec for PalmOS 3.5.
Written by Sjoerd Mullender (<EMAIL>); based on iso8859_15.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,erro... |
# Test the Unicode versions of normal file functions
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
import sys, os, unittest
from test import test_support
if not os.path.supports_unicode_filenames:
raise test_support.TestSkipped, "test works only on NT+"
filenames = [
... |
from unittest import TestCase
from unittest.mock import MagicMock
from project_checker.checker.project import StudentProject
class ReportTest(TestCase):
def test_result_ranking_of_two_labs(self):
r1 = MagicMock(report={'lab1_ex1': 0, 'lab1_ex2': 2, 'lab1_ex3': 0},
__getitem__=lambd... |
{'name': 'Portal Partner Merge',
'version': '1.0',
'category': 'Hidden',
'description': """
Link module for base_partner_merge which extract portal dependency
""",
'author': "Camptocamp,Odoo Community Association (OCA)",
'maintainer': 'Camptocamp',
'website': 'http://www.camptocamp.com/',
'depends': ['portal', ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'DOChannelTemplate.ui'
#
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf... |
from __future__ import absolute_import, unicode_literals
from django.contrib.admindocs import views
from django.db import models
from django.db.models import fields
from django.utils import unittest
from django.utils.translation import ugettext as _
class CustomField(models.Field):
description = "A custom field ... |
# These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
from django.conf import settings
from django.utils.encoding import force_text
from django.ut... |
"""
Monkey patching of distutils.
"""
import sys
import distutils.filelist
import platform
import types
import functools
from importlib import import_module
import inspect
from setuptools.extern import six
import setuptools
__all__ = []
"""
Everything is private. Contact the project team
if you think you need this ... |
import os
import re
from lxml import etree
from nova.openstack.common.gettextutils import _
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova import test
from nova.tests.integrated import integrated_helpers
class NoMatch(test.TestingException):
pass
class ApiS... |
# -*- coding: utf-8 -*-
"""Subclass of PyModulePane, which is generated by wxFormBuilder."""
#import wx
import wx.stc
from beatle import tran, localpath
from beatle.ctx import THE_CONTEXT as context
from beatle.app.ui import pane, dlg
from beatle.lib.handlers import Identifiers
from beatle.activity.models.ui import ... |
# -*- coding: utf-8 -*-
import array
import os
# import pycurl
import random
import re
from base64 import standard_b64decode
from Crypto.Cipher import AES
from Crypto.Util import Counter
from module.common.json_layer import json_loads, json_dumps
from module.plugins.internal.Hoster import Hoster
from module.utils i... |
"""Test NascentUpload functionality."""
__metaclass__ = type
from testtools import TestCase
from testtools.matchers import MatchesStructure
from lp.archiveuploader.changesfile import determine_file_class_and_name
from lp.archiveuploader.nascentupload import (
EarlyReturnUploadError,
NascentUpload,
)
from... |
from __future__ import unicode_literals
from django.contrib.admin.utils import quote
from django.core.urlresolvers import reverse
from django.template.response import TemplateResponse
from django.test import TestCase, override_settings
from .models import Action, Person, Car
@override_settings(PASSWORD_HASHERS=('dj... |
"""Compute global interface information for individual IDL files.
Auxiliary module for compute_interfaces_info_overall, which consolidates
this individual information, computing info that spans multiple files
(dependencies and ancestry).
This distinction is so that individual interface info can be computed
separately... |
#!/usr/bin/env python
#
# Setup script for the elementtree library
# $Id: setup.py 2326 2005-03-17 07:45:21Z fredrik $
#
# Usage: python setup.py install
#
from distutils.core import setup
try:
# add download_url syntax to distutils
from distutils.dist import DistributionMetadata
DistributionMetadata.clas... |
from openerp import SUPERUSER_ID
from openerp.tools import html2plaintext
from openerp.tools.translate import _
from openerp.osv import osv, fields, expression
class MailMessage(osv.Model):
_inherit = 'mail.message'
def _get_description_short(self, cr, uid, ids, name, arg, context=None):
res = dict.fr... |
import sys, os, arcgisscripting, subprocess
def check_output(command,console):
if console == True:
process = subprocess.Popen(command)
else:
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
output,error = process.comm... |
import mock
from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
from neutron.plugins.ml2 import config as ml2_config
from neutron.plugins.ml2.drivers.brocade import (mechanism_brocade
as brocademechanism)
from neutron.tes... |
"""Tests to ensure that the lxml tree builder generates good trees."""
import re
import warnings
try:
import lxml.etree
LXML_PRESENT = True
LXML_VERSION = lxml.etree.LXML_VERSION
except ImportError as e:
LXML_PRESENT = False
LXML_VERSION = (0,)
if LXML_PRESENT:
from bs4.builder import LXMLTre... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.eager import backprop
from tensorflow.python.eager import context
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import test_util
from... |
'''
Created on Apr 16, 2015
@author: christian
'''
from optparse import OptionParser
import numpy
import os
from os import listdir
from os.path import isfile, join
import cPickle
import glob
def unpickle(file):
fo = open(file, 'rb')
dictionary = cPickle.load(fo)
fo.close()
return dictionary
if __na... |
"""Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath
from .base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-deb... |
import sys
import random
def get_row_type():
num = random.randint(1,5)
if num in range(1,4):
return "tr"
elif num is 4:
return "va"
elif num is 5:
return "te"
else:
print "get_row_type() returned ", num
sys.exit()
def main():
if len(sys.argv) != 3:
print "Usage: ./movie_... |
"""
============================================================
Parameter estimation using grid search with cross-validation
============================================================
This examples shows how a classifier is optimized by cross-validation,
which is done using the :class:`sklearn.model_selection.GridS... |
import urllib
try:
import json
except ImportError:
import simplejson as json
import os
import sys
from optparse import OptionParser
from six import iteritems
from ansible.module_utils.urls import open_url
class ProxmoxNodeList(list):
def get_names(self):
return [node['node'] for node in self]
cl... |
# _*_ coding:utf-8 _*_
import random
import pygame
__author__ = 'Administrator'
class Plane():
def __init__(self, width, height, value, image, type):
self.width = width
self.height = height
self.value = value
self.image = image
self.type = type
self.rect = pygame.R... |
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.ios.ios import get_config, load_config
from ansible.module_utils.network.ios.ios im... |
import os
import eventlet
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
from nova import exception
from nova.i18n import _LE, _LW
from nova.servicegroup.drivers import base
evzookeeper = importutils.try_import('evzookeeper')
membership = importutils.try_import('ev... |
"""
Script to print potentially missing source dependencies based on the actual
.h and .cc files in the source tree and which files are included in the gyp
and gn files. The latter inclusion is overapproximated.
TODO(machenbach): If two source files with the same name exist, but only one
is referenced from a gyp/gn fi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: https://github.com/golismero
Golismero project mail: <EMAIL>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Publi... |
import StringIO
import unittest2 as unittest
from webkitpy.common.system.outputtee import Tee, OutputTee
class SimpleTeeTest(unittest.TestCase):
def test_simple_tee(self):
file1, file2 = StringIO.StringIO(), StringIO.StringIO()
tee = Tee(file1, file2)
tee.write("foo bar\n")
tee.wr... |
import json
from oslo_log import log as logging
from tempest import config
from tempest import exceptions
from tempest.scenario import manager
from tempest.scenario import utils as test_utils
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
load_tests = test_utils.load_tests_input_scen... |
import sys
import os
import shutil
me_filename = 'mediaelement'
mep_filename = 'mediaelementplayer'
combined_filename = 'mediaelement-and-player'
# BUILD MediaElement (single file)
print('building MediaElement.js')
me_files = []
me_files.append('me-header.js')
me_files.append('me-namespace.js')
me_file... |
from __future__ import unicode_literals
from django.core import mail
from django.core.management import call_command
from django.test import SimpleTestCase, override_settings
@override_settings(
ADMINS=(('Admin', '<EMAIL>'), ('Admin and Manager', '<EMAIL>')),
MANAGERS=(('Manager', '<EMAIL>'), ('Admin and Man... |
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
for_comm = None
if len(sys.argv) > 2:
sys.exit(usage)
if ... |
import flask
from ..models import Repository
webhooks = flask.Blueprint('webhooks', __name__, url_prefix='/webhook/github')
@webhooks.route('', methods=['POST'])
def gh_webhook():
"""Point for GitHub webhook msgs (POST handler)"""
db = flask.current_app.container.get('db')
ext_master = flask.current_app... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.db import transaction, IntegrityError
from django.test import TestCase, skipIfDBFeature
from .models import Employee, Business, Bar, Foo
class CustomPKTests(TestCase):
def test_custom_pk(self):
dan = Employee.objects.create(
... |
"""Tests for gjslint --nostrict.
Tests errors that can be thrown by gjslint when not in strict mode.
"""
import os
import sys
import unittest
import gflags as flags
import unittest as googletest
from closure_linter import checker
from closure_linter import errors
from closure_linter.common import filetestcase
_R... |
from Converter import Converter
from time import localtime, strftime
from Components.Element import cached
class ClockToText(Converter, object):
DEFAULT = 0
WITH_SECONDS = 1
IN_MINUTES = 2
DATE = 3
FORMAT = 4
AS_LENGTH = 5
TIMESTAMP = 6
FULL = 7
SHORT_DATE = 8
LONG_DATE = 9
VFD = 10
AS_LENGTHHOURS = 11
AS... |
# -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2015 lambda
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 License, or
(at your option) any ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.