content stringlengths 4 20k |
|---|
import getdns
class Scan_Records(object):
def __init__(self, debug = False):
self.context = getdns.Context()
self.extensions = { "dnssec_return_status": getdns.EXTENSION_TRUE }
self.context.edns_do_bit = 1
self.debug = debug
self.count = 0
def query(self, name, type):
... |
from ...GUI.menu import MenuBar
from ...GUI.panel import Panel_API_graphique
class GeometreMenuBar(MenuBar):
def __init__(self, panel):
MenuBar.__init__(self, panel)
self.ajouter("Fichier", ["nouveau"], ["ouvrir"], ["ouvrir ici"], None,
["enregistrer"], ["enregistrer_sous"], ["e... |
import re
import threading
from subprocess import Popen, PIPE
class FFmpegCLI:
def __init__(self, ffmpeg_bin='ffmpeg', ffprobe_bin='ffprobe'):
self.ffmpeg_bin = ffmpeg_bin
self.ffprobe_bin = ffprobe_bin
def _run_in_thread(self, target, args, callback=None):
t = threading.Thread(target... |
import os
import sys
import h5py
import matplotlib.pyplot
import numpy
import scipy
class fluctuations:
def __init__(self):
# Class properties storing info to be plotted
appliance_name = "Undefined"
shot_number = 0
time_index = 0
R_axis = numpy.array
Z_axis = numpy.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import get_language, to_locale
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .conf import settings
from .models import FacebookComments
class FacebookCommentsPlugin(CMSPluginBase):... |
# Reuben Thorpe (2015) , Advent of Code 18th December [Conway Game of Life]
from time import sleep
import curses
STEPS = 100 # Number of animation frames
DIM = 100 # Width of array
FPS = 30 # Frame per second
def switch(r, c, state, grid):
# Main switching algorithm
if state == 'p#':
return('p#')
... |
from pkg_resources import resource_filename
import logging
from flask import Blueprint, request, render_template, Markup, jsonify, Response
from MyCapytain.common.constants import Mimetypes, RDF_NAMESPACES
from MyCapytain.common.reference import URN
from capitains_nautilus.errors import NautilusError, MissingParamet... |
gosthash94 = 'The GOST94 or GOST R 34.11-94 hash algorithm is a Soviet-era' \
' algorithm used in Russian government standards (see RFC 4357). It' \
' outputs message digests of 256 bits, or 32 octets.'
md2 = 'MD2 is another hash function of Ronald Rivest’s, described in RFC' \
' 1319. It outputs message d... |
import collections
import uuid
import mock
from neutron.agent.common import ovs_lib
from neutron.agent.linux import ip_lib
from neutron.tests import base as tests_base
from neutron.tests.common import net_helpers
from neutron.tests.functional.agent.linux import base
class OVSBridgeTestBase(base.BaseOVSLinuxTestCase... |
"""
An interface for running test cases as unattended jobs.
"""
import sys
import os
from pycopia import logging
from pycopia import aid
from pycopia import shparser
from pycopia import getopt
from pycopia.QA import testloader
from pycopia.db import models
def _parse_parameters(text):
def _ParserCB(d, argv):
... |
from bge import logic
import math
#AI
# AI_MAX_DISTANCE = 100
# AI_CLOSE_DISTANCE = 50
AI_MAX_COUNT = 25
AI_NEW_SPAWN_MAX_COUNT = 5
AI_CLOSE_COUNT = 5
AI_SPAWN_MAX_DISTANCE = 200
AI_SPAWN_MIN_DISTANCE = 50
AI_ATTACK_MAX_DISTANCE = 200
AI_DIST_LOC_MAX = 300
AI_DIST_LOC_MIN = 150
AI_DIST_LOC_MAX_DEATH = 150
AI_DIST_LO... |
#! /usr/bin/python
from __future__ import print_function, division
import logging.handlers
log = logging.getLogger("babysitter")
from babysitter import Manager, DiskSpaceRemaining, Process, NewDataDirError, File
import time, sys, inspect, os
import email_config
"""
This script is both an example of how to use babysitt... |
import json
import os
import shutil
import sys
import subprocess
import time
def get_worlds(config):
worlds = []
for worldname, worldcfg in config['worlds'].items():
world = {'name': worldname}
if 'tilesize' in worldcfg:
world['tilesize'] = worldcfg['tilesize']
elif 'tiles... |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project fold... |
import logging
import pprint
import ldap.schema
import ipapython.version
from ipalib import api
from ipapython.dn import DN
from ipaserver.install.ldapupdate import connect
from ipaserver.install import installutils
SCHEMA_ELEMENT_CLASSES = (
# All schema model classes this tool can modify
# Depends on orde... |
__author__ = 'Tom'
from mock import MagicMock, patch
from pnc_cli import products
from pnc_cli.swagger_client import ProductRest
from pnc_cli.swagger_client import ProductsApi
def test_create_product_object():
compare = ProductRest()
compare.name = 'test-product'
compare.description = 'description'
... |
# -*- coding: utf-8 -*-
from django.forms.forms import BoundField
class FieldStack(object):
""" Wrapper pro skupinu policek ve formulari
"""
def __init__(self, *args, **kwargs):
self.args, self.kwargs = args, kwargs
def __nonzero__(self):
return bool(self.args)
def __get__(self,... |
# -*- coding: utf-8 -*-
from __future__ import division
from datetime import datetime, timedelta
import logging
import os
from guessit import guessit
logger = logging.getLogger(__name__)
#: Video extensions
VIDEO_EXTENSIONS = ('.3g2', '.3gp', '.3gp2', '.3gpp', '.60d', '.ajp', '.asf', '.asx', '.avchd', '.avi', '.bik'... |
# -*- coding: utf-8 -*-
"""
Exodus Add-on
Copyright (C) 2016 Exodus
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 option) any l... |
from __future__ import absolute_import
import os
import sys
import pkg_resources
import jinja2
import signal
from twisted.internet.error import ReactorNotRunning
from twisted.internet.defer import DeferredList, inlineCallbacks
from autobahn.util import utcnow
from autobahn.wamp.exception import ApplicationError
from... |
#!/usr/bin/python2
import check
from fractions import gcd
# Algorithm taken from en.wikipedia.org/wiki/Line-line-_intersection
# All code written by Joel Williamson
## intersection: Int Int Int Int Int Int Int Int -> (union "parallel" (listof Int Int Int Int))
##
## Purpose: Treating the input as 4 pairs of integers... |
import logging
import os
import re
import tempfile
from devil.android import device_errors
from devil.android import ports
from devil.android.perf import perf_control
from pylib import pexpect
from pylib.base import base_test_result
from pylib.base import base_test_runner
from pylib.local import local_test_server_spaw... |
"""
.. module:: initialise
:synopsis: intialisation
.. moduleauthor:: Benjamin Audren <<EMAIL>>
"""
import io_mp
import parser_mp # parsing the input command line
from data import Data
import sys
import os
def initialise(custom_command=''):
"""
Initialisation routine
This function recovers the inp... |
#!/usr/bin/env python
"""
train.py -
All-in-one tool for easy training of a model for langid.py. This depends on the
training tools for individual steps, which can be run separately.
Marco Lui, January 2013
Copyright 2013 Marco Lui <<EMAIL>>. All rights reserved.
Redistribution and use in source and binary forms, w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from os.path import realpath
from shapely.geometry import MultiPolygon
from shapely.geometry import asShape
from shapely.wkt import dumps
# define our files input and output locations
input_fairways = realpath("../geodata/pebble-beach-fairways-3857.geojson")
... |
from unittest.mock import Mock
import pytest
from hailtop.hailctl.dataproc import cli
@pytest.fixture
def subprocess():
return Mock()
@pytest.fixture(autouse=True)
def patch_subprocess(monkeypatch, subprocess):
"""Automatically mock subprocess module."""
monkeypatch.setattr("hailtop.hailctl.dataproc.c... |
from __future__ import unicode_literals
import frappe, os, copy, json, re
from frappe import _
from frappe.modules import get_doc_path
from jinja2 import TemplateNotFound
from frappe.utils import cint, strip_html
from frappe.utils.pdf import get_pdf
no_cache = 1
no_sitemap = 1
base_template_path = "templates/pages/... |
#!/usr/bin/env python
# probono 11-2010
import os, sys
# Make external binaries and their libs available if they are privately bundled
ldp = os.environ.get("LD_LIBRARY_PATH")
p = os.environ.get("PATH")
if ldp == None: ldp = ""
if p == None: p = ""
binpath = os.path.join(os.path.dirname(__file__), "bin")
ld_library_p... |
import logging, json
from threading import Thread
from django.conf import settings
from backend.models import Volume
from backend.kubernetes.k8sclient import KubeClient
from backend.utils import get_volume_nfs_dir
from backend.nfs import NFSRemoteClient, NFSLocalClient
logger = logging.getLogger('hummer')
class Vo... |
#!/usr/bin/env python
""" A small program to compute checksums of LLVM checkout.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hashlib
import logging
import re
import sys
from argparse import ArgumentParser
from project_tree import *
SVN_DATES_... |
from gtk import gdk
########################
###
### MODES
###
########################
class VIG_Modes(object):
"""Holds info on all the modes"""
def __init__(self):
object.__setattr__(self, 'info', {
'command': 'Command Mode',
'visual': 'Visual Mode',
... |
from qingcloud.cli.misc.utils import explode_array
from qingcloud.cli.iaas_client.actions.base import BaseAction
class ChangeEipsBillingModeAction(BaseAction):
action = 'ChangeEipsBillingMode'
command = 'change-eips-billing-mode'
usage = '%(prog)s -e "eip_id, ..." -b <billing-mode> [options] [-f <conf_fil... |
from __future__ import absolute_import
import pytest
from qtpy import PYSIDE2, PYSIDE6, PYSIDE
@pytest.mark.skipif(PYSIDE6, reason="not available with qt 6.0")
def test_qtxmlpatterns():
"""Test the qtpy.QtXmlPatterns namespace"""
from qtpy import QtXmlPatterns
assert QtXmlPatterns.QAbstractMessageHandler ... |
from unittest import TestCase
from qpid.saslmech.finder import get_sasl_mechanism
from my_sasl import MY_SASL
from my_sasl2 import MY_SASL2
class SaslFinderTests (TestCase):
"""Tests the ability to chose the a sasl mechanism from those available to be loaded"""
def test_known_mechansim(self):
supportedMechs ... |
import random
import math
import os
import sys
def scramble(v):
vPrime = [a for a in v] #.copy does not work in pypy3
random.shuffle(vPrime)
m = max(vPrime)
return vPrime.index(m), vPrime
# Does not work on OSX -- no permission to make the directory
def make_directory(dirname):
# d = os.path.dir... |
import logging
import ckan.lib.uploader as uploader
import ckan.lib.helpers as h
import ckan.plugins.toolkit as toolkit
from ckan.logic.converters import convert_user_name_or_id_to_id
from ckan.lib.navl.dictization_functions import validate
import ckanext.showcase.logic.converters as showcase_converters
import ckanex... |
#Calculating user's salary according to the number of days given by user and capturing the output in a file
#PsuedoCode
#Step 1 : User Input from stdin, Enter number of days
#step 2 : Take the days as argument to the condition
#step 3 : Check the condition if the number of days are valid i.e. 1 to 366 inclusive
#step... |
from Tkinter import *
import time
import threading
import random
import Queue
import tkFont
from wiiscratch import wiiscractch
import scratch
import platform, os, sys, socket
VERSION = '0.0.1' ... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
class MatlabSessionError(Exception):
def __init__(self, message=None):
if not message:
message = '''There is no active Matlab session, or could not connect to one...
Don't forget to run... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import datetime
import asyncio
import aiohttp
import numpy as np
from ... import core
from ... import util
class Flukso(core.plugin.Plugin):
"""
Retrieve data from a Fluksometer
"""
def initialize(self):
... |
import logging
import time
from golem.core.crypto import ECIESDecryptionError
from golem.network.transport.message import MessageHello, MessagePing, MessagePong, MessageGetPeers,\
MessagePeers, MessageGetTasks, MessageTasks, MessageRemoveTask, MessageGetResourcePeers, MessageResourcePeers, \
MessageDegre... |
'''
Printing.py
Contains Elements that make it easy to modify the printed output of a page
Copyright (C) 2015 Timothy Edmund Crosley
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 Fou... |
import copy
import functools
import inspect
import os
import types
import six
from .compat import collections
from .cassette import Cassette
from .serializers import yamlserializer, jsonserializer
from .persisters.filesystem import FilesystemPersister
from .util import compose, auto_decorate
from . import matchers
fr... |
"""
run_all_drc.py --- A script that will run run_standard_drc for all .gds files
under the cells/ folder.
Must be run from repository root.
Usage: python3 run_all_drc.py --help
Results:
Prints a report to standard output.
"""
import os
import re
import subprocess
import traceback
from concurrent import futures... |
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import shutil
import socket
import sys
import time
import random
import string
import seesaw
from seesaw.config import NumberConfigValue
from seesaw.externalprocess import ExternalProcess
from seesaw.item import I... |
import os
import sys
from stetl.etl import ETL
from stetl.packet import Packet
from stetl.inputs.fileinput import GlobFileInput
from tests.stetl_test_case import StetlTestCase
class GlobFileInputTest(StetlTestCase):
"""Unit tests for GlobFileInput"""
def setUp(self):
super(GlobFileInputTest, self).se... |
# import modules
FILE_NAME = 'fdic_failed_bank_list.csv'
# write a function to do some more exploring with strings
# open the csv
# create the object that represents the data in the csv file
# create a variable to represent the header row
# from the last lesson we know the variable header_row refe... |
from novaclient import client as nova_client
from novaclient import exceptions as nova_exception
from novaclient.v1_1 import servers
from oslo.config import cfg
from climate import context
from climate.utils.openstack import base
nova_opts = [
cfg.StrOpt('nova_client_version',
default='2',
... |
#!/usr/bin/env python
#
# Tests for dakota_utils.convert.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper (<EMAIL>)
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.convert import *
nonfile = 'fbwiBVBVFVBvVB.txt'
def setup_module():
print('Convert tests:')
os.environ['_tes... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 26 18:59:02 2017
@author: Administrator
"""
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
from heapq import heappop, heappush
class Solution:
"""
... |
RELEASE_LEVELS = [ALPHA, BETA, RELEASE_CANDIDATE, FINAL] = ['alpha', 'beta', 'candidate', 'final']
RELEASE_LEVELS_DISPLAY = {ALPHA: ALPHA,
BETA: BETA,
RELEASE_CANDIDATE: 'rc',
FINAL: ''}
# version_info format: (MAJOR, MINOR, MICRO, RELEASE_L... |
"""
test_price
----------------------------------
Tests for `price` module.
"""
import pytest
from pytest import raises
import os
from time import time
from marketeer import price
@pytest.fixture(scope="function")
def fixture(request):
def teardown():
try:
os.remove('test_price.sqlite')
... |
import fontforge
import json
import os
import sys
import fileinput
# Ensure the svgs folder exists.
svgFolder = "./svgs/"
try:
os.makedirs(svgFolder)
except OSError:
if os.path.exists(svgFolder):
pass
else:
raise
# Open the font file.
font = fontforge.open("font.ttf")
print font.fontname
... |
from qapi import *
import re
def gen_command_decl(name, arg_type, ret_type):
return mcgen('''
%(c_type)s qmp_%(c_name)s(%(params)s);
''',
c_type=(ret_type and ret_type.c_type()) or 'void',
c_name=c_name(name),
params=gen_params(arg_type, 'Error **errp'))
def ge... |
from itertools import chain
from django.contrib.staticfiles.finders import find
import pytest
from codemirror2.widgets import CodeMirrorEditor
@pytest.fixture
def w():
"""
construct a CodeMirrorEditor widget with default settings
"""
return CodeMirrorEditor()
def test_dont_share_options(settings):
... |
#!/usr/bin/env python
# -*- coding: utf-8
from __future__ import print_function
# Importar librerías requeridas
import cPickle as pickle
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
import argparse, os, codecs, re, itertools
# Local imports
from load_tweets import load_tweets
# Vari... |
"""Unit tests for git_common.py"""
import binascii
import collections
import os
import signal
import sys
import tempfile
import time
import unittest
DEPOT_TOOLS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, DEPOT_TOOLS_ROOT)
from testing_support import coverage_utils
from test... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cms.models import ACCESS_CHOICES, Page
from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.db import models, migrations
import django.utils.timezone
from django.utils.translation import ugettext_lazy as _
template... |
from PyQt5.QtWidgets import QWidget, QHeaderView
from PyQt5.QtCore import Qt, QEvent, pyqtSignal
from .network_uic import Ui_NetworkWidget
from .delegate import NetworkDelegate
import asyncio
class NetworkView(QWidget, Ui_NetworkWidget):
"""
The view of Network component
"""
manual_refresh_clicked = p... |
import json
from collections import OrderedDict
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import serializers
from rest_framework.utils.encoders import JSONEncoder
from issues.excs import InvalidAppError
def api_exception_handler(exc, context):
# Call REST framework's default exce... |
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden
from django.contrib.auth.views import redirect_to_login
class LoginRequiredMixin(object):
login_url_name = 'login'
def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated():
... |
import sys, os.path
tests_dir=os.path.abspath(__file__)[:-len(os.path.basename(__file__))]
sys.path.insert(1, os.path.join(tests_dir, '../lib'))
sys.path.insert(1, os.path.join(tests_dir, '..'))
import glob
import unittest
class AllTests(unittest.TestCase):
#Block issue_submitter_tests to avoid issue tracker sp... |
'''stream.py: module for defining Stream and Grouping for python topology'''
import collections
from heronpy.api.serializer import default_serializer
from heronpy.api.custom_grouping import ICustomGrouping
from heronpy.proto import topology_pb2
class Stream(object):
"""Heron output stream
It is compatible with ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from translate.storage import factory
from translate.storage import xliff
from translate.storage.test_base import headerless_len, first_translatable
from translate.filters import pofilter
from translate.filters import checks
from translate.misc import wStringIO
class Bas... |
import sys
import os
import argparse
import builtins
import shell
import sh
BASE_DIR = os.path.join(os.path.dirname(__file__), "..")
sys.path.insert(0, BASE_DIR)
SUBMISSION_WAIT = 1000 # ms
contest = None
CWD = os.getcwd()
def do_help(opts, parser):
if opts.item == "verdicts":
print("\n".join("%s: %s" ... |
import os
class SilpaModule:
def __init__(self):
self.template=None
self.request=None
self.response = None
def get_errormessage(self):
return None
def get_successmessage(self):
return None
def get_module_name(self):
return "Untitled Silpa Module"
def g... |
"""
Polish-specific classes for parsing and displaying dates.
"""
from __future__ import unicode_literals
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
import re
#-------------------------------... |
import pygame
from pygame.locals import *
from constants import *
import time
from extract_words import get_words
import pandas as pd
from pylsl import StreamInfo, StreamOutlet
pygame.init()
#pygame.mouse.set_visible(False)
from screen import screen
from drawstuff import *
study_time = int(time.time())
print(study_t... |
import textwrap
import mock
import pep8
from nova.hacking import checks
from nova import test
class HackingTestCase(test.NoDBTestCase):
"""This class tests the hacking checks in nova.hacking.checks by passing
strings to the check methods like the pep8/flake8 parser would. The parser
loops over each line... |
import unittest
import os
try:
from StringIO import StringIO
except ImportError:
from io import BytesIO as StringIO
import tempfile
import splitstream
class UbJsonTests(unittest.TestCase):
def _stringio(self, string):
class C(StringIO):
def read(self, n):
return StringIO... |
"""
=========================================
Compute source power using DICS beamfomer
=========================================
Compute a Dynamic Imaging of Coherent Sources (DICS) [1]_ filter from
single-trial activity to estimate source power across a frequency band.
References
----------
.. [1] Gross et al. Dyna... |
"""Steam Controller gyro data plot"""
from steamcontroller import SteamController
from PySide import QtGui
import pyqtgraph as pg
import time
import struct
run = True
times = []
def _main():
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Steam Controller")
win.resize(1000, 600)
win.next... |
"""Tests for the `NoopElimination` optimization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.experimental.ops import optimization
from tensorflow.python.data.kernel_tests import test_base
from tensorflow.python.data.ops imp... |
import subprocess
from datetime import datetime
class downloader():
def __init__(self):
self.schedule = dict()
def schedule_jobs(self, cfg_file, scheduler):
with open(cfg_file, 'r') as cfg:
for line in cfg:
dl_sch = line.rstrip().split(',')
st_time... |
"""Stacked fixed noise dCOnvAE test"""
import sys;
sys.path.append("..");
import numpy as np;
import matplotlib.pyplot as plt;
import cPickle as pickle;
import theano;
import theano.tensor as T;
import telaugesa.datasets as ds;
from telaugesa.fflayers import ReLULayer;
from telaugesa.fflayers import SoftmaxLayer;
f... |
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.ForeignKey(User, unique=True, verbose_name=_("user"))
... |
"""
System-level utilities and helper functions.
"""
import math
import re
import sys
import unicodedata
import six
from trove.openstack.common.gettextutils import _
UNIT_PREFIX_EXPONENT = {
'k': 1,
'K': 1,
'Ki': 1,
'M': 2,
'Mi': 2,
'G': 3,
'Gi': 3,
'T': 4,
'Ti': 4,
}
UNIT_SYSTE... |
#!/usr/bin/env python
from math import log
import time
import pydot
VIZ_DIR = "./viz/"
class DecisionTreeClassifier:
def __init__(self, max_depth, min_samples_split, criterion='entropy'):
self.max_depth = max_depth
self.min_size = min_samples_split
self.criterion = 'entropy'
self... |
import urllib.parse
from functools import partial
import packaging.version
import pretend
import pytest
from warehouse import filters
def test_camo_url():
request = pretend.stub(
registry=pretend.stub(
settings={"camo.url": "https://camo.example.net/", "camo.key": "fake key"}
)
... |
import chart_scraper
import discogs_getter
import datetime
import time
import pickle
scrape_chart_data = False # Whether or not to scrape billboard for chart data
# All relevant information for a song
class Song:
def __init__(self, **entries):
self.__dict__.update(entries)
def __init__(self, tit... |
import asyncio
from asynctest import CoroutineMock, MagicMock, Mock
import pytest
def head():
head = MagicMock(name='HEAD')
head.__lt__ = lambda a, b: id(a) < id(b)
return head
def test_main():
from jenkins_epo.main import main
with pytest.raises(SystemExit):
main(argv=['inexistant'])
... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... |
# -*- coding: utf-8 -*-
from django.template import Lexer, TOKEN_TEXT
from django.utils.encoding import force_text
from django_babel.extract import extract_django
from django.utils import six
from markey import underscore
from markey.tools import TokenStream
from markey.machine import tokenize, parse_arguments
def ex... |
import config
import json, os
from jsmin import jsmin
class JSRender(object):
def __init__(self, js_registry, js_storage_dir, js_output_dir):
self.buffer = {}
self.__registry = {}
self.js_registry = js_registry
self.js_storage_dir = js_storage_dir
self.js_output_dir = js_o... |
"""
Installs and configures quantum
"""
import logging
import os
import re
import uuid
from packstack.installer import utils
from packstack.installer import validators
from packstack.modules.ospluginutils import (
appendManifestFile,
getManifestTemplate,
gethostlist,
)
# Controller object will be i... |
"""
climapy setup.py:
Setup file for climapy.
Installation of climapy:
python setup.py install
Author:
Benjamin S. Grandey, 2017
"""
from os import path
from setuptools import setup
from subprocess import Popen, PIPE
here = path.abspath(path.dirname(__file__))
# Description and long description
des... |
import os
import sys
import site
import platform
from os import path
sys.stdout = sys.stderr # wsgi doesn't support stdout
os.environ['DEPLOYMENT_FLAVOR'] = 'STAGING'
VIRTUAL_ENV_PATH = path.abspath(path.join(path.dirname(__file__), "../../../"))
PYTHON_VERSION = "lib%s/site-packages" % platform.python_version()[:3]... |
import argparse
import cgi
import copy
from Queue import Queue, Empty
from datetime import datetime
from json import JSONEncoder
from flask import jsonify, Response
from flask import request
from flexget.api import api, APIResource, ApiError, NotFoundError
from flexget.config_schema import process_config
from flexget... |
# -*- encoding: utf-8 -*-
"""Implements Activation keys UI."""
from robottelo.constants import DEFAULT_CV
from robottelo.ui.base import Base, UIError
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class ActivationKey(Base):
"""Manipulates Act... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action.network import ActionModule as ActionNetworkModule
class ActionModule(ActionNetworkModule):
EXOS_NETWORK_CLI_MODULES = (
'exos_facts',
'exos_config',
'exos_command')
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author Pradeep Jairamani; github.com/pradeepjairamani
import socket
import socks
import time
import json
import threading
import string
import requests
import random
import os
import re
from core.alert import *
from core.targets import target_type
from core.targets impor... |
import bge
import BlenderData_pb2
import udpControllerV10
def test():
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['Property']
if own['active'] is True:
own.worldPosition.z = 2
#contact java
#make dino interactable with other dinos AIs
if own['active'] is False:
own.w... |
#!/usr/bin/env python
import unittest
from urllib2 import urlopen
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from lib import key
class TestCase(unittest.TestCase):
def test_hash(self):
# from RFC 6070
for args in [(
'passwo... |
"""Functional tests for Course Builder."""
__author__ = [
'John Orr (<EMAIL>)'
]
import os.path
import random
import time
import pageobjects
from selenium import webdriver
from selenium.webdriver.chrome import options
from tests import suite
class BaseIntegrationTest(suite.TestBase):
"""Base class for all i... |
"""XLIFF classes specifically suited for handling the PO representation in
XLIFF.
This way the API supports plurals as if it was a PO file, for example.
"""
from lxml import etree
import re
from translate.misc.multistring import multistring
from translate.storage import base, lisa, poheader, xliff
from translate.sto... |
import unittest
import abstract
from soyprice.model import database as db
from soyprice.model.soy import Afascl
import datetime
import requests
class TestAfascl(abstract.TestCase):
def setUp(self):
self.remove('cache*')
self.cache = db.open()
self.var = Afascl(self.cache)
self.dat... |
from Crypto.Util.number import *
class Key:
def __init__(self, bits):
assert bits >= 512
self.p = getPrime(bits)
self.q = getPrime(bits)
self.n = self.p * self.q
self.e = 0x100007
self.d = inverse(self.e, (self.p-1)*(self.q-1))
self.dmp1 = self.d%(self.p-1)
... |
# Testing libraries
import unittest
try:
import coverage
has_coverage = True
except ImportError:
has_coverage = False
# Modules used in testing
import ui
import ui2
import ui2.ui_io
import os
LOCALDIR = os.path.abspath(os.path.dirname(__file__))
class TestDump(unittest.TestCase):
""" Test ui2.dump_v... |
#!/usr/bin/env python
"""
Checks for memory leak in the JVM when pushing array data from Python to Java.
"""
import pytest
import jpype
#!!! These settings are finely tuned !!!
#!!! DO NOT fiddle with them unless you know what you are doing !!!
# Size of array to be copied.
ARRAY_SIZE = 4000000
# Number of iter... |
"""A model for storing information about how specific images should
be cached on slaves. This helps with always having the correct image
ahead of time as well as garbage collecting unneeded images on slaves.
"""
from __future__ import absolute_import
from sqlalchemy import Column, DateTime, ForeignKey
from sqlalchemy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.