content string |
|---|
#!/usr/bin/python2.7
#!-*-encoding=utf8-*-
import os
import os.path
def print_format(interface_set):
pass
def get_project_interface(project, func_prefix, is_reverse=False):
def get_subfiles(srcdir = None):
filelist= []
def process_dir(arg, dirname, names):
for name in names:
name_path = "{... |
import urllib.request
from bs4 import BeautifulSoup
from bs4 import element
from algo.speech_synthesizer import SpeechSynthesizer
from devices.console import Console
from devices.speakers import Speakers
from plugins.plugin import Plugin
class Anecdote(Plugin):
def __init__(self, parent=None):
super().__... |
import os, binascii, inspect
def random_string(count=6):
return binascii.b2a_hex(os.urandom(count))
def overload(o, s, v, pushing=False, push_branch='__pushed'):
''' Push support moves an existing
branch to a new node before an object is written
called __push '''
split = s.split('.')
obj = o
... |
#!/bin/python3
# -*-coding:utf-8 -*
import curses;
from .Creature import Creature;
"""A module containing the Player class"""
class Player(Creature):
"""The Player class"""
def __init__(self, env, y, x):
"""Constructor"""
super(Player, self).__init__(env, y, x, 'ſ', 4, 1);
self.score = 0;
self.possible... |
"""The datastore models for graph data.
The Chromium project uses Buildbot to run its performance tests, and the
structure of the data for the Performance Dashboard reflects this. Metadata
about tests are structured in Master, Bot, and TestMetadata entities. Master and
Bot entities represent Buildbot masters and build... |
# coding: utf-8
from __future__ import division, unicode_literals
from datetime import datetime
from os.path import dirname, join
from bottle import Bottle, debug, request, response, view, TEMPLATE_PATH
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import StaticPool
from test.functi... |
# -*- coding: utf-8 -*-
import logging
import requests
import re
from urllib import urlencode
from urlparse import urljoin
from collections import namedtuple
from BeautifulSoup import BeautifulSoup as BS
Film = namedtuple('Film', ['title', 'mubi_id', 'artwork', 'metadata'])
Metadata = namedtuple('Metadata', ['d... |
from __future__ import print_function
#!/usr/bin/env python
'''
Get the space group for a ListOfAtoms
can be called as a script on a netcdf file
sgroup.py [-f] ncfile
http://cpc.cs.qub.ac.uk/summaries/ADON.html
PROGRAM SUMMARY [Licence| Download | E-mail] adon.tar.gz(69 Kbytes)
Manuscript Title: Determination of ... |
import re
import sys
# Copyright
# =========
# Copyright (C) 2016 Trustwave Holdings, Inc.
#
# 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, either version 3 of the License, or
# (at your optio... |
from __future__ import with_statement
from pysqlite2 import dbapi2 as sqlite3
from datetime import datetime, timedelta
import time
def read_modify_write():
# Open connection and create example schema and data.
# In reality, open a database file instead of an in-memory database.
con = sqlite3.connect(":memo... |
"""A script for syncing a Git repository to a Subversion repository.
See help text below for usage.
"""
import filecmp
import os
import subprocess
import sys
def SyncPath(git_base, svn_base, diff):
"""Synchronizes the Git repository to the SVN repository using the diff.
Given two paths and a filecmp.dircmp obj... |
import fnmatch
import os
import sys
import fabric
import mock
import shotgun.config
import shotgun.driver
import shotgun.settings
from shotgun.test import base
class RunOut(object):
return_code = None
stderr = None
stdout = None
def __str__(self):
return str(self.stdout)
class TestDriver(... |
# Module name: SimAGN
# Class: Elp
# Class: Flux
# Functions
# 1. Calc_Tb
# 2. SimpleSim
# 3. GenMultiFRs
import numpy as np
import PIL.Image as Image
import pyfits
import matplotlib.pyplot as plt
# define Elliptical lobe and core class
class Elp:
def __init__(self):
self.Center = np.zeros((2,))
s... |
# -*- coding: utf-8 -*-
"""User forms."""
from __future__ import absolute_import
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired, Email, EqualTo, Length
from scanlation_cms.user.models import User
class RegisterForm(Form):
"""Register form.""... |
from __future__ import print_function, division, absolute_import
import numpy as np
import tensorflow as tf
from tensorflow.contrib import slim
from data import load_data
import edward as ed
from edward.models import (Categorical, InverseGamma, Mixture,
MultivariateNormalDiag, Normal, Uniform)
# ===============... |
from distutils.version import LooseVersion
import pytest
from _pytest.doctest import DoctestItem
import logging
from joblib.parallel import mp
try:
import lz4
except ImportError:
lz4 = None
try:
from distributed.utils_test import loop, loop_in_thread
except ImportError:
loop = None
loop_in_thread ... |
"""Module containing the base controller class."""
# Imports
import pygame as pg
from mvctools.common import xytuple
# Base controller class
class BaseController(object):
"""Base controller class for the MVC pattern implementation.
Shouldn't be instanciated manually but
subclassed then registered in a S... |
from __future__ import absolute_import, division, print_function, unicode_literals
from hashlib import sha1
from pants.backend.python.python_requirement import PythonRequirement
from pants.base.payload_field import (ExcludesField, FingerprintedField, FingerprintedMixin,
JarsField... |
"""Generate docs for the TensorFlow Python API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import inspect
import os
import sys
import tensorflow as tf
from tensorflow.python import debug as tf_debug
from tensorflow.tools.docs impor... |
import re
import sys
import traceback
import logging
import platform
import subprocess
import datetime
try:
from collections import OrderedDict
except ImportError:
# python 2.6 or earlier, use backport
from ordereddict import OrderedDict
__all__ = [
'quick_regexp', 'print_', 'get_dict_keys_by_value',
... |
import time
import socket
import struct
import urlparse
import select
import utils
from xlog import getLogger
xlog = getLogger("x_tunnel")
import global_var as g
import proxy_session
def netloc_to_host_port(netloc, default_port=80):
if ":" in netloc:
host, _, port = netloc.rpartition(':')
port =... |
"""
parse_connection test.
"""
import os
import mutlib
from mysql.utilities.exception import MUTLibError, FormatError
from mysql.utilities.common.ip_parser import parse_connection
_TEST_RESULTS = [
# (comment, input, expected result, fail_ok)
# Quoted hostname tests
('check quoted host name #1', "'mys... |
"""walkdir - iterative tools for working with os.walk() and similar interfaces
"""
import fnmatch
import os.path
import sys
# Should be compatible with 2.7 and 3.2+
try:
_str_base = basestring
except NameError:
_str_base = str
# Filtering for inclusion
def _make_include_filter(patterns):
"""Create a filt... |
"""Ce fichier définit le contexte-éditeur EdtDate."""
from primaires.interpreteur.editeur import Editeur
class EdtDate(Editeur):
"""Contexte-éditeur d'édition de la date de fin de période.
"""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
... |
'''
Created on Oct 24, 2011
@author: markuz
'''
import urllib
import urlparse
import json
def get_vimeo_ids(text):
'''
Sarch for vimeo links on text.
@param text:
'''
vimeo_id = []
for index, data in enumerate(text.split("\n")):
if data.find("[vimeo]")!=-1:
data = data.rep... |
"""Trend report rendering
The trend report uses metadata from a funkload.metadata file if present.
The format of the metadata file is the following:
label:short label to be displayed in the graph
anykey:anyvalue
a multi line description in ReST will be displayed in the listing parts
"""
from __future__ import print_f... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class BuildGraphIntegrationTest(PantsRunIntegrationTest):
def test_cycle(self):
prefix = 'testprojects/src/java/org/pantsbuild/testproject'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
__version__ = '3.3.3'
if sys.argv[-1] == 'tag':
os.system("git tag -a %s -m 'version %s'" % (__version__, __version__))
os.system("git push --tags"... |
import os
import sys
import tempfile
import argparse
import subprocess
import threading
import logging
import re
from spinel.stream import StreamOpen
from spinel.const import SPINEL
from spinel.codec import WpanApi
from serial.tools.list_ports import comports
from enum import Enum
# Nodeid is required to execute ot-n... |
import os
from sdcm.tester import ClusterTester
class PerformanceRegressionUserProfilesTest(ClusterTester):
"""
Test Scylla performance regression with cassandra-stress using custom user profiles.
"""
def __init__(self, *args, **kwargs):
super(PerformanceRegressionUserProfilesTest, self).__i... |
import os
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.backend.jvm.targets.java_library import JavaLibrary
from pants.backend.jvm.targets.jvm_binary import JarRules, JvmBinary, Skip
from pants.backend.jvm.tasks.detect_duplicates import DuplicateDetector
from pants.base.exceptions import Task... |
"""
Django settings for techblog project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pat... |
"""
Common instance status code used across Trove API.
"""
class InstanceTask(object):
"""
Stores the different kind of tasks being performed by an instance.
"""
# TODO(tim.simpson): Figure out someway to migrate this to the TaskManager
# once that revs up.
_lookup = {}
... |
import sys
from datetime import datetime
from time import localtime, time, strftime
from collections import namedtuple
import argparse
import json
from metadatautilspkg.globalvars import *
from metadatautilspkg.errorcodes import *
def getCurrentEDTFTimestamp():
timeStamp = datetime.now().isoformat(sep='T').split... |
#!/usr/bin/env python3
import os
import random
from abc import ABC
import torch
class BaseTestCase(ABC):
def setUp(self):
if hasattr(self.__class__, "seed"):
seed = self.__class__.seed
if os.getenv("UNLOCK_SEED") is None or os.getenv("UNLOCK_SEED").lower() == "false":
... |
import re
import json
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.stream import HDSStream
_url_re = re.compile("(http(s)?://(\w+\.)?antenna.gr)/webtv/watch\?cid=.+")
_playlist_re = re.compile("playlist:\s*\"(/templates/data/jplayer\?cid=[^\"]+)")
_manifest_re ... |
import ecto.sphinx.breathe.parser.doxygen.index
import ecto.sphinx.breathe.parser.doxygen.compound
import os
class ParserError(Exception):
pass
class Parser(object):
def __init__(self, cache, path_handler):
self.cache = cache
self.path_handler = path_handler
class DoxygenIndexParser(Parser... |
#!/usr/bin/env python
from distutils.core import setup
from os.path import abspath, dirname, join
import re
NAME = 'dbbot'
CLASSIFIERS = """
Development Status :: 4 - Beta
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Topic :: Software Developmen... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import portfolio
# NOTE: when using iterated search included, we must include the option
# "plan_counter=PLANCOUNTER"
CONFIGS = [
# alt_lazy_ff_cg
(49, ["--heuristic", "hff=ff(cost_type=H_COST_TYPE)",
"--heuristic", "hcg=cg(cost_type=H_COST_TYPE)"... |
import re
import logging
from superdesk.errors import ParserError
from superdesk.io.registry import register_feed_parser
from superdesk.io.feed_parsers import FileFeedParser
from superdesk.metadata.utils import generate_guid
from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, GUID_TAG
from superdesk.utc impor... |
import itertools
import logging
import re
from bs4 import BeautifulSoup, Comment
from furl import furl
from share.harvest import BaseHarvester
logger = logging.getLogger(__name__)
class SWHarvester(BaseHarvester):
"""
"""
VERSION = 1
def _do_fetch(self, start, end, list_url):
end_date = ... |
import bpy
from bpy.types import Menu, Panel
class RENDER_MT_presets(Menu):
bl_label = "Render Presets"
preset_subdir = "render"
preset_operator = "script.execute_preset"
draw = Menu.draw_preset
class RENDER_MT_ffmpeg_presets(Menu):
bl_label = "FFMPEG Presets"
preset_subdir = "ffmpeg"
pr... |
#! /usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade
class GtkTreeViewTutorialSample:
def __cell_data_func (self, column, cell, model, iter, data=None):
active = model.get_value (iter, 2)
nome = model.get_value (iter, 0)
if active:
cell.set_property ('fore... |
__all__ = ['PysolProgressBar']
# imports
import Tkinter
# Toolkit imports
from tkconst import EVENT_HANDLED
from tkutil import makeToplevel, setTransient
# ************************************************************************
# * a simple progress bar
# ***********************************************************... |
from openerp.osv import orm, fields
class MrpProduction(orm.Model):
_inherit = 'mrp.production'
def _count_tests(self, cr, uid, ids, name, arg, context=None):
res = {}
for test in self.browse(cr, uid, ids, context=context):
created = 0
done = 0
passed = 0
... |
from xml.parsers import expat
from vulnerability import Anomaly
class AnomalyXMLParser:
ANOMALY = "anomaly"
ANOMALY_NAME = "name"
ANOMALY_DESCRIPTION = "description"
ANOMALY_SOLUTION = "solution"
ANOMALY_REFERENCE = "reference"
ANOMALY_REFERENCES = "references"
ANOMALY_REFERENCE_TITLE = "... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exchange_portal', '0014_auto_20180208_1725'),
]
operations = [
migrations.RemoveField(
model_name='travel_story'... |
from splitwise import Splitwise
from splitwise.exception import SplitwiseNotFoundException, SplitwiseNotAllowedException
import unittest
try:
from unittest.mock import patch
except ImportError: # Python 2
from mock import patch
@patch('splitwise.Splitwise._Splitwise__makeRequest')
class DeleteGroupTestCase(u... |
import logging
from Tribler.community.market.core.payment import Payment
from Tribler.community.market.core.timestamp import Timestamp
from Tribler.community.market.core.trade import ProposedTrade
from Tribler.community.market.core.transaction import TransactionId, Transaction, StartTransaction
from Tribler.community.... |
import torch as t
import torch.nn.functional as F
def iou_agnostic(gt_volume: t.Tensor,
logits: t.Tensor,
weights: t.Tensor = None) -> t.Tensor:
"""Class-agnostic IoU like loss.
Args:
gt_volume: The ground truth volume containing voxel classes, int64[B,D,H,W].
logits: Th... |
# dinkum/sudoku/__init__.py
# The suodku package import file
''' defines common definitions for all the sudoku modules.
These are typically constants. There are All UPPER CASE
by dinkum convention.
Also defines a couple of Exceptions that can be raised
in various modules.
'''
# 2019-12-?? tc Initial
# 2019-12-03 tc ... |
import os
import infra.basetest
class TestSquashfs(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
unsquash... |
# -*- 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 'Announcement'
db.create_table(u'pyconkr_announcement', (
... |
#!/usr/bin/env python
# Local development with:
#
# Download URL: http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.zip
# Start command: java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -inMemory
#
# More info: http://docs.aws.amazon.com/amazondynamodb/lat... |
from __future__ import absolute_import
from typing import Any, Callable, Mapping
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.base import BaseHandler
from zerver.models import get_user_profile_by_email, \
get_user_profile_by_id, get_prereg_user_by_ema... |
"""
Helper functions for defining the set of tasks in ParlAI.
The actual task list and definitions are in the file task_list.py
"""
from .task_list import task_list
from collections import defaultdict
def _preprocess(name):
return name.lower().replace('-', '')
def _build(task_list):
tasks = {}
tags = d... |
#!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2017 LeanIX GmbH
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,... |
import string
from pyparsing import (
Literal, White, Word, alphanums, CharsNotIn, Forward, Group, SkipTo,
Optional, OneOrMore, ZeroOrMore, pythonStyleComment)
class NginxParser(object):
"""
A class that parses nginx configuration with pyparsing
"""
# constants
left_bracket = Literal("{"... |
import copy
from cloudferry.lib.base.action import action
from cloudferry.lib.os.compute import keypairs
from cloudferry.lib.os.identity import keystone
from cloudferry.lib.utils import log
from cloudferry.lib.utils import utils as utl
LOG = log.getLogger(__name__)
class TransportComputeResources(action.Action):
... |
"""
Description of dl4m.py
======================
Parse dl4m.bib to create a simple and readable ReadMe.md table.
..todo::
add function that test and report dead http links
sort bib
add Fig for tasks, wordcloud, dataaugmentation
bibtexparser accentuation handling in authors.md list
error handling
... |
import os
from os.path import join as joinpath, exists
import pickle
import sys
from scrapy import Request
from time import time, sleep
from scrapy.pipelines.images import ImagesPipeline
import logging as log
from imagebot.items import ImageItem
from imagebot.settings import settings
from imagebot.dbmanager import DBM... |
from django.db import models
class Article(models.Model):
CHOICES = (
(1, 'first'),
(2, 'second'),
)
headline = models.CharField(max_length=100, default='Default headline')
pub_date = models.DateTimeField()
status = models.IntegerField(blank=True, null=True, choices=CHOICES)
mi... |
import rospy
from std_msgs.msg import String
import sys
from wifi_sensor.msg import *
import time
l1=[];
sec=time.time()
msg = Rssi()
def callback(data):
rssi1=data.rssi
mac1=data.their_mac_addr
#print mac1
#print rssi1
if not mac1 in l1:
l1.append(mac1)
#print "Acces"
def callback2(data):
rssi=data.rssi
... |
from App.Proxys import *
data = IKVMCController(
name = '',
controlParamsList = [
ControlParams( joint = 'root', kp = 1000.0, kd = 200.0, tauMax = 200.0, scale = ( 1.0, 1.0, 1.0 ) ),
ControlParams( joint = 'pelvis_lowerback', kp = 75.0, kd = 17.0, tauMax = 100.0, scale = ( 1.0, 1.0,... |
#!/usr/bin/env python
# a bar plot with errorbars
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse, Polygon
from pylab import *
width = 0.37 # the width of the bars
font = {'family' : 'sans-serif',
'variant' : 'normal',
'weight' : 'light',
... |
# -*- coding: UTF-8 -*-
import random,time,re,os,json,requests,math
try:
import vk
except:
raise NameError("Vk module not found, use \'pip install vk\'")
from random import randint
TOKEN="" #тут токен
GROUP_ID=0 #тут айди группы
ARCHIVE_DIR="pics" #папка локального архива
class api: # Класс для вызова а... |
#!/usr/bin/env python
# This is the clientside module for mbbr_status
import os
import subprocess
import StringIO
import plistlib
import sys
def get_mbbr_info():
'''Uses mbbr to get Malwarebytes activation status for this machine'''
cmd = ['/usr/local/bin/mbbr register']
rundata = subprocess.check_output... |
import mock
from dragonflow.db.models import l2
from dragonflow.db.models import sfc
from dragonflow.tests.common import utils
from dragonflow.tests.unit import test_app_base
lswitch1 = l2.LogicalSwitch(
id='lswitch1',
topic='topic1',
version=10,
unique_key=22,
)
fc1lport = l2.LogicalPort(
id='lp... |
"""Contains evaluation plan for the Im2vox model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
from tensorflow import app
import model_ptn
flags = tf.app.flags
slim = tf.contrib.slim
flags.DEFINE_string('inp_dir',
... |
import sys
import os
import argparse
import base64
import hashlib
import bcrypt
import binascii
from models import db_session, create_all, init, User
from getpass import getpass
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES
from pbkdf2 import PBKDF2
from config import get_config
from server import serv... |
import sys
import math
import json
class Vertex:
def __init__(self, x, y, neighbors = None, visited = None):
self.x = x
self.y = y
self.neighbors = neighbors if neighbors is not None else []
self.visited = visited if visited is not None else False
def addNeighbor(self, v):
self.neighbors.append(v)
for arg... |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.networks import workflows \
as... |
from django.db import models
from django_extensions.db.fields import (
AutoSlugField,
RandomCharField,
ShortUUIDField,
UUIDField,
)
from django_extensions.db.fields.json import JSONField
from django_extensions.db.models import ActivatorModel
class Secret(models.Model):
name = models.CharField(bla... |
import numpy as np
from netCDF4 import Dataset
import datetime
import os
import grid
import tools
__author__ = 'Trond Kristiansen'
__email__ = '<EMAIL>'
__created__ = datetime.datetime(2014, 2, 20)
__modified__ = datetime.datetime(2014, 2, 20)
__version__ = "1.0"
__status__ = "Development, 20.2.2014"
doc ="... |
import os
import textwrap
import pytest
from conans.test.assets.cmake import gen_cmakelists
from conans.test.assets.sources import gen_function_cpp, gen_function_h
from conans.test.utils.tools import TestClient
@pytest.mark.tool_cmake
def test_file_api():
"""
simple library providing 3 targets:
- decode... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
from tempfile import mkdtemp
from shutil import rmtree
import numpy as np
import nibabel as nb
from nipype.testing import (assert_equal, assert_not_equal,
... |
# pylint: disable=unused-argument
"""
Test for the xBlock service
"""
import unittest
from edx_proctoring.services import (
ProctoringService
)
from edx_proctoring import api as edx_proctoring_api
import types
class MockCreditService(object):
"""
Simple mock of the Credit Service
"""
def __init... |
"""Functions for making fab tasks"""
from fabric.api import local
from fabric.colors import green, red, yellow
from fabutils import utils as fabutils, conf
def dependencies_task(pip_requirements, default_env='dev'):
"""
Build a task for installing dependencies.
``pip_requirements`` should be a dict mapp... |
import codecs
import hashlib
import logging
import os
from Crypto.Cipher import AES, DES3
from Crypto.PublicKey import DSA as DSAKey
from Crypto.PublicKey import RSA as RSAKey
from ecdsa import der, curves, SigningKey
from pyasn1.codec.ber import decoder as ber_decoder
from pyasn1.codec.der import decoder as der_decod... |
import logging
from threading import Thread
from six.moves.queue import Queue
logger = logging.getLogger(__name__)
class Executor(object):
_INTERRUPT = object()
def __init__(self, num_workers=1):
super(Executor, self).__init__()
self._queue = Queue()
self._workers = []
for ... |
'''OpenGL extension EXT.compiled_vertex_array
This module customises the behaviour of the
OpenGL.raw.GL.EXT.compiled_vertex_array to provide a more
Python-friendly API
Overview (from the spec)
This extension defines an interface which allows static vertex array
data to be cached or pre-compiled for more efficie... |
'''
Dialog box used to select features which should be ignored.
@author: Donovan Parks
'''
from PyQt4 import QtGui, QtCore
from multCompCorrectionInfoUI import Ui_multCompCorrectionInfoDlg
class MultCompCorrectionInfoDlg(QtGui.QDialog):
def __init__(self, parent=None, info=None):
QtGui.QWidget.__init__(self, p... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify basic operation of the "func" subcommand.
"""
import TestSCons_time
test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re)
try:
import pstats
except ImportError:
test.skip_test('No pstats module, skipping test.\n')
test... |
#-*- coding: utf-8 -*-
import urllib,re,string,urlparse,sys,os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
art = main.art
prettyName = 'Aflam1'
MAINURL='http://www.aflam1.com'
def M... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""dbtoyaml - extract the schema of a PostgreSQL database in YAML format"""
from __future__ import print_function
import sys
from pyrseas import __version__
from pyrseas.yamlutil import yamldump
from pyrseas.database import Database
from pyrseas.cmdargs import cmd_parser,... |
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY34
class TestCursorNext(TestExternalDatabase):
'''Unit tests related to the Cursor.next() method.
'''
def test___doc__(self):
if PY3:
doc = '''\
next()
Return the next row from the currently... |
"""Implementation of paginate query."""
import sqlalchemy
from cinder import exception
from cinder.openstack.common.gettextutils import _
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)
# copied from glance/db/sqlalchemy/api.py
def paginate_query(query, model, limit, sort_keys... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from regparser.notice import changes
from regparser.notice.amdparser import Amendment
from regparser.notice.amendments import fetch
from regparser.test_utils.xml_builder import XMLBuilder
from regparser.tree.struct import Node
from regparser.tree.xml_pars... |
import json
import urllib
import urllib2
#############
# The following functions are not part of the API
# They are tools to avoid code redundancy
#############
## Send a request that will be process by the Federation Middleware
# It add the X-Auth-Type: federated header in the HTTP request
def middlewareRequest(keys... |
#!/usr/bin/env python
'''
Copyright (C) 2013, Digium, Inc.
Jonathan Rose <<EMAIL>>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
'''
import sys
import logging
sys.path.append("lib/python")
LOGGER = logging.getLogger(__name__)
class Executioner(object):
... |
import requests
import json
from fatzebra import data
from fatzebra import errors
from fatzebra import version
class Gateway(object):
SANDBOX_URL = "https://gateway.sandbox.fatzebra.com.au/v1.0/"
LIVE_URL = "https://gateway.fatzebra.com.au/v1.0/"
def __init__(self, username="TEST", token="TEST", sandbox=... |
from sympy.core.compatibility import PY3
from sympy.core.logic import (fuzzy_not, Logic, And, Or, Not, fuzzy_and,
fuzzy_or, _fuzzy_group, _torf, fuzzy_nand, fuzzy_xor)
from sympy.utilities.pytest import raises
T = True
F = False
U = None
def test_torf():
from sympy.utilities.iterables import cartes
v = [... |
from lang_parser import LangParser
from lang_parser import Section
import tokenize
import token
import os
PARSE_TYPES = [
tokenize.STRING,
tokenize.COMMENT,
]
class PyParser(LangParser):
def parse(self):
"""This uses tokenize to parse the content"""
if not self.path:
return
if not os.path.exi... |
#!/usr/bin/env python
from time import sleep
from pymongo import MongoClient
from proauth2 import Proauth2, Proauth2Error
from proauth2.data_stores import mongo_ds
class TestProauth2():
def setup( self ):
self.proauth2 = Proauth2( mongo_ds.DataStore( 'proauth2_tests' ) )
def teardown( self ):
... |
""" Minion.py
by Ibrahim Sardar
"""
#load
import pygame, math, random, FlameV2, MissileV3, Bomb, Bullet
from FollowBlock import FollowBlock
#init
pygame.init()
#colors
YELLOW = (255, 255, 0)
#pics
BULLET_RED = "Graphics\Bullet04.png"
BULLET_GREEN = "Graphics\Bullet05.png"
MISSLE_BASIC = "Graphics\Missile02.... |
# -*- coding: utf-8 -*-
import warnings
from .._util import _any, get_backend
def water_permittivity(
T=None, P=None, units=None, U=None, just_return_U=False, warn=True, backend=None
):
"""
Relative permittivity of water as function of temperature (K)
and pressure (bar).
Parameters
-------... |
''' test program for capital one '''
# wrapper function for handling exceptions in inputs
def safe_input():
try:
response = input("==> ").strip()
return response
except (EOFError,KeyboardInterrupt) as e:
print("Input interrupted by user or end of line reached")
return None
de... |
###############################################################################
# XSS
###############################################################################
def test_create_user_name_xss(client):
SAFE_NAME = "<script>alert('xss')</script>"
XSS_NAME = "<script>alert('xss')</script>... |
# WARPnet Client<->Server Architecture
# WARPnet Parameter Definitions
#
from warpnet_client_definitions import *
from warpnet_common_params import *
from twisted.python import threadable
import re
from datetime import *
import time
EMU_RETRANSMIT_COUNT = 10 # Max retries to send the data struct
EMU_WAIT_TIME = 30 # ... |
"""@package src.clm.models.message
@author Tomek Sośnicki <<EMAIL>>
"""
from django.db import models
from clm.models.user import User
import json
from clm.utils.exception import CLMException
from datetime import datetime
class Message(models.Model):
"""
@model{MESSAGE}
Message is an entity representing ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.