content stringlengths 4 20k |
|---|
"""
Version information
"""
__version__ = "2.1.1" |
import os
import mock
from rally.common.io import subunit_v2
from tests.unit import test
class SubunitParserTestCase(test.TestCase):
fake_stream = os.path.join(os.path.dirname(os.path.abspath(__file__)),
"subunit_v2.stream")
def test_parse_file(self):
result = subunit... |
import pprint
import requests
from bs4 import BeautifulSoup, Comment
import re
def getRecord(rollNo):
roll = str(rollNo)
req = requests.get('https://oa.cc.iitk.ac.in/Oa/Jsp/OAServices/IITk_SrchRes.jsp?typ=stud&numtxt=' + roll + '&sbm=Y')
soup = BeautifulSoup(req.text,"lxml")
record = {}
record['r... |
import pygame
from ui.container import Container
from ui.layout.borderlayout import BorderLayout
from ui.factory import Factory
from util.keys import GO_LEFT_PAGE, GO_RIGHT_PAGE, USER_EVENT_TYPE, SUB_TYPE_KEYBOARD, SELECT_EVENT_TYPE
from util.cache import Cache
from ui.layout.multilinebuttonlayout import MultiLineButt... |
from __future__ import absolute_import
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from sentry.models import AuditLogEntry, AuditLogEntryEvent
from sentry.testutils import APITestCase
class OrganizationAuditLogsTest(APITestCase):
def test_simple... |
import numpy as np
from VariableUnittest import VariableUnitTest
from gwlfe.MultiUse_Fxns.Erosion import AvStreamBankEros
class TestAvStreamBankEros(VariableUnitTest):
def test_AvStreamBankEros(self):
z = self.z
np.testing.assert_array_almost_equal(
AvStreamBankEros.AvStreamBankEros_... |
# -*- 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 'FeaturedAuthor'
db.create_table(u'vpw_featuredauthor', (
... |
import datetime
import json
import base64
import logging
import os
import httplib
from protorpc import remote
from grow.common import config
from grow.server import messages
from grow.pods.collectionz import collectionz
from grow.pods.collectionz import documents
from grow.pods import files
from grow.pods import pods
f... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.views.generic import create_update, list_detail
from models import ShortURL
import views
## creator view
shortim_create = url(
r'^$',
views.create,
name='shortim_create',
)
## creator view (api version)
shortim_api_create = url(
... |
import brian_no_units
from brian.units import *
from brian.group import *
import time
import scipy.signal as sg
import scipy.stats as stats
import numpy as np
from brian.stdunits import *
from brian.network import run, Network, network_operation
from brian.connections.connection import Connection
from brian.directcontr... |
"""
This module provides a class that can be used as a base class to
create esipice sub-circuits.
Classes:
Subckt -- Base calss used to define a sub-circuit.
"""
import mutex
_subcktCnt = 0
class Subckt(list):
"""
Is used as a base class that is inherited by User Defined a
sub-circuit. Similar to a subckt in Be... |
__author__ = 'Dmitry Golubkov'
__email__ = '<EMAIL>'
import sys
import traceback
import logging
import json
import time
from helpers import Singleton, AsyncRequest
from django.conf import settings
def get_exception_string():
ex_info = sys.exc_info()
ex_string = traceback.format_exception_only(*ex_info[:2])[-... |
"""
GUI-specific interface functions for Google Chrome on Microsoft Windows.
"""
__revision__ = "$Rev: 3053 $"
__date__ = "$Date: 2008-09-03 13:02:38 +0530 (Wed, 03 Sep 2008) $"
__author__ = "$Author: johann $"
import os
import time
import win32gui
import win32con
from win32com.shell import shellcon
from win32com.she... |
import requests
import jsbeautifier
import re
import os
from ImageDownloader import ImageDownloader
import sys, time
class ChapterDownloader:
def __init__(self, taskQueue, proxy=None):
# threading.Thread.__init__(self)
self.__chWork = None
self.__baseURL = "http://www.dm5.com"
self... |
from evdev import InputDevice, categorize, ecodes
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.OUT)
dev = InputDevice('/dev/input/event2')
code=[304,305,103,108,105,106,407,412,316,257,258]
ref=['Touche A','Touche B','Touche Haut','Touche Bas','Touche Gauche','Touche Droite','Touche +','T... |
from nova.objects import base as obj_base
from nova.objects import fields
from nova import utils
class NetworkRequest(obj_base.NovaObject):
# Version 1.0: Initial version
# Version 1.1: Added pci_request_id
VERSION = '1.0'
fields = {
'network_id': fields.StringField(nullable=True),
'ad... |
from init_instantiation_data import *
include_files = []
data = Instantiation(include_files)
(f, inst) = (data.file_output, data.inst)
sub_dim_members = []
classes = []
templated_functions = []
for x in inst.sub_mapping_dims:
cl = 'GridFunction<%d,%d>' %(x.dim,x.space_dim)
classes.append(cl)
for fun i... |
import inspect
import pytest
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from astropy import units as u
from astropy.wcs import WCS
from astropy.nddata.nddata import NDData
from astropy.nddata.decorators import support_nddata
class CCDData(NDData):
pass
@support_nddata
def wrap... |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.slugify
~~~~~~~~~~~~~~~~~~~~
Provides functions for slugifying text.
Examples:
basic usage::
>>> from riko.modules.slugify import pipe
>>>
>>> next(pipe({'content': 'hello world'}))['slugify'] == 'hello-world'
True... |
"""The tests for the analytics ."""
from homeassistant.components.analytics.const import ANALYTICS_ENDPOINT_URL, DOMAIN
from homeassistant.setup import async_setup_component
async def test_setup(hass):
"""Test setup of the integration."""
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
awai... |
import copy
import rdtest
import renderdoc as rd
class GL_Vertex_Attr_Zoo(rdtest.TestCase):
demos_test_name = 'GL_Vertex_Attr_Zoo'
def check_capture(self):
action = self.find_action("Draw")
self.check(action is not None)
self.controller.SetFrameEvent(action.eventId, False)
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import re
import sys
import inspect
import warnings
import argparse
from flask import Flask
from ._compat import text_type, iteritems, imap, izip
from .commands import Group, Option, InvalidCommand, Command, Server, Shell
from .cli import prom... |
import pyspark
SC = pyspark.SparkContext()
def simple_textFile():
print(SC.textFile('tests/test_simple.py').collect())
print(SC.textFile('tests/test_simple.py').name())
print(SC.parallelize([1, 2, 3]).name())
def indent_line(l):
print('============== INDENTING LINE ================')
return '--... |
#DB_HOST = 'hal9000'
#DB_USER = 'schudoma'
#DB_PASS = 'passwordpasswor'
#DB_NAME = 'trost_prod'
#DB_HOST = 'localhost'
#DB_USER = 'root'
#DB_PASS = 'password'
#DB_NAME = 'trost_prod_reimport'
DB_HOST = 'cosmos'
DB_USER = 'billiau'
DB_PASS = 'password'
DB_NAME = 'trost_prod'
#DB_HOST = 'hal9000'
#DB_USER = 'billiau'
... |
# -*- coding:utf-8 -*-
import os
from flask import current_app
DEBUG = True
CAPTCHA_FONT_PATH = os.path.normpath(os.path.join(os.path.dirname(__file__), 'fonts/Vera.ttf'))
CAPTCHA_FONT_SIZE = 22
CAPTCHA_LETTER_ROTATION = (-35, 35)
CAPTCHA_BACKGROUND_COLOR = '#ffffff'
CAPTCHA_FOREGROUND_COLOR = '#001100'
CAPTCHA_CHAL... |
#!/usr/bin/env python3
import os, os.path
import sys, subprocess
import shutil
configure_args = sys.argv[1:]
x64 = True
while len(configure_args) > 0:
arg = configure_args[0]
if arg == '--64':
x64 = True
elif arg == '--32':
x64 = False
else:
break
configure_args.pop(0)
i... |
from datetime import date
import pytest
from django.core.management import call_command
from timed.employment.factories import UserFactory
from timed.projects.factories import ProjectFactory, TaskFactory
from timed.tracking.factories import ReportFactory
@pytest.mark.freeze_time("2017-8-4")
@pytest.mark.parametrize... |
"""3D Projective Geometric Algebra.
Written by a generator written by enki.
"""
__author__ = 'Enki'
import math
class PGA3D:
def __init__(self, value=0, index=0):
"""Initiate a new PGA3D.
Optional, the component index can be set with value.
"""
self.mvec = [0] * 16
... |
# -*- coding: utf-8 -*-
"""dynamically add the classes for definition representations.
Most of the endpoint groups have some definitions that apply. These are
in the definitions package. It is conveniant to have access by a class
representing a specific group of definitions instead of a dictionary.
"""
import sys
from... |
from django.core.urlresolvers import reverse
from django import http
from mox import IsA # noqa
from openstack_horizon import api
from openstack_horizon.test import helpers as test
INDEX_URL = reverse(
'horizon:project:data_processing.data_plugins:index')
DETAILS_URL = reverse(
'horizon:project:data_proces... |
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.test import *
from test.zblog import mappers, tables
from test.zblog.user import *
from test.zblog.blog import *
class ZBlogTest(TestBase, AssertsExecutionResults):
@classmethod
def create_tables(cls):
tables.metadata.drop_all(bind... |
import pytest
import libqtile.manager
import libqtile.config
from libqtile import layout, bar, widget
from libqtile.config import Screen
LEFT_ALT = 'mod1'
WINDOWS = 'mod4'
FONTSIZE = 13
CHAM1 = '8AE234'
CHAM3 = '4E9A06'
GRAPH_KW = dict(line_width=1,
graph_color=CHAM3,
fill_color=CHAM3 ... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import autoslug.fields
import bitfield.models
import courselib.conditional_save
import courselib.json_fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Combi... |
#!/usr/bin/python
"""
skeleton code for k-means clustering mini-project
"""
import pickle
import numpy
import matplotlib.pyplot as plt
import sys
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
def Draw(pred, features, poi, mark_poi=False, name="image.png", f1_n... |
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
import numpy as np
import pandas as pd
"""
This file contains the TF implementation of the Restricted Boltzman Machine
"""
# This function lets us easily sample from a vector of probabilities
def sample(probs):
# Takes in a vector of... |
import pycparser
from pycparser import c_generator
import sys
import os
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
if sys.platform == 'win32' and not program.endswith(".exe"):
program += ".exe"
fpath, fname = os.path.split(program)
if fpath:
... |
import re
from setuptools import setup
test_suite = "tests"
tests_require = ["mongo-orchestration>= 0.6.7, < 1.0", "requests>=2.5.1", "testing.postgresql>=1.3.0"]
try:
with open("README.rst", "r") as fd:
long_description = fd.read()
except IOError:
long_description = None # Install without README.rst... |
"""
Basic nfs support for Linux host. It can support the remote
nfs mount and the local nfs set up and mount.
"""
import re
import os
import logging
from autotest.client import os_dep
from autotest.client.shared import utils, error
from virttest import utils_misc
try:
from autotest.client.shared import service
exc... |
import unittest
import numpy as np
import sys
#sys.path.append('..')
sys.path = ['..'] + sys.path
#sys.path = ['..']
from roppy.fluxsec import staircase_from_line
# A synthetic grid object for testing
class MyGrid(object):
def __init__(self):
imax = 20
jmax = 16
# Depth = constant = 10... |
import numpy
import pytest
from qualipy.filters.exposure import *
OVER_EXPOSED_IMAGE = 'tests/images/over_exposure_sample.jpg'
UNDER_EXPOSED_IMAGE = 'tests/images/under_exposure_sample.jpg'
GOOD_IMAGE = 'tests/images/exposure_sample_good.jpg'
def test_normalized_clipping_percentage_for_black_image():
img = num... |
""" Tests for distribution util functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v2 as tf
from official.utils.misc import distribution_utils
class GetDistributionStrategyTest(tf.test.TestCase):
"""Tests for get_dis... |
"""
test.test_election
~~~~~~~~~~~
Test election code.
"""
import eventlet
import logging
import mock
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import calico.test.stub_etcd as stub_etcd
from calico.test.stub_etcd import NoMoreResults
import calico.election ... |
'''
Created on 29.04.2015
@author: arne
'''
import unittest
class Test(unittest.TestCase):
def testName(self):
if 0:
from mouser_api.core import Mouser_api
mouser = Mouser_api('RC0402FR-071M2L',1,0)
page= mouser.getPage()
# with open("farnell_MC0402B104K16... |
""""
Script to import the set of MSRA-TD500 training/testing data into the rigor testing framework.
http://www.iapr-tc11.org/mediawiki/index.php/MSRA_Text_Detection_500_Database_(MSRA-TD500)
"""
from rigor.importer import Importer
import os
import glob
import string
import math
import copy
kExcludeHard = False
kDataTy... |
from dynamics.dynamics.turbine_governors.turbine_governor import TurbineGovernor
from google.appengine.ext import db
# >>> imports
class GovHydroR(TurbineGovernor):
# <<< gov_hydro_r.attributes
# @generated
# >>> gov_hydro_r.attributes
# <<< gov_hydro_r.references
# @generated
# >>> gov_hyd... |
"""Pytests for the core module molecules.
"""
import unittest
import weakref
from mollib.core import Molecule
aminoacids = {'ALA', 'GLY', 'SER', 'THR', 'MET', 'CYS', 'ILE', 'LEU',
'VAL', 'PHE', 'TYR', 'TRP', 'ASN', 'GLN', 'ASP', 'GLU',
'HIS', 'PRO', 'ARG', 'LYS'}
def test_get_weakrefs(... |
import os, sys
from twisted.internet import gtk2reactor
try:
gtk2reactor.install()
except:
pass
import pygtk
from twisted.internet import reactor
pygtk.require("2.0")
import gtk
import gobject
from pkg_resources import resource_string
class AddChannelGui(object):
def __init__(self,func,name=None,loca... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Zip Tools
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import base64, re, urllib, string, sys, zipfile, os, os.path
import ... |
from openerp import api, models, fields
class WizardReportGeneralLedger(models.TransientModel):
_name = "account.wizard_report_general_ledger"
_description = "Wizard Report General Ledger"
@api.model
def _default_company_id(self):
return self.env.user.company_id.id
@api.model
def _de... |
#!/usr/bin/python3
import tornado.log
from tornado import gen
import hashlib
import dicttoxml
import xmltodict
from settings import TMAPI
ORDER_STATES = {
'order_created': ('Создан', 1, ),
'order_aborted': ('Прекращён', 5, ),
'order_completed': ('Выполнен', 4, ),
'order_client_in_car': ('Клиент в маши... |
# -*- coding: utf-8 -*-
from raiden.encoding.format import Field, namedbuffer
from raiden.encoding.encoders import integer
# pylint: disable=invalid-name
byte = Field('byte', 1, 'B', None)
hugeint = Field('huge', 100, '100s', integer(0, 2 ** (8 * 100)))
SingleByte = namedbuffer('SingleByte', [byte])
HugeInt = namedbu... |
"""
File tests.
"""
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import os
import unittest
#-------------------------------------------------------------------------
#
# Gramps module... |
# project/tests/test_auth.py
import json
import time
from project import db
from project.api.models import User
from project.tests.base import BaseTestCase
from project.tests.utils import add_user
class TestAuthBlueprint(BaseTestCase):
def test_user_registration(self):
with self.client:
re... |
# -*- coding: utf-8 -*-
import os,math
from qgis.core import NULL
from mole import oeq_global
from mole.project import config
from mole.extensions import OeQExtension
from mole.stat_corr import rb_contemporary_base_uvalue_by_building_age_lookup
def calculation(self=None, parameters={},feature = None):
from math i... |
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from io import BytesIO
import mock
import multiprocessing
import numpy as np
import re
import os
import pandas as pd
import pytest
import random
import shutil
from string import ascii_lowercase # pylint: disable=deprecated-module
impo... |
"""Starter script for the Solum Deployer service."""
import logging as std_logging
import os
import sys
from oslo_config import cfg
from solum.common.rpc import service as rpc_service
from solum.common import service
from solum.deployer.handlers import heat as heat_handler
from solum.deployer.handlers import noop as... |
########################################################################################
# Adapted from: #
# Davi Frossard, 2016 #
# VGG16 implementation in TensorFlow ... |
from setuptools import setup
DESCRIPTION = "NoseGAE: nose plugin for Google App Engine testing"
VERSION = '0.5.10'
setup(
name='NoseGAE',
version=VERSION,
author="Jason Pellerin",
author_email="<EMAIL>",
maintainer="Josh Johnston",
maintainer_email="<EMAIL>",
description=DESCRIPTION,
... |
import sys
import unittest
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder
from pyasn1.type import char
from pyasn1.type import namedtype
from pyasn1.type import univ
from pyasn1_modules import pem
from pyasn1_modules import rfc5652
from pyasn1_modules import rf... |
"""
Parser for the omero.properties file to generate RST
mark up.
"""
HEADER_MAPPING = {
"data": "Core",
"db": "Core",
"cluster": "Grid",
"grid": "Grid",
"checksum": "FS",
"fs": "FS",
"managed": "FS",
"ldap": "LDAP",
"sessions": "Performance",
"threads": "Performance",
"thro... |
from subprocess import PIPE, Popen, call
import os
import logging
from cmdsignature.parser import CmdSignatureParser
def runCommand(cmd):
#cmd = cmd.split(' ')
process = Popen(cmd, stderr=PIPE, stdout=PIPE, shell=True)
stdout, stderr = process.communicate()
rt = process.returncode
return stdout, stderr, rt
def ... |
from connection import Connection
import threading
from subprocess import Popen, PIPE
class StateClient(threading.Thread):
def __init__(self, ownId, ownName=None, host=None, port=None):
self.api_version="v3"
print ownId, ownName, host, port
self.eventq = []
self.e... |
# encoding: UTF-8
# Comments #
############
# Import #
##########
import re
import logging
import token
import wiki
import messages
from pprint import pprint
import time
# Variables #
#############
history = []
# Functions #
#############
# Starts the comments module
def start(data,msg,r):
logging.debug("Starti... |
import time
import threading
import random
import pygame
import Level
import Keyboard
import namepicker
import Player
import Tile
import RobotAI
"""Called when the game closes to remove level.player from server"""
def quitGame():
client.disconnect()
"""Called 60 times a second. Updates the games logic"""
def ... |
from cr8 import cli
from cr8.cli import dicts_from_stdin, lines_from_stdin, dicts_from_lines
from doctest import DocTestSuite
from unittest import TestCase, main
from unittest.mock import patch
import io
class CliTest(TestCase):
@patch('sys.stdin',
new_callable=lambda: io.StringIO('{"name": "n1"}\n{"n... |
"""
Drivers for working with different providers
"""
__all__ = [
'abiquo',
'brightbox',
'bluebox',
'dimensiondata',
'dummy',
'ec2',
'ecp',
'elasticstack',
'elastichosts',
'cloudsigma',
'gce',
'gogrid',
'hostvirtual',
'linode',
'opennebula',
'rackspace',
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import filer.fields.file
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0001_initial'),
('filer', '0001_initial'),
]
operations = [... |
import gtk, plugins, os, time, stat
from .. import guiplugins
from ordereddict import OrderedDict
# pwd and grp doesn't exist on windows ...
try:
import pwd, grp
except ImportError:
pass
class FileProperties:
def __init__(self, path):
self.abspath = path
self.filename = os.path.basename(se... |
########################################################################
# File: MetaQuery.py
# $HeadID$
########################################################################
""" Utilities for managing metadata based queries
"""
__RCSID__ = "$Id$"
from DIRAC import S_OK, S_ERROR
import DIRAC.Core.Utilities.Time a... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google import auth # type: ignore
from google.auth import credentials # type: ignore
from google.auth.transport.grpc import S... |
#! python3
"""Calculate product
Uses :py:mod:`time` to profile a function that calculates the product of the first 100,000 numbers.
Note:
* Added :py:mod:`cProfile` for an execution profile. Does add overhead, so not suitable
for benchmarking.
* Added :py:mod:`timeit` for accurate execution timing.
"""... |
import contextlib
import copy
from debtcollector import moves
from debtcollector import removals
from neutron_lib import exceptions
from oslo_config import cfg
from oslo_db import api as oslo_db_api
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import enginefacade
from oslo_log import log as logging
... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, HiddenField, IntegerField, BooleanField, TextAreaField, DateTimeField, validators
class LoginForm(FlaskForm):
mail = StringField('mail', validators=[validators.DataRequired()])
password = PasswordField('Password', validators=[valid... |
'''
Created on Jun 2, 2015
@author: Daniil Sorokin<<EMAIL>>
'''
import codecs, math, argparse, os
from nltk.tokenize import regexp_tokenize
from nltk.stem import SnowballStemmer, WordNetLemmatizer
from nltk.tag import pos_tag
from collections import defaultdict
from compose_corpus import DocumentCorpus, get_document_c... |
"""
The Documents menu.
"""
from __future__ import unicode_literals
from PyQt4.QtGui import QAction, QActionGroup, QIcon, QMenu
import app
import icons
import plugin
import engrave
import documenticon
class DocumentMenu(QMenu):
def __init__(self, mainwindow):
super(DocumentMenu, self).__init__(mainwind... |
nick_names = {
"al": "albert",
"andy": "andrew",
"tony": "anthony",
"art": "arthur",
"arty": "arthur",
"alex": "alexander",
"bernie": "bernard",
"bern": "bernard",
"charlie": "charles",
"chuck": "charles",
"danny": "daniel",
"dan": "daniel",
"don": "donald",
"ed":... |
from nova import config
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import policy_fixture
from nova import utils
CONF = config.CONF
class TestBootFromVolume... |
"""
Utility tools
"""
import urllib as _urllib
class HTTPError(IOError):
def __init__(self, code, msg, headers):
IOError.__init__(self, 'HTTP error', code, msg, headers)
def __str__(self):
return "HTTP: %d %s" % (self.args[1], self.args[2])
class MyURLOpener(_urllib.FancyURLopener):
vers... |
# -*- coding: utf8 -*-
import sqlibrist
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='sqlibrist',
version=sqlibrist.VERSI... |
import warnings
from ..constants import Constants
from ..compatpatch import ClientCompatPatch
class MiscEndpointsMixin(object):
"""For miscellaneous functions."""
def sync(self, prelogin=False):
"""Synchronise experiments."""
if prelogin:
params = {
'id': self.gene... |
# file: runme.py
import example
# Try to set the values of some global variables
example.cvar.ivar = 42
example.cvar.svar = -31000
example.cvar.lvar = 65537
example.cvar.uivar = 123456
example.cvar.usvar = 61000
example.cvar.ulvar = 654321
example.cvar.scvar = -13
example.cvar.ucvar = 251
example.cvar.cvar = "S"
exa... |
"""
Visualize Genetic Algorithm to find the shortest path for travel sales problem.
Visit my tutorial website for more: https://morvanzhou.github.io/tutorials/
"""
import matplotlib.pyplot as plt
import numpy as np
START_POINT = list(input("請輸入起始點"))
PASS_POINT = input("輸入要經過的點")
PASS_POINT = PASS_POINT.split(" ")
#... |
"""Tests for tensorflow.ops.argmax_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class ArgMaxTest(tf.test.TestCase):
def _testArg(self, method, x, dimension,
expected_values, use_gpu=Fals... |
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class Department(models.Model):
_name = "hr.department"
_description = "Department"
_inherit = ['mail.thread']
_order = "name"
_rec_name = 'complete_name'
name = fields.Char('Department Name', required=True)
... |
"""GSIFTP module based on the GFAL2_StorageBase class."""
# from DIRAC
from DIRAC.Resources.Storage.GFAL2_StorageBase import GFAL2_StorageBase
from DIRAC import gLogger
from DIRAC.Core.Utilities.Pfn import pfnparse, pfnunparse
class GFAL2_GSIFTPStorage( GFAL2_StorageBase ):
""" .. class:: GFAL2_GSIFTPStorage
G... |
from nose.tools import assert_equals
from rdflib import (ConjunctiveGraph as Graph, URIRef, Literal, BNode,
Namespace, RDF)
from oort.rdfview import (RdfQuery, one, each, one_where_self_is,
each_where_self_is, collection, localized, i18n_dict, each_localized,
localized_xml, Sorter, Filter, run_q... |
{
'name': 'Project task dates control',
'version': '0.007',
'category': 'Customizations',
'sequence': 38,
'complexity': 'easy',
'description': ''' This module allows to define the type of project stages.\n
When a task is moved to an initial stage the task starting date is set automatically, and ... |
from abc import ABC, abstractmethod
class Figura(ABC):
@abstractmethod
def calcular_area(self):
pass
class Rectangulo(Figura):
def __init__(self, base, altura):
self.base = base
self.altura = altura
def calcular_area(self):
return self.base * self.altura
class Calcula... |
"""
implementations of basic commands to execute on a YubiHSM
"""
# Copyright (c) 2011-2014 Yubico AB
# See the file COPYING for licence statement.
import struct
__all__ = [
# constants
# functions
# classes
'YHSM_Cmd_Echo',
'YHSM_Cmd_System_Info',
'YHSM_Cmd_Random',
'YHSM_Cmd_Random_Rese... |
'''
Autor: Gurkirt Singh
Start data: 15th May 2016
purpose: of this file is read frame level predictions and process them to produce a label per video
'''
from sklearn.svm import LinearSVC,SVC
from sklearn.ensemble import RandomForestClassifier
import numpy as np
import pickle
import os,h5py
import time,json
#import p... |
import argparse
import fnmatch
import json
import os
import re
import urllib2
# Strips C and C++ comments from the given string.
#
# Copied from http://stackoverflow.com/a/241506/627587.
def strip_comments(text):
def replacer(match):
s = match.group(0)
if s.startswith('/'):
return " " ... |
from collections import namedtuple
from unittest import mock
from .. import *
from bfg9000.languages import known_langs
from bfg9000.tools import c_family
MockPlatform = namedtuple('MockPlatform', ['family'])
class MockEnv:
def __init__(self, *args, host_platform='posix', **kwargs):
self.host_platform ... |
from .fetchers import NUMetadatasFetcher
from .fetchers import NUVirtualIPsFetcher
from .fetchers import NUGlobalMetadatasFetcher
from .fetchers import NUVPortsFetcher
from .fetchers import NUEventLogsFetcher
from bambou import NURESTObject
class NURedirectionTarget(NURESTObject):
""" Represents a Redire... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.common import Backend
from lib.core.common import Format
from lib.core.common import hashDBWrite
from lib.core.data import kb
from lib.core.data impor... |
from HeaderFieldHandler import HeaderFieldHandler
from SCException import SCNotImplemented
import To
class Referto (To.To, HeaderFieldHandler):
# __init__ , parse and create are inherited from To
def verify(self):
raise SCNotImplemented("Referto", "verify", "not implemented") |
"""Tests for the notebook manager."""
import os
from unittest import TestCase
from tempfile import NamedTemporaryFile
from IPython.utils.tempdir import TemporaryDirectory
from IPython.utils.traitlets import TraitError
from IPython.frontend.html.notebook.notebookmanager import NotebookManager
class TestNotebookManag... |
"""Discord bot automation cog."""
import json
import aiohttp
from discord.ext import commands
from .bot import APIconnectionError
from .tools import load_params, make_embed_message
class Automation:
"""Class used in AutomaBot to make everything related to automation."""
def __init__(self, filename, bot):
... |
#!/usr/bin/env python
# -*- coding: iso-8859-2 -*-
import gobject
import gtk
from common import *
import common; _ = common._
import singletons
from StoreRow import *
class PackageView(StoreRow):
"""This class represents the package view widget."""
LISTING_MODE_FLAT = 0
LISTING_MODE_CATEGORY = 1
LIST... |
import collections
import csv
import json
import logging
import optparse
import os
import shutil
import signal
import socket
import tempfile
import time
import urllib
import urllib2
import urlparse
import zipfile
from StringIO import StringIO
from httplib import BadStatusLine
from itertools import izip
import eventlet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.