content stringlengths 4 20k |
|---|
# coding: utf-8
# flake8: noqa
"""
Flip API
Flip # noqa: E501
The version of the OpenAPI document: 3.1
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
__version__ = "2.1.0"
# import apis into sdk package
from telestream_cloud_flip.api... |
"""WSGI server interface (see PEP 333). This adds some CP-specific bits to
the framework-agnostic wsgiserver package.
"""
import sys
import cherrypy
from cherrypy import wsgiserver
class CPWSGIServer(wsgiserver.CherryPyWSGIServer):
"""Wrapper for wsgiserver.CherryPyWSGIServer.
wsgiserver has been design... |
from ctypes import c_char_p, c_int, c_void_p, POINTER
from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
double_output, int_output, srs_output, string_output, void_output)
## Shortcut generation for routines with known paramet... |
"""Framework with category module"""
import umake.frameworks
class ACategory(umake.frameworks.BaseCategory):
def __init__(self):
super().__init__(name="Category A", description="Category A description, same prog_name")
class FrameworkA(umake.frameworks.BaseFramework):
def __init__(self, category)... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify that default use of the Glob() function within a VariantDir()
finds the local file Nodes.
"""
import TestSCons
test = TestSCons.TestSCons()
test.subdir('src')
test.subdir('src/sub1')
test.write('SConstruct', """\
VariantDir('var1', 'src')
Var... |
from __future__ import unicode_literals
'''
File based locking utility
'''
import os
from time import time
from frappe.utils import get_site_path, touch_file
class LockTimeoutError(Exception):
pass
def create_lock(name):
'''Creates a file in the /locks folder by the given name'''
lock_path = get_lock_path(nam... |
"""Load plugin."""
# Import system libs
import os
# Import Glances libs
from glances.plugins.glances_core import Plugin as CorePlugin
from glances.plugins.glances_plugin import GlancesPlugin
# SNMP OID
# 1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1
# 5 minute Load: .1.3.6.1.4.1.2021.10.1.3.2
# 15 minute Load: .1.3.6.1.... |
import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR)
from django.core.exceptions import ObjectDoesNotExis... |
"""Module to coordinate user intentions."""
import logging
import re
from typing import Any, Callable, Dict, Iterable, Optional
import voluptuous as vol
from homeassistant.const import ATTR_SUPPORTED_FEATURES
from homeassistant.core import callback, State, T
from homeassistant.exceptions import HomeAssistantError
fro... |
"""Execute shell commands via os.popen() and return status, output.
Interface summary:
import commands
outtext = commands.getoutput(cmd)
(exitstatus, outtext) = commands.getstatusoutput(cmd)
outtext = commands.getstatus(file) # returns output of "ls -ld file"
A trailing newline is remov... |
#!/bin/python
# A script for export framework data to unpacked mod file structure
from os import walk, makedirs, sep
from os.path import join, relpath, dirname, exists, normpath, basename
from json import load, dump
from shutil import copy
from json_tools import field_by_path
from re import compile as regex
from codec... |
import unittest, time, sys, random
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_rf
# fyi max FP single precision (hex rep. 7f7f ffff) approx. 3.4028234 * 10**38"
def write_syn_dataset(csvPathname, rowCount, colCount, headerData):
dsf = open(csvPathname, "w+")
... |
import os
from scrapy.utils.request import request_fingerprint
from scrapy.utils.job import job_dir
class BaseDupeFilter(object):
@classmethod
def from_settings(cls, settings):
return cls()
def request_seen(self, request):
return False
def open(self): # can return deferred
... |
from pyparsing import *
data = """Now is the time
for all good men
to come to the aid
of their country."""
# demonstrate use of lineno, line, and col in a parse action
def reportLongWords(st,locn,toks):
word = toks[0]
if len(word) > 3:
print "Found '%s' on line %d at column %d" % (word, lin... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import textwrap
from urllib import unquote
from lxml import etree
from calibre import guess_type
from calibre.utils.magick.draw import ... |
"""Support for ISY994 fans."""
import logging
from typing import Callable
from homeassistant.components.fan import (
DOMAIN,
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SPEED_OFF,
SUPPORT_SET_SPEED,
FanEntity,
)
from homeassistant.helpers.typing import ConfigType
from . import ISY994_NODES, ISY99... |
microcode = '''
# F2XM1
# FSCALE
def macroop FYL2X {
yl2xfp st(1), st(0), st(1), spm=1
};
# FYL2XP1
''' |
"""
35. DB-API Shortcuts
``get_object_or_404()`` is a shortcut function to be used in view functions for
performing a ``get()`` lookup and raising a ``Http404`` exception if a
``DoesNotExist`` exception was raised during the ``get()`` call.
``get_list_or_404()`` is a shortcut function to be used in view functions for... |
from __future__ import absolute_import, unicode_literals
import io
import os
import sys
from collections import defaultdict
from functools import partial
from distutils.errors import DistutilsOptionError, DistutilsFileError
from setuptools.py26compat import import_module
from six import string_types
def read_configu... |
from distutils.core import setup
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
# 2.x
from distutils.command.build_py import build_py
setup(name="beautifulsoup4",
version = "4.3.2",
author="Leonard Richardson",
author_email='<EMAIL>',
url=... |
import os
import sys
import time
import re
from cStringIO import StringIO
from datetime import datetime
from mixins import VerbosityMixin
class Capturing(list):
"""
Captures a subprocess stdout.
:Usage:
>>> with Capturing():
... subprocess(args)
"""
def __enter__(self):
... |
''' Installation script for Pylogeny. '''
# E-mail: <EMAIL>
from setuptools import setup, Extension as extension
import os
# Metadata
from pylogeny.__version__ import VERSION
DESCRIP = 'A code framework for phylogenetic tree reconstruction, rearrangement, scoring, and for the manipulation, heuristic search, and ana... |
#!/usr/bin/env python
"""Wrapper for the GNU compiler that converts / removes incompatible
compiler options and allows for file-specific tailoring."""
import sys
from subprocess import call
# Default compiler and options
compiler = 'gcc'
args2change = {}
fragile_files = ['c/xc/tpss.c']
# Default optimisation setti... |
"""Senlin common internal object model"""
import re
from oslo_utils import versionutils
from oslo_versionedobjects import base
from oslo_versionedobjects import fields as base_fields
from senlin.common.i18n import _
from senlin import objects
VersionedObjectDictCompat = base.VersionedObjectDictCompat
VersionedObject... |
from openerp.osv import fields,osv
class hr_department(osv.Model):
_name = 'hr.department'
_inherit = 'hr.department'
_columns = {
'code': fields.char('Code', size=64),
'sequence': fields.char('Sequence', size=32, help="Gives the sequence order when displaying a list of department... |
import unittest
from biicode.common.model.declare.cpp_declaration import CPPDeclaration
from biicode.common.exception import BiiException
from biicode.common.model.brl.block_cell_name import BlockCellName
class CPPDeclarationTest(unittest.TestCase):
def testBasic(self):
d = CPPDeclaration("sphere.h")
... |
"""
============================================
Reading BEM surfaces from a forward solution
============================================
Plot BEM surfaces used for forward solution generation.
"""
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
... |
import operator
class accumulate:
def __init__(self, iterable, func = operator.add):
self.it = iter(iterable)
self._total = None
self.func = func
def __iter__(self):
return self
def __next__(self):
if not self._total:
self._total = next(self.it)... |
from base import *
DOMAIN = "test199"
DOESNT_EXIST = "This_does_not_exist"
CGI_FILE = "handle_404.cgi"
FORBIDDEN = "This text shouldn't appear"
CONF = """
vserver!199!nick = %s
vserver!199!document_root = %s
vserver!199!rule!1!match = default
vserver!199!rule!1!handler = file
vserver!199!rule!2!match ... |
import os, re, hmac
from wsgiref.simple_server import make_server
KEY_AUTHORIZATION = {"uri": "/not_set", "data": ""}
TRAVIS_SESSION = os.getenv("TRAVIS_SESSION", "not_yet_set")
def app(req, resp):
if req['REQUEST_METHOD'] == "POST":
if hmac.compare_digest(req['QUERY_STRING'], TRAVIS_SESSION):
... |
from hashlib import sha256
from math import log
import re
import string
from struct import unpack
import traceback
def YN(b):
if b is None:
return None
return 'Y' if b else 'N'
def _maybe_int(n):
n_int = int(n)
if n == n_int:
return n_int
return n
def target2pdiff(target):
if target is None:
return None
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.six.moves import queue
import json
import multiprocessing
import os
import signal
import sys
import time
import traceback
import zlib
from jinja2.exceptions import TemplateNotFound
# TODO: not needed if we us... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import copy
import operator
import argparse
import os
import os.path
import sys
import time
from jinja2 import __version__ as j2_version
import ansible
from ansible import constants as C
from ansible.module_utils._text import to_... |
import cherrypy
import os
from cherrytemplate import renderTemplate
import dfs, dfs.utils, dfs.filesystem
from cherrypy.lib.static import serve_download
def render(template_name, **kwargs):
""" A helper method to render templates """
if not kwargs.has_key('msg_error'): kwargs['msg_error'] = ''
kwargs['template_file... |
from .input_device import InputDevice
from selenium.webdriver.remote.webelement import WebElement
class PointerInput(InputDevice):
DEFAULT_MOVE_DURATION = 250
def __init__(self, type_, name):
super(PointerInput, self).__init__()
self.type = type_
self.name = name
def create_poi... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import warnings
from django.forms import (
CharField, ChoiceField, Form, HiddenInput, IntegerField, ModelForm,
ModelMultipleChoiceField, MultipleChoiceField, RadioSelect, Select,
TextInput,
)
from django.test import TestCase
from django.utils... |
from __future__ import (absolute_import, division, print_function)
import json
import os
import sys
import pytest
linode_apiv4 = pytest.importorskip('linode_api4')
mandatory_py_version = pytest.mark.skipif(
sys.version_info < (2, 7),
reason='The linode_api4 dependency requires python2.7 or higher'
)
from li... |
#! /usr/bin/python
import tkMessageBox
from GUI.load import Load
from GUI.main import Main
from GUI.menu import MainMenu
from GUI.newGame import NewGame
import Tkinter as tk
from dice import DiceSet
from player import Player
class DiceTestApp(tk.Tk):
class ComparisonGroup:
def __init__(self, name):
self.na... |
import argparse
import pandas as pd
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from firecares.firestation.models import FireDepartment
class Command(BaseCommand):
help = """Imports domain names from a csv roster file into FireCARES. The CSV file is ex... |
"""Isomap for manifold learning"""
# License: BSD 3 clause (C) 2011
import numpy as np
from ..base import BaseEstimator, TransformerMixin
from ..neighbors import NearestNeighbors, kneighbors_graph
from ..utils import check_array
from ..utils.graph import graph_shortest_path
from ..decomposition import KernelPCA
from ... |
from django.core.urlresolvers import (RegexURLPattern,
RegexURLResolver, LocaleRegexURLResolver)
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.utils import six
__all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'patt... |
from google.appengine.api import memcache
import os
APP_VERSION = os.environ["CURRENT_VERSION_ID"]
def _CachedLookup(name, ttl, function, other, args):
cache_key = ":".join([APP_VERSION, name] + [str(x) for x in args])
data = memcache.get(cache_key)
if data is not None:
return data
data = function(other,... |
from pyBusPirateLite.SPI import *
BB = BBIO_base()
BB.connect()
BB.enter()
spi = SPI()
spi.pins = PIN_POWER | PIN_CS
spi.config = CFG_PUSH_PULL | CFG_CLK_EDGE
spi.speed = '30kHz'
# Read Byte. Address Passed is MSB First
def Read(address, rx_bytes):
data = bytes()
spi.cs = True
spi.transfer([0x03, addres... |
from os import path
import mock
import six
import yaml
from cinder.volume.drivers.emc.vnx import client
from cinder.volume.drivers.emc.vnx import common
patch_sleep = mock.patch('time.sleep')
patch_vnxsystem = mock.patch('storops.VNXSystem')
def load_yaml(file_name):
yaml_file = '{}/{}'.format(path.dirname(... |
"""clean-room implementation of a mysql client supporting both *connect* and *quit* operations"""
import datetime
import socket
import struct
import sys
import time
from hashlib import sha1
from . import compat
import tornado.gen
import tornado.iostream
def _sxor(lhs, rhs):
if sys.version_info > (3, 0):
... |
import logging
import time
import unittest
from telemetry.core import platform as platform_module
class PlatformBackendTest(unittest.TestCase):
def testPowerMonitoringSync(self):
# Tests that the act of monitoring power doesn't blow up.
platform = platform_module.GetHostPlatform()
can_monitor_power = p... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# tvalacarta - XBMC Plugin
# ------------------------------------------------------------
# json_tools
# Parsea un string en JSON probando varios módulos
# ------------------------------------------------------------
import tracebac... |
#!/usr/bin/env python
from __future__ import print_function
# this is mostly for testing that the examples run without errors
#
# To use this script:
#
# 0. change to this directory
# 1. be in an activated Python2 virtual-env with crossbar installed
# 2. pip install colorama
# 3. have a virtualenv called ./venv-p... |
"""Methods for working with geo/raster data."""
from osgeo import osr
from pyproj import Proj, transform
def lat_lon_to_pixel(raster_dataset, location):
"""From zacharybears.com/using-python-to-translate-latlon-locations-to-pixels-on-a-geotiff/."""
ds = raster_dataset
gt = ds.GetGeoTransform()
srs = ... |
"""Keras built-in metrics functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Metrics functions.
from tensorflow.python.keras._impl.keras.metrics import binary_accuracy
from tensorflow.python.keras._impl.keras.metrics import binary_crossentropy
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible import constants as C
from ansible.errors import AnsibleParserError
from ansible.module_utils._text import to_text, to_native
from ansible.playbook.play import Play
from ansible.playbook.playbook_include imp... |
"""
=========================
Multi-dimensional scaling
=========================
An illustration of the metric and non-metric MDS on generated noisy data.
The reconstructed points using the metric MDS and non metric MDS are slightly
shifted to avoid overlapping.
"""
# Licence: BSD
print(__doc__)
import numpy as np... |
from math import sin, cos, pi, degrees, radians
from mathutils import Vector, Matrix
import bpy
from bpy.props import EnumProperty, BoolProperty, IntProperty, FloatProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import (match_long_repeat, updateNode)
from sverchok.data_structu... |
"""Fixer for sys.exc_{type, value, traceback}
sys.exc_type -> sys.exc_info()[0]
sys.exc_value -> sys.exc_info()[1]
sys.exc_traceback -> sys.exc_info()[2]
"""
# By Jeff Balogh and Benjamin Peterson
# Local imports
from .. import fixer_base
from ..fixer_util import Attr, Call, Name, Number, Subscript, Node,... |
from __future__ import division, print_function, absolute_import
import numpy as np
from copy import deepcopy
from numpy.linalg import norm
from numpy.testing import (TestCase, assert_array_almost_equal,
assert_array_equal, assert_array_less,
assert_raises, assert_e... |
import json
import time
from datetime import timedelta
import os
from autobahn.wamp import ApplicationError, TransportLost
from mock import mock, call
from pyfakefs.fake_filesystem_unittest import Patcher
from mdstudio.api.exception import CallException
from mdstudio.deferred.chainable import test_chainable
from mdst... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.base.base import BaseDatabaseWrapper
from djan... |
"""Include imports from the sqlalchemy.dialects package for backwards
compatibility with pre 0.6 versions.
"""
from sqlalchemy.dialects.sqlite import base as sqlite
from sqlalchemy.dialects.postgresql import base as postgresql
postgres = postgresql
from sqlalchemy.dialects.mysql import base as mysql
from sqlalchemy.di... |
"""
Utilities for fast persistence of big data, with optional compression.
"""
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import pickle
import traceback
import sys
import os
import zlib
import warnings
import struct
import codecs
from ._compat import _basestring
from io import BytesIO
PY3... |
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_blobs
from sklearn.utils.class_weight import compute_class_weight
from sklearn.utils.class_weight import compute_sample_weight
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testin... |
# coding=utf-8
from django.db import IntegrityError
from django.test import TestCase
from django.core.exceptions import ValidationError
from oscar.apps.catalogue.models import (Product, ProductClass,
ProductAttribute,
AttributeOption)
fr... |
from __future__ import division
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import ternary
SQRT3OVER2 = np.sqrt(3) / 2
def project(p):
# project using the same transformation that was used for the triangles
a, b, c = p
x = a/2 + b
y = SQRT3OVER2 * a
return (x, y)
... |
"""Utilities for ImageNet data preprocessing & prediction decoding.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras_applications import imagenet_utils
from tensorflow.python.keras.applications import keras_modules_injection
from tensorflow.py... |
import random
import requests
class BlServer(object):
def __init__(self, room_id):
self.room_id = room_id
self.servers = {}
def get_wss_servers(self) -> list:
self._init_servers()
servers = self.servers.setdefault('host_server_list', [])
return ['wss://... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Board'
db.create_table('boards_board', (
('id... |
from openerp.tests.common import TransactionCase
class TestOnchangeProductId(TransactionCase):
"""Test that when an included tax is mapped by a fiscal position, the included tax must be
subtracted to the price of the product.
"""
def setUp(self):
super(TestOnchangeProductId, self).setUp()
... |
from oslo_config import cfg
from oslo_log import log as logging
from nova.i18n import _LW
from nova.scheduler import filters
from nova.scheduler.filters import utils
LOG = logging.getLogger(__name__)
max_io_ops_per_host_opt = cfg.IntOpt("max_io_ops_per_host",
default=8,
help="Tells filters to ignore ... |
from openerp import fields, models, api
class ProductTemplate(models.Model):
_inherit = "product.template"
purchase_request = fields.Boolean(string='Purchase Request',
help="Check this box to generate "
"purchase request instead... |
"""
Chiasm Shell setup.
:author: Ben Cheney
:license: MIT
"""
from __future__ import print_function, absolute_import
from setuptools import setup
def disable_sandbox():
"""
When capstone/keystone is installed as a dependency, setuptools
throws a SandboxViolation when it tries to create a
directory for... |
{
'name': 'Template of Charts of Accounts',
'version': '1.1',
'category': 'Hidden/Dependency',
'description': """
Remove minimal account chart.
=============================
Deactivates minimal chart of accounts.
""",
'author': 'OpenERP SA',
'website': 'https://www.odoo.com/page/accounting',
... |
"""
URL patterns for the OpenStack Dashboard.
"""
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import patterns
from django.conf.urls.static import static # noqa
from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns # noqa
... |
from twilio.rest.base import TwilioClient
from twilio.rest.resources import UNSET_TIMEOUT
from twilio.rest.resources.monitor.alerts import Alerts
from twilio.rest.resources.monitor.events import Events
class TwilioMonitorClient(TwilioClient):
"""
A client for accessing the Twilio Monitor API.
The Twilio ... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
from .utils import Spec, expand, str_
PARAM_SCHEME = expand(
base_key=str_, # todo: rename/remove
id=str_,
label=str_,
category=str_,
dtype=str_,
default=object,
options=list,
option_labels=list,
option_attributes=Spec(types=dict, required=False, item_scheme=(str_, list)),
... |
"""Functions for scoring paired system/reference RTTM files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict, namedtuple
import numpy as np
from scipy.linalg import block_diag
fr... |
"""
Blocks API Transformer
"""
from openedx.core.djangoapps.content.block_structure.transformer import BlockStructureTransformer
from .block_counts import BlockCountsTransformer
from .block_depth import BlockDepthTransformer
from .navigation import BlockNavigationTransformer
from .student_view import StudentViewTransf... |
import unittest
from ftplib import error_perm
from unittest import mock
import pytest
from airflow.providers.ftp.hooks.ftp import FTPHook
from airflow.providers.ftp.sensors.ftp import FTPSensor
class TestFTPSensor(unittest.TestCase):
@mock.patch('airflow.providers.ftp.sensors.ftp.FTPHook', spec=FTPHook)
def... |
#!/usr/bin/env python
from collections import namedtuple
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.inventory import Inventory
from ansible.parsing.dataloader import DataLoader
from ansible.playbook.play import Play
from ansible.plugins.callback import CallbackBase
from ansible.vars... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
import pan.xapi
HAS_LIB = True
except ImportError:
HAS_LIB = False
_ADMIN_XPATH = "/config/mgt-config/users... |
"""Linux gadgetfs glue.
Exposes a USB gadget using a USB peripheral controller on Linux. The userspace
ABI is documented here:
https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/inode.c
"""
import errno
import multiprocessing
import os
import struct
from tornado import ioloop
import usb_constants
imp... |
def parse_args(text):
#print "parsing: [%s]" %text
escape = False
string = False
result = []
token = str()
value = 0;
for c in text:
#print "[%s]%s: %s: %s" %(token, c, escape, string)
if c == '\\':
escape = True
continue
if escape:
if not string:
raise SyntaxError("escape found in no string:... |
"""Fix changes imports of urllib which are now incompatible.
This is rather similar to fix_imports, but because of the more
complex nature of the fixing for urllib, it has its own fixer.
"""
# Local imports
from lib2to3.fixes.fix_imports import alternates, FixImports
from lib2to3 import fixer_base
from lib2to3.f... |
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.node import Node, Host, RemoteController
from mininet.log import setLogLevel, info
from mininet.util import quietRun, dumpNodeConnections
from mininet.cli import CLI
from mininet.node import OVSController, Controller
from mininet.link import TCL... |
from datetime import date, datetime
from edc.subject.registration.models import RegisteredSubject
from lis.labeling.classes import ModelLabel
from lis.labeling.models import ZplTemplate
class RequisitionLabel(ModelLabel):
def __init__(self):
super(RequisitionLabel, self).__init__()
self.zpl_tem... |
from __future__ import division, print_function, absolute_import
from numpy import array, kron, matrix, diag
from numpy.testing import TestCase, run_module_suite, assert_, assert_equal
from scipy.sparse import spfuncs
from scipy.sparse import csr_matrix, csc_matrix, bsr_matrix
from scipy.sparse._sparsetools import cs... |
import unittest
import logging
import struct
import inspect
from nose.tools import eq_, ok_
from nose.tools import raises
from ryu.ofproto import inet
from ryu.lib.packet import ipv4
from ryu.lib.packet import ipv6
from ryu.lib.packet import packet
from ryu.lib.packet import packet_utils
from ryu.lib.packet import vr... |
"""Implementation of Unix-like mv command for cloud storage providers."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from gslib.command import Command
from gslib.command_argument import CommandArgument
from gslib... |
"""
=========================================
SVM: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a Support Vector Machine classifier with
linear kernel.
"""
print(__doc__)
import numpy as np
impor... |
import unittest
from memory_inspector.core import memory_map
class MemoryMapTest(unittest.TestCase):
def runTest(self):
mmap = memory_map.Map()
map_entry1 = memory_map.MapEntry(4096, 8191, 'rw--', '/foo', 0)
map_entry2 = memory_map.MapEntry(65536, 81919, 'rw--', '/bar', 4096)
# Test the file de-of... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
class XBefIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://xbef.com/video/5119-glamourous-lesbians-smoking-drinking-a... |
import scripts
import generate_training
import sys
def do_encounters(seconds=None):
if not 'seconds' in vars() or seconds is None:
seconds = 5
scripts.rrr()
do_enc_loc = scripts.compute_encounters(hs, back, seconds)
return do_enc_l... |
from flask import request
from superdesk.resource import Resource, build_custom_hateoas
from .common import get_user, get_auth, CUSTOM_HATEOAS
from superdesk.metadata.utils import item_url
from superdesk.services import BaseService
from apps.common.components.utils import get_component
from apps.item_lock.components.it... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
# (c) 2017, Ansible by Red Hat, inc
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the term... |
"""EdX Branding API
Provides a way to retrieve "branded" parts of the site,
such as the site footer.
This information exposed to:
1) Templates in the LMS.
2) Consumers of the branding API.
This ensures that branded UI elements such as the footer
are consistent across the LMS and other sites (such as
the marketing si... |
"""The basic class for database testing
"""
import unittest
from sqlalchemy.pool import StaticPool
from netseen.database import DataBase
class BaseDB(unittest.TestCase):
"""the basic class of database testing
"""
def setUp(self):
self.database = DataBase(
'sqlite:///:memory:',
... |
import os
import logging
import ycm_core
from collections import defaultdict
from ycmd.completers.general_completer import GeneralCompleter
from ycmd import identifier_utils
from ycmd import utils
from ycmd.utils import ToUtf8IfNeeded
from ycmd import responses
SYNTAX_FILENAME = 'YCM_PLACEHOLDER_FOR_SYNTAX'
class Id... |
# -*- coding: utf-8 -*-
"""
Google App Engine OpenID Providers
----------------------------------
|openid|_ provider implementations based on the |gae_users_api|_.
.. note::
When using the :class:`GAEOpenID` provider, the :class:`.User` object
will always have only the
:attr:`.User.user_id`,
:attr:`.... |
"""Python wrappers for Datasets and Iterators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import structure
from tensorflow.python.ops import gen_dataset_ops
from tens... |
import pooler
from tools.translate import _
from osv import osv
from osv import fields
special_reports = [
'printscreen.list'
]
class aeroo_add_print_button(osv.osv_memory):
'''
Add Print Button
'''
_name = 'aeroo.add_print_button'
_description = 'Add print button'
def _check(self, cr, ui... |
"""
Operations on graphs including union, intersection, difference.
"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx as nx
from networkx.utils import is_string_like
__author__ = """\n""".join... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.