content stringlengths 4 20k |
|---|
# -- coding: utf-8 --
# Note that we import as `DjangoRequestFactory` and `DjangoClient` in order
# to make it harder for the user to import the wrong thing without realizing.
from __future__ import unicode_literals
import django
from django.conf import settings
from django.test.client import Client as DjangoClient
fr... |
from pyramid import testing
from pytest import fixture
from pytest import mark
from pytest import raises
from unittest.mock import Mock
@fixture
def mock_metadata_sheet(context, mock_sheet, registry_with_content):
from adhocracy_core.testing import register_sheet
from .metadata import IMetadata
mock_sheet... |
import unittest
from nose.tools import eq_
from nose.tools import ok_
from ryu.lib.packet import ospf
class Test_ospf(unittest.TestCase):
""" Test case for ryu.lib.packet.ospf
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_router_lsa(self):
link1 = ospf.Rout... |
"""
Sample application that demonstrates getting information about this
AppEngine modules and accessing other modules in the same project.
"""
import urllib2
# [START modules_import]
from google.appengine.api import modules
# [END modules_import]
import webapp2
class GetModuleInfoHandler(webapp2.RequestHandler):
... |
""" Various global variables """
import os
PROG_NAME = "gBuilder"
PROG_VERSION = "2.1.0"
GINI_ROOT = os.environ["GINI_ROOT"]
GINI_HOME = os.environ["GINI_HOME"]
environ = {"os":"Windows",
"path":GINI_ROOT+"/",
"remotepath":"./",
"images":os.environ["GINI_SHARE"] +"/gbuilder/images/"... |
'''
LDTP v2 Mouse.
@author: Eitan Isaacson <<EMAIL>>
@author: Nagappan Alagappan <<EMAIL>>
@copyright: Copyright (c) 2009 Eitan Isaacson
@copyright: Copyright (c) 2009 Nagappan Alagappan
@license: LGPL
http://ldtp.freedesktop.org
This file may be distributed and/or modified under the terms of the GNU General
Public ... |
import superdesk
from flask import current_app as app
from superdesk.metadata.item import ASSOCIATIONS
class CleanImages(superdesk.Command):
"""This command will remove all the images from the system which are not referenced by content.
It checks the media type and calls the correspoinding function as s3 an... |
"""This example creates an account budget proposal.
To get account budget proposal, run get_account_budget_proposals.py
"""
import argparse
import sys
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
# [START add_account_budget_proposal]
def main(... |
#!/usr/bin/env python
# FUSE filesystem to build SSH config file dynamically.
# Mark Hellewell <<EMAIL>>
import errno
import glob
import logging
import logging.handlers
import os
import stat
import threading
import time
from fuse import FUSE, FuseOSError, Operations, LoggingMixIn
stderrhandler = logging.StreamHandle... |
from __future__ import print_function
import os, re, json
# Update DB from local devdocs.io dump: https://github.com/Thibaut/devdocs
# (Tested on Python 2.7 win7)
path_devdocs = "../var/devdocs"
path_db = "."
docs = {
"php": "PHP",
"python": "Python",
"javascript": "Javascript",
"dom": "Javascript",
... |
from .. import Provider as DateTimeProvider
class Provider(DateTimeProvider):
# Source: http://www.localeplanet.com/icu/ta-IN/index.html
DAY_NAMES = {
"0": "திங்கள்",
"1": "செவ்வாய்",
"2": "புதன்",
"3": "வியாழன்",
"4": "வெள்ளி",
"5": "சனி",
"6": "ஞாயிறு... |
from constants import *
initModel = "n-body"
fullModel = "n-body"
method = "continued fraction"
method_sw = "continued fraction"
step = 5.0
initStep = 5.0
a_max = 1000.0
a_min = 0.00465424
periapsis_max = -1.0
periapsis_min = -1.0
apoapsis_max = -1.0
apoapsis_min = -1.0
rho_max = -1.0
rho_min = -1.0
sor_type = 2
nor... |
"""
Tests for the datasets REST API.
"""
from uuid import UUID
from twisted.trial.unittest import TestCase
from ...testtools import loop_until
from ..testtools import (
require_cluster, require_moving_backend, create_dataset,
REALISTIC_BLOCKDEVICE_SIZE,
)
class DatasetAPITests(TestCase):
"""
Tests... |
# -*- coding: utf-8 -*-
import re
import xml.etree.ElementTree as etree
from ..internal.Hoster import Hoster
# Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/)
class ZDF(Hoster):
__name__ = "ZDF Mediathek"
__type__ = "hoster"
__version__ = "0.89"
__status__ = "testing"
__patter... |
#!PYRTIST:VERSION:0:0:1
from pyrtist.lib2d import Point, Tri
#!PYRTIST:REFPOINTS:BEGIN
gui1 = Point(19.4886046743, 3.84443340587)
gui2 = Point(-3.56565488372, 9.39682833333)
gui3 = Point(53.0555553922, -4.96428689655)
#!PYRTIST:REFPOINTS:END
from pyrtist.lib2d import *
class Bar(object):
def __init__(self, size=Po... |
import glob
import os
import os.path
from unittest import TestCase
import uuid
import mock
from pantsmud.util import convert, storage
def check_and_remove(path):
if os.path.exists(path):
os.remove(path)
class Obj(object):
def __init__(self):
self.uuid = uuid.uuid4()
self.load_data ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
# Import necessary libraries
import itertools
from ansible.module_utils.basic import AnsibleModule
# end import modules
# start defining the functions
def check_current_entry(... |
from typing import Any, List, Optional, Tuple
from flask import current_app, request
from marshmallow import ValidationError
from sqlalchemy import and_, func
from airflow.api.common.experimental.mark_tasks import set_state
from airflow.api_connexion import security
from airflow.api_connexion.exceptions import BadReq... |
import numpy as np
import struct
def readHeaderFile(filestream, pos=None):
params = struct.unpack("iiiiiiiiiiiiiiiiiid", filestream.read(80))
header = {}
header["headersize"] = params[0]
header["numparams"] = params[1]
header["filetype"] = params[2]
header["nx"] = params[3]
header["ny"]... |
import json
import logging
from os.path import join
import pdb
import flask
from flask import Flask
from flask import Flask, helpers, request, session, g, redirect, url_for, abort, \
render_template, flash
import synthesepy.config
import synthesepy.env
from synthesepy import project_manager
from synthesepy.web i... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 20 19:53:40 2017
@author: juan9
"""
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import pickle
import xgboost as xgb
from math import radians, cos, sin, asin, sqrt
import datetime as dt
import json
# Input dat... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import datetime
from dateutil import tz
import calendar
import re
from arrow import locales
class ParserError(RuntimeError):
pass
class DateTimeParser(object):
_FORMAT_RE = re.compile('(YYY?Y?|MM?M?M?|DD?D?D?|HH?|hh?|mm?|ss?|SS... |
from __future__ import print_function
import atpy
import urllib,urllib2
import tempfile
"""
Module to search Splatalogue.net via splat, modeled loosely on
ftp://ftp.cv.nrao.edu/NRAO-staff/bkent/slap/idl/
"""
length_dict = {'meter':1.0,'m':1.0,
'centimeter':1e-2,'cm':1e-2,
'millimeter':1e-3,'mm':1e-3,
... |
from keystone import exception
def check_length(property_name, value, min_length=1, max_length=64):
if len(value) < min_length:
if min_length == 1:
msg = _("%s cannot be empty.") % property_name
else:
msg = (_("%(property_name)s cannot be less than "
"%(m... |
from kombu import Connection
from oslo_config import cfg
from st2common import log as logging
from st2common.util import date as date_utils
from st2common.transport import consumers, reactor
import st2reactor.container.utils as container_utils
from st2reactor.rules.engine import RulesEngine
LOG = logging.getLogger(_... |
from com.googlecode.fascinator.common import FascinatorHome
import sys, os
sys.path.append(os.path.join(FascinatorHome.getPath(), "lib", "jython", "display", "navigation"))
from arms import ARMSNavigation
class NavigationData(ARMSNavigation):
def __activate__(self, context):
self.setup(context) |
import logging
import time
import unittest
from telemetry.core.platform import factory
class PlatformBackendTest(unittest.TestCase):
def testPowerMonitoringSync(self):
# Tests that the act of monitoring power doesn't blow up.
backend = factory.GetPlatformBackendForCurrentOS()
if not backend.CanMonitorP... |
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
# The most useful windows datatypes
from ctypes import *
BYTE = c_byte
WORD = c_ushort
DWORD = 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 uuid
import time
HAS_PB_SDK = True
try:
from profitbricks.client impo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
js_to_json,
parse_iso8601,
parse_filesize,
)
class TagesschauPlayerIE(InfoExtractor):
IE_NAME = 'tagesschau:player'
_VALID_URL = r'https?://(?:www\... |
"""Elpy backend using the Jedi library.
This backend uses the Jedi library:
https://github.com/davidhalter/jedi
"""
import sys
import traceback
import jedi
from elpy import rpc
class JediBackend(object):
"""The Jedi backend class.
Implements the RPC calls we can pass on to Jedi.
Documentation: htt... |
from bot import data as botData # noqa: F401
from .message import Message
from .permissions import ChatPermissionSet, WhisperPermissionSet
from .. import cache # noqa: F401
from .. import database as databaseM # noqa: F401
from bot.twitchmessage import IrcMessageTagsReadOnly
from datetime import datetime
from typing... |
import FreeCAD as App
import FreeCADGui as Gui
from PySide import QtGui, QtCore
import Plot
from plotUtils import Paths
import matplotlib
from matplotlib.lines import Line2D
import matplotlib.colors as Colors
class TaskPanel:
def __init__(self):
self.ui = Paths.modulePath() + "/plotSerie... |
"""
nrburst_wf_plots.py
Produces data for the best matching NR waveforms to the reconstruction
"""
import sys, os
import copy
import subprocess
from optparse import OptionParser
import cPickle as pickle
import timeit
import numpy as np
from matplotlib import pyplot as pl
import triangle
import lal
import pycbc.typ... |
"""Base interface for communicating with USB devices.
This module provides the base classes required to support interfacing with USB
devices through a few different types of USB handles. All handles implement the
UsbHandle interface, which contains Open, Close, Read, and Write functionality.
A UsbHandle object repres... |
try:
from cs import CloudStack, CloudStackException, read_config
has_lib_cs = True
except ImportError:
has_lib_cs = False
# import cloudstack common
from ansible.module_utils.cloudstack import *
class AnsibleCloudStackConfiguration(AnsibleCloudStack):
def __init__(self, module):
super(Ansible... |
# -*- coding: utf-8 -*-
__author__ = 'Sal Aguinaga'
__license__ = "GPL"
__version__ = "0.1.0"
__email__ = "<EMAIL>"
from tweepy import StreamListener, Stream
import pprint as pp
import json, time, sys, csv
from HTMLParser import HTMLParser
import sys, os, argparse
import time, datetime
import pandas as pd
# Notes:... |
import sys
from docs_server_utils import ToUnicode
from file_system import FileNotFoundError
from future import Future
from path_util import AssertIsDirectory, AssertIsFile, ToDirectory
from third_party.json_schema_compiler import json_parse
from third_party.json_schema_compiler.memoize import memoize
from third_party... |
# -*- 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):
# Adding field 'Address.extended_address'
db.add_column(u'address_address', 'extended_address',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = """Co-Pierre Georg (<EMAIL>)"""
import abc
from xml.etree import ElementTree
# -------------------------------------------------------------------------
#
# class Config
#
# -------------------------------------------------------------------------
class Bas... |
"""
Template tags and helper functions for displaying breadcrumbs in page titles
based on the current micro site.
"""
from django import template
from django.conf import settings
from microsite_configuration import microsite
from django.templatetags.static import static
from django.utils.translation import ugettext as... |
import os
import platform
class Platform(object):
"""
Abstract representation of a platform Swift can run on.
"""
def __init__(self, name, archs, sdk_name=None):
"""
Create a platform with the given name and list of architectures.
"""
self.name = name
self.targ... |
import numpy
def smooth(x, window_len=10, window='hanning'):
"""smooth the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal.
The signal is prepared by introducing reflected copies of the signal
(with the window size) in both ends... |
"""
@Desc : This module defines all codes, constants maintained globally \
and used across marvin and its test features.The main purpose \
is to maintain readability, maintain one common place for \
all codes used or reused across test features. It enhances \
maintain... |
"""Module for creating, storing and editing tensors."""
import os
import os.path
import copy
import json
import logging
from utils import marker_cell_identifier
class Tensor(object):
"""Class for managing individual tensors."""
def __init__(self, tensor_id, centroid, marker, creation_type):
self._d... |
#
# File: XCSITPhotonDetectorParameters.py
#
import so
from SimEx.Parameters.AbstractCalculatorParameters import
AbstractCalculatorParameters
from SimEx.Utilities.EntityChecks import checkAndSetInstance
class XCSITPhotonDetectorParameters(AbstractCalculatorParameters):
"""
Datastructure to store the necessary par... |
"""Example using some ring features from the Tutorial"""
from brigD3 import *
# CDS ring DAR4145, default setting CDS
ring_gen = AnnotationRing()
ring_gen.setOptions(color='#565051', name='DAR4145', height=20)
ring_gen.readGenbank('dar4145.gbk')
# Misc Feature ring DAR4145
ring_misc = AnnotationRing()
ring_misc.setO... |
from StringIO import StringIO
from django.test import TestCase
from mock import patch
from core.management.commands import run_docker
from projects.models import Project
from builds.models import Version
class TestRunDocker(TestCase):
'''Test run_docker command with good input and output'''
fixtures = ['te... |
import six
import requests.adapters
from .. import constants
from .npipesocket import NpipeSocket
if six.PY3:
import http.client as httplib
else:
import httplib
try:
import requests.packages.urllib3 as urllib3
except ImportError:
import urllib3
RecentlyUsedContainer = urllib3._collections.RecentlyUs... |
#!/usr/bin/python
# libtoolish hack: compile a .cu file like libtool does
import sys
import os
lo_filepath = sys.argv[1]
o_filepath = lo_filepath.replace(".lo", ".o")
try:
i = o_filepath.rindex("/")
lo_dir = o_filepath[0:i+1]
o_filename = o_filepath[i+1:]
except ValueError:
lo_dir = ""
o_filename = o_... |
import elasticluster
import elasticluster.conf
from elasticluster.__main__ import ElastiCluster
import json
import subprocess
def remove_known_hosts_entry(node, known_hosts_file):
"""For a give node, remove any host key entries in the known_hosts file"""
if not node.preferred_ip:
return False
ip=node.pref... |
import sys
import mock
from oslo.config import cfg
from oslo.db import exception as n_exc
from neutron import context
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
HELEOSAPIMOCK = mock.Mock()
sys.modules["heleosapi"] = HELEOSAPIMOCK
from neutron.services.loadbalancer.drivers.embrane import conf... |
""" This command publish the courses to LMS."""
import logging
import os
from django.core.management import BaseCommand, CommandError
from ecommerce.courses.models import Course
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""Publish the courses to LMS."""
help = 'Publish the courses... |
"""Locale dependent formatting and parsing of numeric data.
The default locale for the functions in this module is determined by the
following environment variables, in that order:
* ``LC_NUMERIC``,
* ``LC_ALL``, and
* ``LANG``
"""
# TODO:
# Padding and rounding increments in pattern:
# - http://www.unicode.org/... |
import json
import os
import pytest
import six
from dcos import config, constants
from .helpers.common import (assert_command, config_set, exec_command,
update_config)
@pytest.fixture
def env():
r = os.environ.copy()
r.update({constants.PATH_ENV: os.environ[constants.PATH_ENV]}... |
"""
Interfaces with Verisure sensors.
For more details about this platform, please refer to the documentation at
documentation at https://home-assistant.io/components/verisure/
"""
import logging
from homeassistant.components.verisure import HUB as hub
from homeassistant.const import TEMP_CELCIUS
from homeassistant.h... |
from __future__ import print_function
import sys
import os
import glob
import shutil
#-------------------------------------------------------------------------------
def removeFiles(filesList):
existingFilesList = filter(os.path.exists,filesList)
map(os.unlink, existingFilesList)
#------------------------------... |
#!/usr/bin/env python
#
# Generated Tue Jan 30 12:32:05 2007 by generateDS.py.
#
import sys
from xml.dom import minidom
from xml.sax import handler, make_parser
import peoplesup as supermod
class peopleSub(supermod.people):
def __init__(self, person=None):
supermod.people.__init__(self, person)
supermod... |
import subprocess as sub
import threading
def single_ssh_cmd(cmd, machine='peanut', connectionTimeout=5):
'''
Executes a single SSH command on the given machine
'''
c = 'ssh -o StrictHostKeyChecking=no'
if connectionTimeout != None:
c += ' -o ConnectTimeout=' + str(connectionTimeout)
c += ' ' + machine + '.cs... |
from __future__ import unicode_literals
from importlib import import_module
from django import VERSION
from django.conf import settings
from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import wraps
def _get_field(model, name):
if VERSION < (1, 8):
re... |
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import (
ObjectDoesNotExist, MultipleObjectsReturned, ValidationError,)
from .model_arguments import QueryArgument
from .inlines import InlineBase, InlineMetaClass, InlineOptions
from .template_inlines... |
from argparse import ArgumentParser
from flexget import options
from flexget.db_schema import plugin_schemas, reset_schema
from flexget.event import event
from flexget.manager import Base, Session
from flexget.terminal import console
def do_cli(manager, options):
with manager.acquire_lock():
if options.d... |
#encoding=utf8
__author__ = 'coofly'
from wox import Wox,WoxAPI
import base64
import pyperclip
class Decoder():
def __init__(self):
pass
def type_header(self):
pass
def type_name(self):
pass
def decode(self, url_body):
pass
class ThunderDecoder(Decoder):
def t... |
"""
Copyright 2016 ElasticBox All rights reserved.
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 License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
from __future__ import print_function
import os
import sys
import ctypes
from ctypes import c_void_p, c_char_p, c_int
from mapproxy.util.lib import load_library
def init_libgdal():
libgdal = load_library(['libgdal', 'libgdal1', 'gdal110', 'gdal19', 'gdal18', 'gdal17'])
if not libgdal: return
libgdal.OG... |
#Use in python (script) as:
# from __future__ import (absolute_import, division, print_function,
# unicode_literals) # python 2 as python 3
# from print_variable_debug import print_variable_debug as var_debug
# print("some_var")
# var_debug(some_var)
from __future__ import (absolute_import, div... |
from .selectorexceptions import SelectorException
def SelectorFactory(classname):
if classname == 'Person':
from .selectperson import SelectPerson
cls = SelectPerson
elif classname == 'Family':
from .selectfamily import SelectFamily
cls = SelectFamily
elif classname == 'Even... |
# myTeam.py
# ---------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (<EMAIL>) and Dan Klein (<EMAIL>).
# For more info,... |
import json
from rest_framework import serializers as ser
from rest_framework import exceptions
from api.base.utils import absolute_reverse
from api.files.serializers import FileSerializer
from api.nodes.serializers import NodeSerializer, NodeProviderSerializer
from api.nodes.serializers import NodeLinksSerializer, No... |
from __future__ import division, absolute_import, print_function
from .common import set_mem_rlimit, run_monitored, get_mem_info
import os
import tempfile
import collections
from io import BytesIO
import numpy as np
try:
from scipy.io import savemat, loadmat
except ImportError:
pass
from .common import Benc... |
'''
Copyright (c) <2012> Tarek Galal <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish,... |
from __future__ import print_function
DEBUG = 0
from struct import unpack
import sys
from .timemachine import *
class XLRDError(Exception):
pass
##
# Parent of almost all other classes in the package. Defines a common "dump" method
# for debugging.
class BaseObject(object):
_repr_these = []
##
# ... |
# Note that this will erase your nvidia cache, ~/.nv/ComputeCache This may or may not be an undesirable side-effect for you. For example, cutorch will take 1-2 minutes or so to start after this cache has been emptied.
from __future__ import print_function, division
import time
import string
import random
import jinj... |
from distutils.cmd import Command
from distutils.errors import *
from oranj.core.interpreter import Interpreter
import traceback
import os, sys
class Test(object):
def __init__(self, tests=None, desc=""):
if not tests: tests = [["", ""]] # Stupid evaluate-once arguments
self.desc = desc
se... |
import logging
import sys
import unittest
from StringIO import StringIO
class OutputCapture(object):
def __init__(self):
self.saved_outputs = dict()
self._log_level = logging.INFO
def set_log_level(self, log_level):
self._log_level = log_level
if hasattr(self, '_logs_handler... |
import expect
from glslc_test_framework import inside_glslc_testsuite
from placeholder import FileShader, StdinShader
@inside_glslc_testsuite('ErrorMessages')
class MultipleErrors(expect.ErrorMessage):
"""Test Multiple error messages generated."""
shader = FileShader('#version 140\nint main() {}', '.vert')
... |
'''
@author: jnaous
'''
from django.db import models
from expedient.common.permissions.models import Permittee, ObjectPermission
from expedient.common.permissions.utils import permissions_save_override,\
permissions_delete_override
from expedient.clearinghouse.aggregate.models import Aggregate
from django.contrib.c... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... |
"""
Two turbine array
=================
A simple two turbine array is positioned in a rectangular channel which experiences a uniform inflow
velocity at the left hand boundary. These turbines act as momentum sinks, since they extract energy
from the system.
The setup corresponds to the 'offset' configuration consider... |
"""!
@brief Output dynamic visualizer
@authors Andrei Novikov (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
import matplotlib.pyplot as plt
from pyclustering.utils import set_ax_param
class canvas_descr:
"""!
@brief Describes plot where dynamic is displayed.
@details Used by... |
import django_filters
from django.core.paginator import Paginator, EmptyPage
from django.shortcuts import render
from django.http import Http404
from django.db.models import Prefetch
from django.utils.translation import ugettext_lazy as N_
from squad.http import auth
from squad.ci.models import TestJob
from squad.core... |
import MySQLdb as mysql
# pylint: disable=no-name-in-module
from pyVmomi import vim
# pylint: enable=no-name-in-module
def run(helper, _options):
# Connect to the database
db = helper.db_connect()
curd = db.cursor(mysql.cursors.SSDictCursor)
helper.event('check_expired', 'Checking for expired VMs')
# Select al... |
# import argparse
import numpy as np
# custom modules
from utils.options import Options
from utils.factory import EnvDict, ModelDict, MemoryDict, AgentDict
# def parse_args():
# parser = argparse.ArgumentParser()
#
# parser.add_argument(
# '--machine',
# type=str,
# default=None,
# ... |
"""Testcode for Android RPC.
To use it, start an RPC tracker with "python -m tvm.exec.rpc_tracker".
Use the tracker's address and port when configuring the RPC app.
Use "android" as the key if you wish to avoid modifying this script.
"""
import tvm
import os
from tvm import rpc
from tvm.contrib import util, ndk
impor... |
# -*- coding: utf-8 -*-
# Scrapy settings for BiggerPockets project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/... |
"""RNN helpers for TensorFlow models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.rnn.python.ops import core_rnn as contrib_rnn
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import rnn
from tensorflow.p... |
import json
from collections import OrderedDict
from django.db import models
from django.core import paginator
from django.utils import six, encoding
from rest_framework import serializers, pagination, metadata, response, exceptions
from rest_framework.fields import SkipField
from jkspy.helpers import dprint
from jkspy... |
import re
from django.urls import include, re_path
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView
from .admin import intr_adm_site
import fo2.views as views
... |
from smart import _
kind = "package"
name = _("APT-DEB Repository")
description = _("""
Repositories created for APT-DEB.
""")
fields = [("baseurl", _("Base URL"), str, None,
_("Base URL of repository, where dists/ is located.")),
("distribution", _("Distribution"), str, None,
_("Dis... |
"""Ce fichier contient la classe Element, détaillée plus bas."""
import inspect
from abstraits.obase import BaseObj
from primaires.objet.objet import MethodeObjet
class Element(BaseObj):
"""Cette classe contient un élément construit sur un type d'élément.
Petite subtilité : la méthode __getattr__ a été red... |
from datetime import date
from django.contrib.auth.models import Group
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import OperationalError
from elearning.models import UserELearning, Subject, Course, Enrollment, AssignmentGroup, Assignment, Stude... |
"""
Helpers to interact with the ERFA library, in particular for leap seconds.
"""
from datetime import datetime, timedelta
from warnings import warn
import numpy as np
from astropy.utils.decorators import classproperty
from astropy.utils.exceptions import ErfaWarning
from .ufunc import get_leap_seconds, set_leap_se... |
import re
from oslo_log import log
from manila.i18n import _LI
LOG = log.getLogger(__name__)
class WindowsUtils(object):
def __init__(self, remote_execute):
self._remote_exec = remote_execute
self._fsutil_total_space_regex = re.compile('of bytes *: ([0-9]*)')
self._fsutil_free_space_reg... |
import threading
import SocketServer
import socket
from xbmc import Monitor
from resources.lib.kodihelper import KodiHelper
from resources.lib.WidevineHTTPRequestHandler import WidevineHTTPRequestHandler
# helper function to select an unused port on the host machine
def select_unused_port():
sock = socket.socket(s... |
'''
@author: yixin.wang
For bug ZSTAC-21094
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.resource_operations as res_... |
try:
from rediscluster import RedisCluster
except ImportError:
RedisCluster = None
import cPickle
from shinken.basemodule import BaseModule
from shinken.log import logger
properties = {
'daemons': ['scheduler'],
'type': 'redis_cluster_retention',
'external': False,
}
def get_instance(plugin)... |
""" graph.py: This file is part of the feyncop/feyngen package.
Implements the Graph class. """
# See also: http://people.physik.hu-berlin.de/~borinsky/
__author__ = "Michael Borinsky"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2014 Michael Borinsky"
__license__ = "MIT License"
__version__ = "1.0"
# C... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = r'''
---
module: vmware_host_vmnic_facts
short_description: Gathers facts about vmnics available on th... |
# import tweepy
import json
from tweepy import OAuthHandler, Stream, API #import handler
from tweepy.streaming import StreamListener #import a class
consumer_key = 'whndeJiLln26BoRNeavlLSPoF'
consumer_secret = 'Kaw6qo7EwyWtC0ZSVQCYJ28GjAetH6EUMZGSCHWWgHp4nic8EN'
access_token = '50491256-C47HUO0RRLCGVBFxkVsIY3tw9oEY... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from regressiontests.string_lookup.models import Foo, Whiz, Bar, Article, Base, Child
class StringLookupTests(TestCase):
def test_string_form_referencing(self):
"""
Regression test for #1661 and #1662
Check that string form referenc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.