content stringlengths 4 20k |
|---|
"""pyPEG parsing for the RFC 6266 (Content-Disposition) header."""
import collections
import urllib.parse
import string
import re
import pypeg2 as peg
from qutebrowser.utils import utils
class UniqueNamespace(peg.Namespace):
"""A pyPEG2 namespace which prevents setting a value twice."""
def __setitem__(s... |
import numpy as np
from scipy import linalg, weave
import types
import ctypes
from ctypes import byref, c_char, c_int, c_double # TODO
# import scipy.lib.lapack
import scipy
import warnings
import os
import scipy.linalg
import logging
logger = logging.getLogger(__name__)
anaconda = False
MKL = False
_scipyversion = ... |
{
'name': 'Recruitment Process',
'version': '1.0',
'category': 'Human Resources',
'sequence': 25,
'summary': 'Jobs, Recruitment, Applications, Job Interviews, Surveys',
'description': """
Manage job positions and the recruitment process
================================================
This appl... |
import regex as re
from collections import deque
from contextlib import closing
from cStringIO import StringIO
from flanker.mime.message.headers.parsing import parse_stream
from flanker.mime.message.headers import MimeHeaders
def detect(message):
headers = collect(message)
return Result(
score=len(hea... |
import sys
import time
import RPi.GPIO as GPIO
delay = 0.001
class Motor:
# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
# Define GPIO signals to use
# Physical pins 35, 36, 37, 38, 29, 31, 32, 33, 13, 15, 16, 18
# GPIO19, GPIO16, GPIO26, GPIO20, GPIO5, GPIO6, GPIO12,... |
# -*- coding: utf-8 -*-
"""Test for Poll Xmodule functional logic."""
from xmodule.poll_module import PollDescriptor
from . import LogicTest
class PollModuleTest(LogicTest):
"""Logic tests for Poll Xmodule."""
descriptor_class = PollDescriptor
raw_field_data = {
'poll_answers': {'Yes': 1, 'Dont_kn... |
"""
Django models for site configurations.
"""
import collections
from logging import getLogger
from django.contrib.sites.models import Site
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from jsonfield.fields import JSONField
from model_utils.models im... |
from tkinter import Tk, Text, Button, Label, filedialog, messagebox, Menu, StringVar, Scrollbar,\
LEFT, RIGHT, Frame, PhotoImage,Canvas, HORIZONTAL, VERTICAL, Toplevel
from clarifai.rest import ClarifaiApp, Image as ClImage, Video as ClVid
from timeit import default_timer
from terminaltables import DoubleTable
fro... |
"""Tests for the ``signed_request`` module."""
from datetime import datetime, timedelta
from nose.tools import *
from facepy import SignedRequest
TEST_ACCESS_TOKEN = '181259711925270|1570a553ad6605705d1b7a5f.1-499729129|8XqMRhCWDKtpG-i_zRkHBDSsqqk'
TEST_SIGNED_REQUEST = u'' \
'mnrG8Wc9CH_rh-GCqq97GFAPOh6AY7cM... |
#!/usr/bin/env python
"""
Synopsis:
Generate Django model and form definitions.
Write to forms.py and models.py.
Usage:
python gen_model.py [options]
Options:
-f, --force
Overwrite models.py and forms.py without asking.
-h, --help
Show this help message.
"""
import sys
impo... |
"""
Common base classes for all new XBlock runtimes.
"""
import logging
import crum
from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH
from completion.models import BlockCompletion
from completion.services import CompletionService
from django.contrib.auth import get_user_model
from django.core.exceptions... |
#!/usr/bin/env python
import os
from optparse import OptionParser
TEMPLATE = open(os.path.join(os.path.dirname(__file__), 'crontab.tpl')).read()
def main():
parser = OptionParser()
parser.add_option("-z", "--zamboni",
help="Location of zamboni (required)")
parser.add_option("-u", "... |
from DIE.Lib import DataParser
from idaapi import PluginForm
from PySide import QtGui, QtCore
class ParserView(PluginForm):
"""
DIE Value View
"""
def __init__(self):
super(ParserView, self).__init__()
self.data_parser = None
self.ptable_widget = None
def S... |
import re
_REGEX = re.compile('^(?P<major>[0-9]+)'
'\.(?P<minor>[0-9]+)'
'\.(?P<patch>[0-9]+)'
'(\-(?P<prerelease>[0-9A-Za-z]+(\.[0-9A-Za-z]+)*))?'
'(\+(?P<build>[0-9A-Za-z]+(\.[0-9A-Za-z]+)*))?$')
if 'cmp' not in __builtins__:
cmp = ... |
from ctypes import c_char
from django.contrib.gis.geos.libgeos import (
GEOM_PTR, PREPGEOM_PTR, GEOSFuncFactory,
)
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
# Prepared geometry constructor and destructors.
geos_prepare = GEOSFuncFactory('GEOSPrepare', argtypes=[GEOM_PTR], restype=PRE... |
"""A bare-bones and non-compliant XMPP server.
Just enough of the protocol is implemented to get it to work with
Chrome's sync notification system.
"""
import asynchat
import asyncore
import base64
import re
import socket
from xml.dom import minidom
# pychecker complains about the use of fileno(), which is implement... |
import re
from django.template import Node, TemplateSyntaxError, Library, \
Variable, Context
from django.template.loader import get_template
register = Library()
class RenderSubtemplateNode(Node):
def __init__(self, template_name, template_context, var_name):
self.template_name = template_name
... |
import urlparse
def setNoCacheAndCORSHeaders(request, response):
"""Set Cache-Control, CORS and Content-Type headers appropriate for the cookie tests."""
headers = [("Content-Type", "application/json"),
("Access-Control-Allow-Credentials", "true")]
origin = "*"
if "origin" in request.he... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (run_module_suite, assert_allclose, assert_equal,
assert_almost_equal, assert_array_equal,
assert_array_almost_equal)
from scipy.ndimage import convolve1d... |
"""This module defines an ASE interface to FHI-aims.
Felix Hanke <EMAIL>
Jonas Bjork <EMAIL>
"""
import os
import numpy as np
from ase.io.aims import write_aims, read_aims
from ase.data import atomic_numbers
from ase.calculators.calculator import FileIOCalculator, Parameters, kpts2mp, \
ReadError
float_keys =... |
# coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
js_to_json,
)
class MuenchenTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?muenchen\.tv/livestream'
IE_DESC = 'münchen.tv'
_TEST = {... |
import subprocess
import sys
from paasta_tools.cli.utils import get_container_name
from paasta_tools.cli.utils import get_subparser
from paasta_tools.cli.utils import get_task_from_instance
from paasta_tools.cli.utils import PaastaTaskNotFound
def add_subparser(subparsers):
get_subparser(
description="'p... |
"""Blowfish symmetric cipher
Blowfish_ is a symmetric block cipher designed by Bruce Schneier.
It has a fixed data block size of 8 bytes and its keys can vary in length
from 32 to 448 bits (4 to 56 bytes).
Blowfish is deemed secure and it is fast. However, its keys should be chosen
to be big enough to withstand a br... |
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
dashboards = [
["Results", "/dashboards/flakiness_dashboard.html"],
["Timeline", "/dashboards/timeline_explorer.html"],
["Treemap", "/dashboards/treemap.html"],
["Stats", "/da... |
"""
Some functions related to the os and os.path module
"""
from contextlib import contextmanager
import os
from os.path import join as opj
import shutil
import tempfile
import zipfile
if os.name == 'nt':
import ctypes
import win32service as ws
import win32serviceutil as wsu
def listdir(dir, recursive=F... |
"""The tests for Philips Hue device triggers."""
import pytest
from homeassistant.components import hue
import homeassistant.components.automation as automation
from homeassistant.components.hue import device_trigger
from homeassistant.setup import async_setup_component
from .conftest import setup_bridge_for_sensors ... |
""" CISCO_UBE_MIB
This MIB describes objects used for managing Cisco
Unified Border Element (CUBE).
The Cisco Unified Border Element (CUBE) is a Cisco
IOS Session Border Controller (SBC) that interconnects
independent voice over IP (VoIP) and video over IP
networks for data, voice, and video transport
"""
impor... |
"""
Some additional unit tests for Microsite logic. The LMS covers some of the Microsite testing, this adds
some additional coverage
"""
import ddt
from mock import patch
from microsite_configuration.microsite import (
get_value_for_org,
get_backend,
)
from microsite_configuration.backends.base import BaseMicr... |
from unittest import TestCase
import zeeguu_core
from sqlalchemy.orm.exc import NoResultFound
from zeeguu_core_test.model_test_mixin import ModelTestMixIn
from zeeguu_core_test.rules.language_rule import LanguageRule
from zeeguu_core_test.rules.user_rule import UserRule
from zeeguu_core.model.language import Language... |
import unittest
from memory_inspector.core import backends
class MockDevice(backends.Device): # pylint: disable=W0223
def __init__(self, backend, device_id):
super(MockDevice, self).__init__(backend)
self.device_id = device_id
@property
def name(self):
return "Mock Device %s" % self.device_id
... |
import imaplib
from offlineimap import imaplibutil, imaputil, threadutil
from offlineimap.ui import UIBase
from threading import *
import thread, hmac, os, time
import base64
from StringIO import StringIO
from platform import system
try:
# do we have a recent pykerberos?
have_gss = False
import kerberos
... |
"""Tests for tensorflow.ops.linalg_ops.eig."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes as dtypes_lib
from tensorflow.python.framew... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
# -*- coding: utf-8 -*-
"""
flask.testsuite.appctx
~~~~~~~~~~~~~~~~~~~~~~
Tests the application context.
:copyright: (c) 2012 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
class AppContextTestCase(Flask... |
'''
Reference tzinfo implementations from the Python docs.
Used for testing against as they are only correct for the years
1987 to 2006. Do not use these for real code.
'''
from datetime import tzinfo, timedelta, datetime
from pytz import utc, UTC, HOUR, ZERO
# A class building tzinfo objects for fixed-offset time zo... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Dummy migration
pass
def backwards(self, orm):
# Dummy migration
pass
models = {
... |
import pytest
from textwrap import dedent
from conda_smithy.variant_algebra import parse_variant, variant_add
tv1 = parse_variant(
"""\
foo:
- 1.10
bar:
- 2
"""
)
tv2 = parse_variant(
"""\
foo:
- 1.2
bar:
- 3
"""
)
tv3 = parse_variant(
"""\
baz:
- 1
bar:
- 3
"""
)
tv4 = parse_v... |
import pdb,os,sys
from sco_exceptions import *
from notesdb import *
from notes_log import retreive_request
def logdb(REQUEST=None, cnx=None, method=None, etudid=None, msg=None, commit=True ):
if not cnx:
raise ValueError('logdb: cnx is None')
if not REQUEST:
REQUEST = retreive_request(skip=1)... |
"""Tests for nccl ops. See also the cc test for nccl_communicator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import partial
import numpy as np
from tensorflow.python.framework import errors
from tensorflow.python.framework import o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
description: Generate html description strings for the tc1_97 package.
Copyright (C) 2019 Ivar Farup
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... |
from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Tree import Tree
from pyjamas.ui.TreeItem import TreeItem
class Trees(Sink):
def __init__(self):
Sink.__init__(self)
self.fProto = [
Proto("Beethoven", [
Proto("Concertos", [
Proto("No. 1 - C"... |
from __future__ import unicode_literals
from guessit.textutils import find_first_level_groups
from guessit.patterns import group_delimiters
import functools
import logging
log = logging.getLogger(__name__)
def process(mtree):
"""return the string split into explicit groups, that is, those either
between pare... |
"""
Mapping of bare metal node states.
Setting the node `power_state` is handled by the conductor's power
synchronization thread. Based on the power state retrieved from the driver
for the node, the state is set to POWER_ON or POWER_OFF, accordingly.
Should this fail, the `power_state` value is left unchanged, and the... |
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse, HttpRequest
import json
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from control_unit.submodels.CommandIdentifier import *
from control_unit.submodels.UnitCommunication import... |
"""
Tests for the course updates page.
"""
from courseware.courses import get_course_info_usage_key
from django.core.urlresolvers import reverse
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from openedx.features.course_experience.views.course_updates import STATUS_VISIBLE
from student.models... |
from testconfig import config
import mock
import time
import unittest
from cloudify import mocks as cfy_mocks
from cloudify.exceptions import OperationRetry
from vcloud_plugin_common import Config, VcloudAirClient
SUBSCRIPTION = 'subscription'
ONDEMAND = 'ondemand'
class IntegrationSubscriptionTestConfig(Config):
... |
from copy import copy, deepcopy
from tests.common.impala_test_suite import ImpalaTestSuite
from tests.common.skip import SkipIfNotHdfsMinicluster
def transpose_results(result, map_fn=lambda x: x):
"""Given a query result (list of strings, each string represents a row), return a list
of columns, where each colum... |
"""
Defines abstract class for the Enrollment Reports.
"""
from django.contrib.auth.models import User
from student.models import UserProfile
import collections
import json
import abc
class AbstractEnrollmentReportProvider(object):
"""
Abstract interface for Detailed Enrollment Report Provider
"""
__... |
import functools
import warnings
from importlib import import_module
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.html import conditional_escape
from django.utils.inspect import getargspec
from django.utils.itercompat import is_iterable
from .base import... |
from ansible.compat.tests import unittest, mock
from oneview_module_loader import SanManagerModule
from hpe_test_utils import OneViewBaseTestCase
from copy import deepcopy
FAKE_MSG_ERROR = 'Fake message error'
DEFAULT_SAN_MANAGER_TEMPLATE = dict(
name='172.18.15.1',
providerDisplayName='Brocade Network Adviso... |
"""
Script that trains Tensorflow Robust Multitask models on KAGGLE datasets.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import numpy as np
import tempfile
import shutil
import deepchem as dc
from deepchem.molnet import load_kaggle
###L... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.onyx import onyx_l2_interface
from units.modules.utils import set_module_args
from .onyx_module import TestOnyxModule, load_fixture
class TestOnyxInterfaceModule(Te... |
from __future__ import absolute_import, print_function, division
import wx
from ivy.std_api import *
import logging
from textdroptarget import *
import math
import random
import sys
import os
import messagepicker
sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")
import messages_xml_map
class plot_data... |
from warnings import warn
import ctypes
from .clib import gobject
from .clib.gobject import GValue, GValuePtr, G_TYPE_FROM_INSTANCE
from .clib.gobject import GObjectClassPtr
from .clib.gir import GIInfoType, GITypeTag
from .util import escape_parameter, unescape_parameter, InfoIterWrapper
from .util import import_att... |
#!/usr/bin/env python
from __future__ import absolute_import
import os
from setuptools import find_packages, setup
from scanomatic import get_version
setup(
name="Scan-o-Matic",
version=get_version(),
description="High Throughput Solid Media Image Phenotyping Platform",
long_description="""Scan-o-M... |
__author__ = 'xiang'
import collections
def doc(s):
if hasattr(s, '__call__'):
s = s.__doc__
def f(g):
g.__doc__ = s
return g
return f
class heapdict(collections.MutableMapping):
__marker = object()
@staticmethod
def _parent(i):
return ((i - 1) >> 1)
@stat... |
from collections import defaultdict
from packaging.version import Version
from packaging.version import InvalidVersion
from readthedocs.builds.constants import LATEST_VERBOSE_NAME
from readthedocs.builds.constants import STABLE_VERBOSE_NAME
def get_major(version):
return version._version.release[0]
def get_min... |
#=======================================================================
#
# Python Lexical Analyser
#
# Exception classes
#
#=======================================================================
class PlexError(Exception):
message = ""
class PlexTypeError(PlexError, TypeError):
pass
class PlexValueError(P... |
__revision__ = "$Id$"
import unittest
from Crypto.Protocol import AllOrNothing
from Crypto.Util.py3compat import *
text = b("""\
When in the Course of human events, it becomes necessary for one people to
dissolve the political bands which have connected them with another, and to
assume among the powers of the earth, ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
projectdirtyblocker.py
---------------------
Date : May 2018
Copyright : (C) 2018 by Denis Rouzaud
Email : <EMAIL>
**************************************... |
"""Fixer for intern().
intern(s) -> sys.intern(s)"""
# Local imports
from .. import pytree
from .. import fixer_base
from ..fixer_util import Name, Attr, touch_import
class FixIntern(fixer_base.BaseFix):
PATTERN = """
power< 'intern'
trailer< lpar='('
( not(arglist | argument... |
# -*- coding: utf-8 -*-
"""
futmarket.core
~~~~~~~~~~~~~~~~~~~~~
This module implements the futmarket's basic methods.
"""
# Imports
## Relies heavily on fut package.
import fut
import pandas as pd
from time import sleep
# Login
## Login to EA Sports. May require two-factor authentication. You will be prompted for ... |
import py
from py._path import cacheutil
class BasicCacheAPITest:
cache = None
def test_getorbuild(self):
val = self.cache.getorbuild(-42, lambda: 42)
assert val == 42
val = self.cache.getorbuild(-42, lambda: 23)
assert val == 42
def test_cache_get_key_error(self):
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from units.compat.mock import patch
from ansible.modules.network.vyos import vyos_facts
from units.modules.utils import set_module_args
from .vyos_module import TestVyosModule, load_fixture
class TestVyosFactsModule(... |
"""
Miscellaneous util functions.
"""
from __future__ import (absolute_import, division, print_function)
import numpy as np
epsilon = 1.e-5
def point_in_tri(face_points, point, return_weights=False):
"""
Calculates whether point is internal/external
to element by comparing summed area of sub triangle... |
"""Test descendant package tracking carve-out allowing one final transaction in
an otherwise-full package as long as it has only one parent and is <= 10k in
size.
"""
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_r... |
import sys, time, utils, math
if utils.PQT5 == True:
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtWidgets import QApplication,QWidget, QLabel, QHBoxLayout, QVBoxLayout,\
QCheckBox, QPushButton
from PyQt5.QtGui import QPalette, QColor
else:
from PyQt4.QtCore import Qt, QTimer
from PyQt4.QtGui import QPalette... |
"""Test for preservation of unknown fields in the pure Python implementation."""
__author__ = '<EMAIL> (Bohdan Koval)'
from google.apputils import basetest
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2
from google.protobuf.internal import encoder
from google.protobuf.internal ... |
"""
Tests the transfer student management command
"""
from django.conf import settings
from mock import patch, call
from opaque_keys.edx import locator
import unittest
import ddt
from shoppingcart.models import Order, CertificateItem # pylint: disable=import-error
from course_modes.models import CourseMode
from stude... |
import xbmcaddon
import xbmcgui
from libs.sysbox import popupSysBox
from libs.utility import debugTrace, errorTrace, infoTrace, getID, getName
debugTrace("-- Entered infopopup.py")
if not getID() == "":
popupSysBox()
else:
errorTrace("infopopup.py", "VPN service is not ready")
debugTrace(... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd/m/Y'
TIME_FORMAT = 'P'
DATETIME_FORMAT = 'd/m/Y P'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd/m/Y'
SH... |
from __future__ import unicode_literals
import frappe, unittest
from erpnext.setup.utils import get_exchange_rate
test_records = frappe.get_test_records('Currency Exchange')
def save_new_records(test_records):
for record in test_records:
kwargs = dict(
doctype=record.get("doctype"),
docname=record.get("date... |
import warnings
from django.conf import settings
from django.conf.urls import patterns, url
from django.core.urlresolvers import LocaleRegexURLResolver
from django.utils import six
from django.utils.deprecation import RemovedInDjango110Warning
from django.views.i18n import set_language
def i18n_patterns(prefix, *arg... |
from django.views.generic import View
from ..settings import oauth2_settings
from .mixins import ProtectedResourceMixin, ScopedResourceMixin, ReadWriteScopedResourceMixin
class ProtectedResourceView(ProtectedResourceMixin, View):
"""
Generic view protecting resources by providing OAuth2 authentication out of... |
# encoding: utf-8
"""
Enable wxPython to be used interacive by setting PyOS_InputHook.
Authors: Robin Dunn, Brian Granger, Ondrej Certik
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the ... |
from pbr.hooks import base
from pbr import packaging
class MetadataConfig(base.BaseConfig):
section = 'metadata'
def hook(self):
self.config['version'] = packaging.get_version(
self.config['name'], self.config.get('version', None))
packaging.append_text_list(
self.con... |
import os
class AbstractReader(object):
maxMibSize = 10000000 # MIBs can't be that large
fuzzyMatching = True # try different file names while searching for MIB
originalMatching = uppercaseMatching = lowcaseMatching = True
exts = ['',
os.path.extsep + 'txt',
os.path.ext... |
from lib.common import log
def compare_version(version_installed, versionlist):
# Create separate version lists
versionlist_stable = versionlist['releases']['stable']
versionlist_rc = versionlist['releases']['releasecandidate']
versionlist_beta = versionlist['releases']['beta']
versionlist_alpha = ... |
import os
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
def get_test_dir():
return os.path.abspath(os.path.join(os.path.dirname(__file__),
'sources.list.d'))
def test_url_constants():
from rosdep2.gbpdistro_support imp... |
from slicc.ast.AST import AST
class DeclListAST(AST):
def __init__(self, slicc, decls):
super(DeclListAST, self).__init__(slicc)
if not isinstance(decls, (list, tuple)):
decls = [ decls ]
self.decls = decls
def __repr__(self):
return "[DeclListAST: %s]" % (', '.joi... |
"""Named tuples for TFGAN.
TFGAN training occurs in four steps, and each step communicates with the next
step via one of these named tuples. At each step, you can either use a TFGAN
helper function in `train.py`, or you can manually construct a tuple.
"""
from __future__ import absolute_import
from __future__ import ... |
from ImageScripter import *
from elan import *
Configurator.media.Click()
Configurator.security.Click()
Configurator.system.Click()
Configurator.media.Click()
Configurator.security.Click()
Configurator.system.Click()
Configurator.media.Click()
Configurator.security.Click()
Configurator.system.Click()
Configurator.med... |
"""
iPod iTunesDB parser.
Documentation:
- http://ipodlinux.org/ITunesDB
Author: Romain HERAULT
Creation date: 19 august 2006
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet,
UInt8, UInt16, UInt32, UInt64, TimestampMac32,
String, Float32, NullBytes, Enum)
from lib.hacho... |
# -*- coding: utf-8 -*-
import math
from .dimensions import px2mm, mm2px
def aspheric_curve_front(r, lam, lam_px):
r = px2mm(r, lam, lam_px)
R = 19.371
a1 = 0.027322
a2 = 5.5360 * 10 ** -5
a3 = 1.5599 * 10 ** -7
a4 = 1.0454 * 10 ** -9
a5 = 2.7424 * 10 ** -12
a6 = 0
a = [a1, a2, a3,... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.staticfiles.storage import staticfiles_storage
from django.template.loader import render_to_string
from pipeline.conf import settings
from pipeline.utils import guess_type
from pipeline.packager import Packager, Pack... |
import sys
import time
from libcloud.utils.py3 import httplib
try:
import simplejson as json
except ImportError:
import json
from libcloud.utils.misc import reverse_dict
from libcloud.common.types import LibcloudError
from libcloud.common.gogrid import GoGridConnection, GoGridResponse,\
BaseGoGridDriver
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
DeleteModelAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... |
import numpy as np
import cPickle
from pycuda import gpuarray
from pycuda import cumath
from math import sqrt
from .. import sampler, memory_pool
from .top_layer import TopLayer
from ..pycuda_ops import eps, linalg
from ..pycuda_ops.elementwise import sign, nan_to_zeros, substract_matrix
from ..pycuda_ops.reductions im... |
"""Tests for flavor basic functions"""
from nova.compute import flavors
from nova import exception
from nova import test
class ExtraSpecTestCase(test.NoDBTestCase):
def setUp(self):
super(ExtraSpecTestCase, self).setUp()
def _flavor_validate_extra_spec_keys_invalid_input(self, key_name_list):
... |
"""Generic utilities for all python scripts."""
import atexit
import httplib
import os
import signal
import stat
import subprocess
import sys
import tempfile
import urlparse
def GetPlatformName():
"""Return a string to be used in paths for the platform."""
if IsWindows():
return 'win'
if IsMac():
retur... |
import argparse
import asyncio
import aiohttp
from aiohttp import web
import sys
import httptools
import uvloop
from socket import *
PRINT = 0
_RESP_CACHE = {}
class HttpRequest:
__slots__ = ('_protocol', '_url', '_headers', '_version')
def __init__(self, protocol, url, headers, version):
self._p... |
"""SCons.Tool.hpc++
Tool-specific initialization for c++ on HP/UX.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The... |
from decimal import Decimal
def ResponseFactory(action):
class FPSResponse(Response):
_action = action
_Result = globals().get(action + 'Result', ResponseElement)
# due to nodes receiving their closing tags
def endElement(self, name, value, connection):
if name != acti... |
def add_papyrus_handler(self, route_name_prefix, base_url, handler):
""" Add a Papyrus handler, i.e. a handler defining the MapFish
HTTP interface.
Example::
import papyrus
config.include(papyrus)
config.add_papyrus_handler(
'spots', '/spots', 'mypackage.handlers.SpotHa... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'curated'}
import json
import traceback
try:
import boto.sqs
from boto.exception import BotoServerError, NoAuthHandlerFound
HAS_BOTO = True
except ImportError:
HAS_BO... |
# -*- coding: utf-8 -*-
"""
test_django-watchman
------------
Tests for `django-watchman` management commands.
"""
from __future__ import unicode_literals
from io import StringIO
import unittest
from django.core.management import call_command
class TestWatchman(unittest.TestCase):
def test_successful_manage... |
import sys
import unittest
from django.db import connection
from django.test import TestCase
from django.test.runner import DiscoverRunner
from django.utils import six
from django.utils.encoding import force_text
from .models import Person
@unittest.skipUnless(connection.vendor == 'sqlite', 'Only run on sqlite so w... |
# coding: UTF-8
import unittest
from usig_normalizador_amba.NormalizadorDireccionesAMBA import NormalizadorDireccionesAMBA
from usig_normalizador_amba.Direccion import Direccion
from usig_normalizador_amba.settings import CALLE_ALTURA
from tests.test_commons import cargarCallejeroEstatico
class NormalizadorDirecci... |
import redis
class NutJobStrictRedis(redis.StrictRedis):
"""
A replacement for ``redis.StrictRedis`` which allows Turnstile to
communicate properly with the nutcracker Redis proxy. Turnstile's
use of ``PUBLISH`` for error reporting is ignored, rather than
being passed on to the proxy. The Turnst... |
'''Dialog boxes
This module handles dialog boxes. It contains the following
public symbols:
Dialog -- a base class for dialogs
askinteger -- get an integer from the user
askfloat -- get a float from the user
askstring -- get a string from the user
'''
from Tkinter import *
class Dialog(Toplevel):
'''Class t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.