content stringlengths 4 20k |
|---|
"""Class representing image/* type MIME documents."""
__all__ = ['MIMEImage']
import imghdr
from email import encoders
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
"""Class for generating image/* type MIME documents."""
def __init__(self, _imagedata, _subtype=N... |
import os
import sys
import unittest
import utils_tests
import trappy
from trappy.base import trace_parser_explode_array
sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
class TestBaseMethods(unittest.TestCase):
"""Test simple methods that don't need to set up a directory"""
def test... |
import os
from pathlib import Path
import gi
import logging
from gi.repository import Gtk
import json_config
from .login_window import LoginWindow
TOP_DIR = os.path.dirname(os.path.abspath(__file__))
config = json_config.connect('config.json')
gi.require_version('Gtk', '3.0')
class WatsonCredentialsDialog(Gtk.Dia... |
{
'name': 'French RIB Bank Details',
'version': '1.0',
'category': 'Hidden/Dependency',
'description': """
This module lets users enter the banking details of Partners in the RIB format (French standard for bank accounts details).
=========================================================================... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import pbm.plugins
import pbm.utils
class ChromeFolderPlugin(pbm.plugins.PromiumPlugin):
folder_name = 'chrome'
urls = [
"chrome://bookmarks",
"chrome://history",
"chrome://extensions",
"chrome:... |
import nest
import nest.raster_plot
import pylab
import numpy
# Network parameters. These are given in Brunel (2000) J.Comp.Neuro.
g = 5.0 # Ratio of IPSP to EPSP amplitude: J_I/J_E
eta = 2.0 # rate of external population in multiples of threshold rate
delay = 1.5 # synaptic delay in ms
tau_m = 20.0 # Membrane tim... |
import os
class Zfs(object):
def __init__(self, module, name, properties):
self.module = module
self.name = name
self.properties = properties
self.changed = False
self.immutable_properties = [ 'casesensitivity', 'normalization', 'utf8only' ]
def exists(self):
c... |
import os
from nupic.frameworks.opf.expdescriptionhelpers import importBaseDescription
# the sub-experiment configuration
config = \
{
'dataSource': 'file://' + os.path.join(os.path.dirname(__file__),
'../datasets/first_order_0.csv'),
'modelParams': { 'clParams': { 'clVer... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('grades',... |
"""
============================================================
Single estimator versus bagging: bias-variance decomposition
============================================================
This example illustrates and compares the bias-variance decomposition of the
expected mean squared error of a single estimator again... |
"""
Sphinx plugins for Django documentation.
"""
import json
import os
import re
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx import addnodes, __version__ as sphinx_ver
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.writers.html import SmartyPantsHTMLTranslato... |
import os
import os.path
import subprocess
import sys
# Flags from YCM's default config.
flags = [
'-DUSE_CLANG_COMPLETER',
'-std=gnu++11',
'-x',
'c++',
]
def PathExists(*args):
return os.path.exists(os.path.join(*args))
def FindV8SrcFromFilename(filename):
"""Searches for the root of the V8 checkout.
Simp... |
app_name = 'BitTorrent'
version = '4.4.0'
URL = 'http://www.bittorrent.com/'
DONATE_URL = URL + 'donate.html'
FAQ_URL = URL + 'FAQ.html'
HELP_URL = URL + 'documentation.html'
SEARCH_URL = 'http://search.bittorrent.com/search.jsp?client=%(client)s&query=%(query)s'
import sys
assert sys.version_info >= (2, 2, 1), _("Py... |
import json
import unittest
from mock import Mock, MagicMock, patch, call
import low_level
import brickowl
class TestBrickOwl(unittest.TestCase):
@patch('rebrickable.Rebrickable')
@patch('low_level.do_http_get')
def test_fetch_order(self, do_http_get_mock, RebrickableMock):
# Setup
json =... |
# App.py
# Application stuff.
# The application is responsible for managing the main frame window.
#
# We also grab the FileOpen command, to invoke our Python editor
" The PythonWin application code. Manages most aspects of MDI, etc "
import win32con
import win32api
import win32ui
import sys
import string
im... |
"""Tests for common shapes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import common_shapes
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import test_util
from tensorflow.python... |
from __future__ import absolute_import, print_function
import os
import sys
import six
import sd2
from .file_rewriter import FileRewriter
g_ssh_config_path = os.getenv('SD2_SSH_CONFIG',
os.path.join(os.getenv('HOME'), '.ssh', 'config'))
container_entry_template = '''
host {cont[name]}
HostName {cont[ip]}
... |
'''
To compare patterns:
use a % change calculation to calculate similarity between each %change
movement in the pattern finder. From those numbers, subtract them from 100, to
get a "how similar" #. From this point, take all 10 of the how similars,
and average them. Whichever pattern is MOST similar, is the one we wi... |
"""Tests for tensorflow.contrib.rnn.python.ops.fused_rnn_cell."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.rnn.python.ops import fused_rnn_cell
from tensorflow.python.framework import constant_op
from tenso... |
# -*- coding: utf-8 -*-
import sqlite3
import re
import sys
reload(sys)
sys.setdefaultencoding('utf8')
data = "download/watchOS.docset/Contents/Resources/docSet.dsidx"
url = "https://developer.apple.com/library/content/"
def generate_output(result):
abstract_format = '{name}\tA\t\t\t\t\t\t\t\t\t\t<section class... |
"""
.. _ex-vector-mne-solution:
============================================
Plotting the full vector-valued MNE solution
============================================
The source space that is used for the inverse computation defines a set of
dipoles, distributed across the cortex. When visualizing a source estimate,... |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
"""
Runtime environments which are prepared for subusers to run in.
"""
#external imports
import sys
import collections
import os
import time
import binascii
import struct
import subprocess
impor... |
#!/usr/bin/env python
#
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
#
import sys
from xml.dom import minidom
from xml.dom import Node
#
# User methods
#
# Calls to the methods in these classes are generated by generateDS.py.
# You can replace these methods by re-implementing the following class
# in a... |
_parser_to_groups_dict = dict()
class _parser_groups(object):
def __init__(self, parser):
self.usrpx_grp = parser.add_option_group("General USRP Options")
self.usrp1_grp = parser.add_option_group("USRP1 Specific Options")
self.usrp1exp_grp = parser.add_option_group("USRP1 Expert Options")
... |
from openerp import models, api, _
from openerp.exceptions import UserError
import logging
_logger = logging.getLogger(__name__)
class ResCurrency(models.Model):
_inherit = "res.currency"
@api.multi
def action_get_pyafipws_currencies(self):
return self.get_pyafipws_currencies()
@api.model
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils._text import to_native, to_text
from ansible.module_utils.basic import env_fallback
from mimetypes import MimeTypes
import json
import os
try:
import pika
from pika import spec
HAS_PIKA = True
... |
"""
Tests course_creators.views.py.
"""
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.test import TestCase, RequestFactory
from course_creators.views import add_user_with_status_unrequested, add_user_with_status_granted
from course_creators.views import ge... |
# -*- coding: utf-8 -*-
import sys
import re
if __name__ == '__main__':
if len(sys.argv) < 4:
print("Usage: python bond_html.py hoge.html -o hoge_out.html")
sys.exit()
target_file = open(sys.argv[1], 'r', encoding='utf-8')
target_txt = target_file.read()
target_file.close(... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Li... |
import re
import os
import sys
import select
import platform
import unittest
from functools import wraps
from .testconfig import dsn, repl_dsn
if hasattr(unittest, 'skipIf'):
skip = unittest.skip
skipIf = unittest.skipIf
else:
import warnings
def skipIf(cond, msg):
def skipIf_(f):
... |
import logging
import requests
import hashlib
import hmac
from allauth.socialaccount.models import (SocialLogin,
SocialToken)
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.helpers import render_authentication_error
from allauth.soc... |
# coding=utf-8
import os, sys, codecs
import shutil
import common
import config
import bucfg
# import checkbuild
# import run_100_log
#########################################
# 处理校园介绍中的视频集
def process():
print '-------------------------------'
print common.encodeChinese('>> 处理视频集')
print ''
# 前面已经检查过文件存在了,这里就... |
import unittest
from mantid.simpleapi import mtd
from testhelpers import run_algorithm
from mantid.api import WorkspaceGroup, MatrixWorkspace
from mantid import config
class IndirectILLReductionFWS(unittest.TestCase):
# cache the def instrument and data search dirs
_def_fac = config['default.facility']
_... |
import urllib2
try:
import json
except ImportError:
import simplejson as json
import hashlib
from proxies import TrackProxy
import util
import time
# Seconds to wait for asynchronous track/upload or track/analyze jobs to complete.
DEFAULT_ASYNC_TIMEOUT = 60
class Track(TrackProxy):
"""
Represents an ... |
# coding:utf-8
import time
import redis
import settings
from crawler.http import Request
from crawler.exceptions import TrafficLimit, Empty
class TrafficQueue(object):
def __init__(self, num, ctime=60):
self.num = num
self.ctime = ctime
self.tq = []
def t_in(self, req):
sel... |
import re
from calendar import monthrange
def is_valid_date(d):
if not re.match('^\d+$', d):
raise ValueError('Not a valid date')
dd, mm, yyyy = [int(i) for i in [d[:2], d[2:4], d[4:]]]
if yyyy < 1855 or yyyy > 2039:
return False
if mm < 1 or mm > 12:
return False
if dd < 1 or dd > monthrange(yyyy, m... |
"""
Tests common to tuple, list and UserList.UserList
"""
import unittest
import sys
# Various iterables
# This is used for checking the constructor (here and in test_deque.py)
def iterfunc(seqn):
'Regular generator'
for i in seqn:
yield i
class Sequence:
'Sequence using __getitem__'
def __in... |
"""
Many-to-many relationships
To define a many-to-many relationship, use ``ManyToManyField()``.
In this example, an ``Article`` can be published in multiple ``Publication``
objects, and a ``Publication`` has multiple ``Article`` objects.
"""
from __future__ import unicode_literals
from django.db import models
from ... |
#encoding: utf-8
from pymongo import MongoClient
from bson import ObjectId
import argparse
from pprint import pprint
import time
import threading
from datetime import datetime, timedelta
from tweet import Tweet
class Product(object):
def __init__(self, id, mongoproduct):
self.id = id
self.o = ... |
# -*- coding: utf-8 -*-
import datetime
import uuid
import pytz
from django.test import TestCase
from django.utils import timezone
from freezegun import freeze_time
from silk import models
from silk.storage import ProfilerResultStorage
from silk.config import SilkyConfig
from .factories import RequestMinFactory, SQ... |
"""BigMLer whizzml main processing
Functions to process the whizzml options
"""
import sys
import os
import bigmler.utils as u
from bigmler.whizzml.package import create_package
from bigmler.dispatcher import SESSIONS_LOG, clear_log_files
from bigmler.command import get_context
COMMAND_LOG = ".bigmler_whizz... |
"""
Utility classes for dealing with circular references.
"""
import types
from twisted.python import log, reflect
class NotKnown:
def __init__(self):
self.dependants = []
self.resolved = 0
def addDependant(self, mutableObject, key):
assert not self.resolved
self.dependants.... |
#!/usr/bin/env python
from tools.load import LoadMatrix
lm=LoadMatrix()
data=lm.load_numbers('../data/fm_train_real.dat')
label=lm.load_numbers('../data/label_train_twoclass.dat')
parameter_list=[[data,label]]
def features_io_modular (fm_train_real, label_train_twoclass):
import numpy
from modshogun import SparseRe... |
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
iwq_map = get_item_warehouse_quantity_map()
item_map = get_item_details()
data = []
for sbom, warehouse in iwq_map.items():
total = 0
total_qt... |
"""
Tests for the pytest paver commands themselves.
Run just this test with: paver test_lib -t pavelib/paver_tests/test_paver_pytest_cmds.py
"""
import unittest
import os
import ddt
from pavelib.utils.test.suites import SystemTestSuite, LibTestSuite
from pavelib.utils.envs import Env
XDIST_TESTING_IP_ADDRESS_LIST = ... |
"""
DateBase class for Gramps.
"""
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from .date import Date
#-------------------------------------------------------------------------
#
# DateBase c... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
import traceback
try:
from libcloud.compute.types import Provider
from lib... |
import logging
import sys
import time
from eventlet import event
from eventlet import greenthread
from keystone.openstack.common._i18n import _LE, _LW
LOG = logging.getLogger(__name__)
# NOTE(zyluo): This lambda function was declared to avoid mocking collisions
# with time.time() called in the standard... |
from django.conf import settings
from django.core.management import BaseCommand
from django.core.exceptions import ImproperlyConfigured
from facebook import Facebook
from facebookconnect.models import FacebookTemplate
class Command(BaseCommand):
def handle(self,*args,**options):
"""Load the templates into ... |
from kafkatest.tests.kafka_test import KafkaTest
from kafkatest.services.connect import ConnectStandaloneService
from kafkatest.services.console_consumer import ConsoleConsumer
from ducktape.utils.util import wait_until
from ducktape.mark import parametrize
import hashlib, subprocess, json
class ConnectStandaloneFileT... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'committer',
'version': '1.0'}
try:
import boto3
from botocore.exceptions import ClientError, NoCredentialsError
HAS_BOTO3 = True
except ImportError:
HAS_BOTO3 = False
# VPC-supported IANA protoc... |
import mimetypes
import os
import random
import time
from email import Charset, Encoders
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.Header import Header
from email.Utils import formatdate, getaddresses, formataddr
from django.conf im... |
# -*- coding: utf-8 -*-
import KBEngine
import random
import wtimer
import d_spaces
import d_avatar_inittab
from KBEDebug import *
from interfaces.GameObject import GameObject
from interfaces.Teleport import Teleport
class Avatar(KBEngine.Proxy,
GameObject,
Teleport):
def __init__(self):
KBEngin... |
from zope.component import adapter
from zope.interface import implementer
from storm.zope.interfaces import IResultSet, ISQLObjectResultSet
@adapter(ISQLObjectResultSet)
@implementer(IResultSet)
def sqlobject_result_set_to_storm_result_set(so_result_set):
return so_result_set._result_set |
from easyPoS.models import Tva, Categorie, Produit, MoyenPaiement, Facture, Paiement, LigneFacture, DonneesEntreprise, \
Arrhe, Famille, RemiseCheque, PreparationFacture, LogFacture
from django.contrib import admin
from chambres.models import Client
class ResaInline(admin.StackedInline):
model = Client... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.jvm.targets.java_agent import JavaAgent
from pants.base.exceptions import TargetDefinitionException
from pants.build_graph.build_file_aliases import... |
"""manage component descriptors"""
# -*- python -*-
import random
from sets import Set
from pprint import pformat
from hodlib.Common.util import local_fqdn
from hodlib.Common.tcp import tcpSocket, tcpError
class Schema:
"""the primary class for describing
schema's """
STRING, LIST, MAP = range(3)
def __init... |
# -*- coding: utf-8 -*-
from nose.tools import * # flake8: noqa
import httpretty
import mock
from tests.base import OsfTestCase
from tests.factories import AuthUserFactory, ProjectFactory
import urlparse
from framework.auth.core import Auth
from website.addons.zotero.tests.factories import (
ZoteroAccountFact... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual(__, result)
def test_if_then_statem... |
from neutron.api.v2 import attributes
MAC_LEARNING = 'mac_learning_enabled'
EXTENDED_ATTRIBUTES_2_0 = {
'ports': {
MAC_LEARNING: {'allow_post': True, 'allow_put': True,
'convert_to': attributes.convert_to_boolean,
'default': attributes.ATTR_NOT_SPECIFIED,
... |
import unittest2 as unittest
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.thirdparty.mock import Mock
from webkitpy.tool.mocktool import MockOptions, MockTool
from webkitpy.tool.steps.validatechangelogs import ValidateChangeLogs
class ValidateChangeLogsTest(unittest.TestCase):
de... |
from ctypes import *
import unittest
class StringBufferTestCase(unittest.TestCase):
def test_buffer(self):
b = create_string_buffer(32)
self.assertEqual(len(b), 32)
self.assertEqual(sizeof(b), 32 * sizeof(c_char))
self.assertTrue(type(b[0]) is str)
b = create_string_buffer... |
"""DNS rdatasets (an rdataset is a set of rdatas of a given type and class)"""
import random
import StringIO
import struct
import dns.exception
import dns.rdatatype
import dns.rdataclass
import dns.rdata
import dns.set
# define SimpleSet here for backwards compatibility
SimpleSet = dns.set.Set
class DifferingCovers... |
from pylab import *
from scipy.ndimage import filters,morphology,measurements
import morph
from toplevel import *
@checks(AFLOAT2,alpha=RANGE(0.0,20.0),r=RANGE(0,20))
def dpcuts(image,alpha=0.5,r=2):
"""Compute dynamic programming cuts through an image.
The image contains the costs themselves, `alpha` is the
... |
"""Unit tests for loop."""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import print_function
import contextlib
import sys
import mock
from chromite.lib import cros_test_lib
from chromite.scripts.sysmon import loop
assert sys.version_info >= (3, 6), 'This module requi... |
# Python integration with Mountain Lion's notification center
import Foundation, objc
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
NSObject = objc.lookUpClass('NSObject')
class NotificationDelegator(NSObject):
def __init__(s... |
"""Utilities for creating SavedModels."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import time
import six
from tensorflow.python.platform import gfile
from tensorflow.python.platform import tf_logging as logging
from te... |
import cgi
import urlparse
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
# Handler for receiving POST-requests and saving them to disk
# NOT fail-safe at all!
class MyHandler(BaseHTTPRequestHandler):
def do_POST(self):
ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))... |
from openerp import models, fields, api
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
@api.depends('tax_line')
def _compute_sii_enabled(self):
for invoice in self:
if invoice.fiscal_position.name == u'Importación con DUA' and \
not... |
########################################################################
# $HeadURL: svn+ssh://svn.cern.ch/reps/dirac/DIRAC/trunk/DIRAC/WorkloadManagementSystem/Client/IgnoreMissingInputData.py $
# File : IgnoreMissingInputData.py
########################################################################
""" Remove fr... |
from vtk import *
import os.path
def setup_view(link, file, domain1, domain2, hue_range):
reader = vtkDelimitedTextReader()
reader.SetHaveHeaders(True)
reader.SetFileName(file)
ttg = vtkTableToGraph()
ttg.SetInputConnection(0, reader.GetOutputPort())
ttg.AddLinkVertex(domain1, domain1, False)
ttg.AddLin... |
import datetime
import ftplib
import os.path
from airflow.hooks.base_hook import BaseHook
from past.builtins import basestring
from airflow.utils.log.logging_mixin import LoggingMixin
def mlsd(conn, path="", facts=None):
"""
BACKPORT FROM PYTHON3 FTPLIB.
List a directory in a standardized format by usin... |
"""
Dutch-language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
'attentie': 'attention',
'let-op': 'caution',
'code (translation required)': 'code',
'gevaar': 'danger',
'fout': 'erro... |
"""distutils.emxccompiler
Provides the EMXCCompiler class, a subclass of UnixCCompiler that
handles the EMX port of the GNU C compiler to OS/2.
"""
# issues:
#
# * OS/2 insists that DLLs can have names no longer than 8 characters
# We put export_symbols in a def-file, as though the DLL can have
# an arb... |
"""
:module: watchdog.observers
:synopsis: Observer that picks a native implementation if available.
:author: <EMAIL> (Yesudeep Mangalapilly)
Classes
=======
.. autoclass:: Observer
:members:
:show-inheritance:
:inherited-members:
Observer thread that schedules watching directories and dispatches
calls t... |
import gc
import io
import os
import sys
import signal
import weakref
import unittest
@unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
@unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
@unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
"if threa... |
"""Functions."""
from framer import template
from framer.util import cstring, unindent
METH_O = "METH_O"
METH_NOARGS = "METH_NOARGS"
METH_VARARGS = "METH_VARARGS"
def parsefmt(fmt):
for c in fmt:
if c == '|':
continue
yield c
class Argument:
def __init__(self, name):
sel... |
from test.test_support import verify, vereq, TESTFN
import mmap
import os, re
PAGESIZE = mmap.PAGESIZE
def test_both():
"Test mmap module on Unix systems and Windows"
# Create a file to be mmap'ed.
if os.path.exists(TESTFN):
os.unlink(TESTFN)
f = open(TESTFN, 'w+')
try: # unlink TESTF... |
#!/usr/bin/python
# encoding: utf-8
'''
matlabGitBisect -- a git bisect run script for Matlab projects
@author: Twan Koolen
'''
import sys
import signal
import os
import subprocess
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
__all__ = []
__version__ = 0.1
__date__ = '201... |
def authopenid(request):
"""
Returns context variables required by apps that use django-authopenid.
"""
if hasattr(request, 'openid'):
openid = request.openid
else:
openid = None
if hasattr(request, 'openids'):
openids = request.openids
else:
openids ... |
"""
This is an example implementation of ALS for learning how to use Spark. Please refer to
pyspark.ml.recommendation.ALS for more conventional use.
This example requires numpy (http://www.numpy.org/)
"""
from __future__ import print_function
import sys
import numpy as np
from numpy.random import rand
from numpy imp... |
from ansible.module_utils.basic import *
from ansible.module_utils.azure_rm_common import *
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureMissingResourceHttpError, AzureHttpError
except:
# This is handled in azure_rm_common
pass
AZURE_OBJECT_CLASS = 'NetworkSe... |
import multiprocessing
import sys
import os
import platform
script_dir = None
def script_path(*args):
global script_dir
if not script_dir:
script_dir = os.path.join(os.path.dirname(__file__), '..', 'Scripts')
return os.path.join(*(script_dir,) + args)
def top_level_path(*args):
return os.p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Manager for network connections.
"""
__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 i... |
import time
import sys
import shlex
import traceback
import getpass
import re
import prettytable
from beeswaxd import BeeswaxService
from beeswaxd.BeeswaxService import QueryState
from datetime import datetime
try:
# If Exec Summary is not implemented in Impala, this cannot be imported
from ExecStats.ttypes import... |
from os.path import join as pjoin, splitext, basename as pbasename
from interface_gen import generate_interface
def do_generate_interface(target, source, env):
"""Generate a .pyf file from another pyf file (!)."""
# XXX: do this correctly
target_name = str(target[0])
source_name = str(source[0])
... |
from django.core.exceptions import FieldError
from django.test import SimpleTestCase, TestCase
from .models import (
AdvancedUserStat, Child1, Child2, Child3, Child4, Image, LinkedList,
Parent1, Parent2, Product, StatDetails, User, UserProfile, UserStat,
UserStatResult,
)
class ReverseSelectRelatedTestCa... |
"""Tests for samba.kcc.ldif_import_export"""
import samba
import os
import time
import shutil
import sys
import subprocess
import samba.tests
from samba.kcc import ldif_import_export, KCC
from samba import ldb
from samba.dcerpc import misc
from samba.param import LoadParm
from samba.credentials import Credentials
f... |
#!/home/cipher/pa-dude/bin/python
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl Made optimize an option (PNG, JPEG)
# 0.... |
"""TPU Distribution Strategy.
This is experimental. It's not ready for general use.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distribute.python import cross_tower_ops as cross_tower_ops_lib
from tensorflow.contrib.distrib... |
from __future__ import absolute_import
import logging
import numbers
import os
import sys
from logging.handlers import WatchedFileHandler
from .five import string_t
from .utils import cached_property
from .utils.encoding import safe_repr, safe_str
from .utils.functional import maybe_evaluate
__all__ = ['LogMixin', ... |
"""Self-test for public-key crypto"""
__revision__ = "$Id$"
import os
def get_tests(config={}):
tests = []
from Crypto.SelfTest.PublicKey import test_DSA; tests += test_DSA.get_tests(config=config)
from Crypto.SelfTest.PublicKey import test_RSA; tests += test_RSA.get_tests(config=config)
... |
"""Models for the util app. """
import cStringIO
import gzip
import logging
from django.db import models
from django.db.models.signals import post_init
from django.utils.text import compress_string
from config_models.models import ConfigurationModel
logger = logging.getLogger(__name__) # pylint: disable=invalid-na... |
from openerp import models, fields, api
from openerp.tools.translate import _
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.one
@api.depends('order_type')
def _get_line_route_id(self):
"""Compute default order line route id"""
route_id = False
if self.order_type ... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.rtf
~~~~~~~~~~~~~~~~~~~~~~~
A formatter that generates RTF files.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.util import get_i... |
import os
from llnl.util.lang import memoized
import spack.spec
from spack.build_environment import dso_suffix
from spack.spec import CompilerSpec
from spack.util.executable import Executable, ProcessError
from spack.compilers.clang import Clang
class ABI(object):
"""This class provides methods to test ABI comp... |
import httplib
import httplib2
import random
import sys
import time
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from googleapiclient.http import MediaFileUpload
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.t... |
__all__ = ['Parser']
import zlib
import logging
import StringIO
import struct
from exceptions import ParseError
import core
# get logging object
log = logging.getLogger(__name__)
# http://developer.apple.com/documentation/QuickTime/QTFF/index.html
# http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap4/... |
# -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
import factory
import factory.fuzzy
import factory.django
from kitsune.products.models import Product, Topic, Version
from kitsune.sumo.tests import FuzzyUnicode
class ProductFactory(factory.DjangoModelFactory):
class Meta:
model... |
from Screens.Screen import Screen
from Plugins.Plugin import PluginDescriptor
from Components.SystemInfo import SystemInfo
from Components.ConfigList import ConfigListScreen
from Components.config import getConfigListEntry, config, ConfigBoolean, ConfigNothing, ConfigSlider
from Components.Sources.StaticText import Sta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.