code
stringlengths
1
199k
import initial_sharding import utils from vtdb import keyrange_constants if __name__ == '__main__': initial_sharding.keyspace_id_type = keyrange_constants.KIT_BYTES utils.main(initial_sharding)
from ajenti.com import * class IDNSConfig(Interface): nameservers = None def save(self): pass class Nameserver: cls = '' address = ''
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest from mock import ANY from ansible.module_utils.network.fortios.fortios import FortiOSHandler try: from ansible.modules.network.fortios import fortios_system_dscp_based_priority except ImportEr...
import sys import logging from website.app import setup_django setup_django() from scripts import utils as script_utils from osf.models import AbstractNode from framework.database import paginated logger = logging.getLogger(__name__) def main(dry=True): count = 0 for node in paginated(AbstractNode, increment=10...
"""Lifted from: http://stackoverflow.com/questions/18671/quick-easy-way-to-migrate-sqlite3-to-mysql Run like so: sqlite3 <your db>.db .dump | python sqlite2mysql.py > <your db>.sql Then you can import the .sql file into MySql Note - you need to add foreign key constrains manually since sqlite doesn't actually support t...
""" Generic Unification algorithm for expression trees with lists of children This implementation is a direct translation of Artificial Intelligence: A Modern Approach by Stuart Russel and Peter Norvig Second edition, section 9.2, page 276 It is modified in the following ways: 1. We allow associative and commutative C...
from __future__ import print_function import logging from optparse import OptionParser import os import re import subprocess import sys import tempfile from threading import Thread, Lock import time if sys.version < '3': import Queue else: import queue as Queue sys.path.append(os.path.join(os.path.dirname(os.pa...
from django.test import TestCase from .models import Guitarist class PermalinkTests(TestCase): urls = 'model_permalink.urls' def test_permalink(self): g = Guitarist(name='Adrien Moignard', slug='adrienmoignard') self.assertEqual(g.url(), '/guitarists/adrienmoignard/') def test_wrapped_docstr...
from sympy import exp, integrate, oo, S, simplify, sqrt, symbols from sympy.physics.hydrogen import R_nl, E_nl, E_nl_dirac from sympy.utilities.pytest import raises n, r, Z = symbols('n r Z') def feq(a, b, max_relative_error=1e-12, max_absolute_error=1e-12): a = float(a) b = float(b) # if the numbers are cl...
class CyclicDependencyError(ValueError): pass def topological_sort_as_sets(dependency_graph): """ Variation of Kahn's algorithm (1962) that returns sets. Take a dependency graph as a dictionary of node => dependencies. Yield sets of items in topological order, where the first set contains all no...
"""Testing for Gaussian process classification """ import numpy as np from scipy.optimize import approx_fprime from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C from sklearn.utils.testing import (assert_true, assert_greater, assert_equal...
import os import time import json TIME_FORMAT="%b %d %Y %H:%M:%S" MSG_FORMAT="%(now)s - %(category)s - %(data)s\n\n" if not os.path.exists("/var/log/ansible/hosts"): os.makedirs("/var/log/ansible/hosts") def log(host, category, data): if type(data) == dict: if 'verbose_override' in data: # a...
from oslo.config import cfg from nova import context from nova import exception from nova.openstack.common.gettextutils import _ from nova.openstack.common import log as logging from nova.virt.baremetal import db as bmdb CONF = cfg.CONF LOG = logging.getLogger(__name__) class BareMetalVIFDriver(object): def _after_...
"""This is here so nose coverage considers these packages part of zamboni."""
import mock import testtools from neutron.callbacks import exceptions from neutron.callbacks import registry from neutron import context from neutron.db import common_db_mixin from neutron.db import securitygroups_db from neutron.extensions import securitygroup from neutron.tests.unit import testlib_api class SecurityG...
""" Dataset preloading tool This file provides the ability to make a local cache of a dataset or part of it. It is meant to help in the case where multiple jobs are reading the same dataset from ${PYLEARN2_DATA_PATH}, which may cause a great burden on the network. With this file, it is possible to make a local copy (in...
import new, re, sys, types class GlueError(Exception): pass class RecursionError(GlueError): pass class NoSuchAttributeError(GlueError): pass def ispackage(m): """ Determine if a module is a package - that means, sub-modules can be imported Currently uses that it has a file name that matches '.*__in...
"""Invenio Alert Engine config parameters.""" __revision__ = \ "$Id$" CFG_WEBALERT_DEBUG_LEVEL = 0
"""The Flavor Disabled API extension.""" from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api.openstack import xmlutil authorize = extensions.soft_extension_authorizer('compute', 'flavor_disabled') class FlavorDisabledController(wsgi.Controller): def _extend_flavors(self, req,...
from django.db import models from djangotoolbox.fields import ListField from copy import deepcopy import re regex = type(re.compile('')) class LookupDoesNotExist(Exception): pass class LookupBase(type): def __new__(cls, name, bases, attrs): new_cls = type.__new__(cls, name, bases, attrs) if not ...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('zerver', '0034_userprofile_enable_online_push_notifications'), ] operations = [ migrations.AddField( model_name='realm', name='me...
import time from openerp.osv import osv from openerp.report import report_sxw class account_statement(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(account_statement, self).__init__(cr, uid, name, context=context) self.total = 0.0 self.localcontext.update({ ...
""" Testing some internals of the template processing. These are *not* examples to be copied in user code. """ from __future__ import unicode_literals from unittest import TestCase from django.template import (TokenParser, FilterExpression, Parser, Variable, Template, TemplateSyntaxError, Library) from django.test ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from itertools import izip_longest from ansible.errors import * from ansible.plugins.lookup import LookupBase from ansible.utils.listify import listify_lookup_plugin_terms class LookupModule(LookupBase): """ Transpose a list...
import warnings, sys, os from twisted.application import service, app from twisted.persisted import sob from twisted.python import usage, util from twisted import plugin from twisted.python.util import uidFromString, gidFromString IServiceMaker = service.IServiceMaker _tapHelper = service.ServiceMaker warnings.warn( ...
''' Extract _("...") strings for translation and convert to Qt4 stringdefs so that they can be picked up by Qt linguist. ''' from subprocess import Popen, PIPE import glob import operator import os import sys OUT_CPP="qt/bitcoinstrings.cpp" EMPTY=['""'] def parse_po(text): """ Parse 'po' format produced by xget...
"""A user-defined wrapper around string objects Note: string objects have grown methods in Python 1.6 This module requires Python 1.6 or later. """ import sys import collections __all__ = ["UserString","MutableString"] class UserString(collections.Sequence): def __init__(self, seq): if isinstance(seq, bases...
""" Doxygen support Variables passed to bld(): * doxyfile -- the Doxyfile to use When using this tool, the wscript will look like: def options(opt): opt.load('doxygen') def configure(conf): conf.load('doxygen') # check conf.env.DOXYGEN, if it is mandatory def build(bld): if bld.env.DOXYGEN: bld(features="...
""" Utility functions for handling images. Requires PIL, as you might imagine. """ from django.core.files import File class ImageFile(File): """ A mixin for use alongside django.core.files.base.File, which provides additional features for dealing with images. """ def _get_width(self): return...
""" This module contains all the 2D line class which can draw with a variety of line styles, markers and colors. """ from __future__ import division import numpy as np from numpy import ma from matplotlib import verbose import artist from artist import Artist from cbook import iterable, is_string_like, is_numlike, ls_m...
'''Wrapper for pulse Generated with: tools/genwrappers.py pulseaudio Do not modify this file. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: wrap.py 1694 2008-01-30 23:12:00Z Alex.Holkner $' import ctypes from ctypes import * import pyglet.lib _lib = pyglet.lib.load_library('pulse') _int_types = (c_int16, ...
from south.db import db from south.v2 import SchemaMigration class Migration(SchemaMigration): def forwards(self, orm): # Removing unique constraint on 'FacebookAccessToken', fields ['app', 'account'] db.delete_unique('facebook_facebookaccesstoken', ['app_id', 'account_id']) # Deleting model...
import os from django.conf import settings from django.db import models from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import default_storage, Storage, FileSystemStorage from django.utils.datastructures import SortedDict from django.utils.functional import memoize, LazyObject fro...
from collections import OrderedDict from test.test_json import PyTest, CTest CASES = [ ('/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'), ('\u0123\u4567\u89ab\ucdef\uab...
from sympy import Symbol, Function, exp, sqrt, Rational, I, cos, tan from sympy.utilities.pytest import XFAIL def test_add_eval(): a = Symbol("a") b = Symbol("b") c = Rational(1) p = Rational(5) assert a*b + c + p == a*b + 6 assert c + a + p == a + 6 assert c + a - p == a + (-4) assert a...
"""Contains classes representing Google Data elements. Extends Atom classes to add Google Data specific elements. """ __author__ = 'j.s@google.com (Jeffrey Scudder)' import os import atom try: from xml.etree import cElementTree as ElementTree except ImportError: try: import cElementTree as ElementTree excep...
""" Management command to seed default permissions and roles. """ from django.core.management.base import BaseCommand, CommandError from django_comment_common.utils import seed_permissions_roles from opaque_keys.edx.locations import SlashSeparatedCourseKey class Command(BaseCommand): args = 'course_id' help = '...
import subprocess import os import sys from openerp import report import tempfile import time import logging from functools import partial from report_helper import WebKitHelper import openerp from openerp.modules.module import get_module_resource from openerp.report.report_sxw import * from openerp import tools from o...
from __future__ import absolute_import from . import bryl
"""Base admin models.""" from django.db import models from django.utils import timezone from modoboa.lib.permissions import ( grant_access_to_object, ungrant_access_to_object ) class AdminObject(models.Model): """Abstract model to support dates. Inherit from this model to automatically add the "dates" featu...
try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() description = """ Octopus is a Python framework for microservices. """ requirements = [ # TODO: put package requirements here ] test_requirements = [...
from modoboa.lib.cryptutils import decrypt class ConnectionsManager(type): """ Singleton pattern implementation. This class is specialized in connection management. """ def __init__(self, name, bases, ctx): super(ConnectionsManager, self).__init__(name, bases, ctx) self.instances = {...
""" mod_upload Models =================== In this module, we are trying to maintain all models used for storing Test information, progress and report. List of models corresponding to mysql tables: ['Upload' => 'upload', 'QueuedSample' => 'upload_queue', 'UploadLog' => 'upload_log', 'FTPCredentials' => 'ftpd'] """ imp...
import sys S = 5#int(sys.argv[1]) np = int(sys.argv[1]) N = np * (np+1)/2 ips = [ '54.226.40.248', '35.167.90.45', '54.153.87.79', '35.157.55.160', '34.249.119.221', ] servers = [ '{"addrPub": "%s:%d", "addrPriv": "%s:%d"}' % (s, 9000+i, s, 9050+i) for (i,s) in enumerate(ips) ] print """ { "maxPendingReqs": %d, "client...
import common from common import asyncio_t import chan42, json import websockets from nose.tools import ok_, eq_, raises C = None R = None S = None def setup_module(): global C global R global S C, R, S = common.setup(client_class=None) def teardown_module(): common.teardown(C, S) @asyncio_t def tes...
from django.shortcuts import render, get_object_or_404, redirect from django.utils import timezone from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.views.generic.list import ListView from .models import Equipamento, Item, Fabricante, Tipo, TipoItens, Modelo from .forms import EquipFo...
import pytest from tests.factories.rule import QueryRuleFactory from tests.factories.segment import SegmentFactory @pytest.mark.django_db def test_request_query_rule(client, site): segment = SegmentFactory(name='Query') QueryRuleFactory( parameter="query", value="value", segment=segment,...
''' ''' from django.conf.urls import url from django.conf.urls import include from rest_framework import routers import views router = routers.DefaultRouter() router.register(r'plugin', views.PluginViewSet) router.register(r'scored_service', views.ScoredServiceViewSet) router.register(r'check', views.CheckViewSet) rout...
import yaml from flask import Flask, jsonify from importlib import import_module app = Flask(__name__) BREWERIES = None with open("lib/brewery/breweries.yaml", "r") as breweries: BREWERIES = yaml.load(breweries) @app.route('/<brewery_name>') def get_beers(brewery_name): try: m = import_module("lib.brewery.%s" % BRE...
from __future__ import unicode_literals import frappe from frappe.model.document import Document class NotificationSettings(Document): def on_update(self): from frappe.desk.notifications import clear_notification_config clear_notification_config(frappe.session.user) def is_notifications_enabled(user): enabled = f...
import os import sys try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup, find_packages setup( name='montage', version='2.0.0', author='Derek Payton', author_email='dpayton@mntge.com', description='Python bindings for Montage', long_descr...
from six import python_2_unicode_compatible from .base import QuickbooksBaseObject, Ref, CustomField, Address, EmailAddress, CustomerMemo, QuickbooksManagedObject, \ QuickbooksTransactionEntity, LinkedTxn, LinkedTxnMixin from .tax import TxnTaxDetail from .detailline import DetailLine class DeliveryInfo(QuickbooksB...
from functools import wraps from twilio.twiml.voice_response import VoiceResponse from twilio.twiml.messaging_response import MessagingResponse from twilio.request_validator import RequestValidator from flask import ( Flask, abort, current_app, request, ) import os app = Flask(__name__) def validate_twi...
import pytest import functools from datetime import date, time from devtools_testutils import recorded_by_proxy, set_bodiless_matcher from azure.ai.formrecognizer._generated.v2_1.models import AnalyzeOperationResult from azure.ai.formrecognizer._response_handlers import prepare_prebuilt_models from azure.ai.formrecogni...
"""Implementation of a Dakota PSUADE MOAT study. Description from the Dakota Reference Guide: https://dakota.sandia.gov/sites/default/files/docs/6.1/html-ref/method-psuade_moat.html "The Morris One-At-A-Time (MOAT) method, originally proposed by Morris [1991], is a screening method, designed to explore a computational ...
import datetime __all__ = [ 'info', ] def info(): return { 'birthday': datetime.date(1995, 11, 29), 'class': 10, 'family_name_en': u'abe', 'family_name_kana': u'あべ', 'first_name_en': u'maria', 'first_name_kana': u'マリア', 'gradua...
""" Shared settings """ REDIS_SOCKET_PATH = '/tmp/redis.sock' LOG_PATH = '/var/log/skyline' PID_PATH = '/var/run/skyline' FULL_NAMESPACE = 'metrics.' MINI_NAMESPACE = 'mini.' FULL_DURATION = 86400 MINI_DURATION = 3600 GRAPHITE_HOST = 'http://192.168.0.112' CARBON_PORT = 2003 OCULUS_HOST = 'http://your_oculus_host.com' ...
from PIL import Image i = Image.open("input.png") pixels = i.load() width, height = i.size j=Image.new(i.mode,i.size) def Truncate(value): if(value < 0): value = 0 if(value > 255): value = 255 return value brightness=input("Enter value to increase brightness int value") for x in range(width): for...
from django import forms from .models import Comment class EmailPostForm(forms.Form): name = forms.CharField(max_length=25) email = forms.EmailField() to = forms.EmailField() comments = forms.CharField(required=False, widget=forms.Textarea) class CommentForm(forms.ModelForm): class Meta: model = Comment field...
import typing as tp import functools as ft import builtins as py from .optional import Optional, optional from .types import Bool, Int T = tp.TypeVar('T') U = tp.TypeVar('U') def python_cmp(swift_cmp: tp.Callable[[T, T], Bool]) -> tp.Callable[[T, T], Int]: def cmp(x: T, y: T) -> Int: if swift_cmp(x, y): ...
from .handler import ToolkitGeometryNodeHandler
""" Created on Fri Oct 14 15:30:11 2016 @author: worm_rig """ import json import os import h5py import tables from tierpsy.analysis.compress.compressVideo import compressVideo, initMasksGroups from tierpsy.analysis.compress.selectVideoReader import selectVideoReader from tierpsy.helper.misc import TimeCounter, print_f...
def callMe(number, mylist): if number < 10: mylist.append(number+1) return callMe(number+1, mylist) mylist = [] callMe(2, mylist) print mylist
from django.contrib import admin from models import metadataModel class metadataModelAdmin(admin.ModelAdmin): model = metadataModel list_filter = ('username', 'finalized') list_display = ('identifier', 'username', 'finalized', 'started', 'modified') list_display_links = ('identifier', ) search_field...
from metamodel import * class DommExport(object): """docstring for DommExport""" def __init__(self,): super(DommExport, self).__init__() def render_enum(self, f, enum): """ This method renders Enumeration in dot format and writes into f buffer. It adds every literal name into...
from __future__ import division import decimal from collections import namedtuple from six import PY3 from .exchange_rates import get_exchange_rate from .exceptions import ExchangeError, MoneyError def round_amount(amount, currency): """Round a given amount using curreny's exponent. :param amount: :class:`~deci...
import wx from utils.storage import Storage from windows.mainWindow import MainWindow if __name__ == "__main__": app = wx.App() with Storage() as s: MainWindow(s) app.MainLoop()
from setuptools import Command, setup from setuptools import find_packages from unittest import TestLoader, TextTestRunner from os import environ, path PROJECT = 'carepoint' SHORT_DESC = ( 'This library will allow you to interact with a remote CarePoint ' 'instance using Python.' ) README_FILE = 'README.rst' ve...
import numpy as np import uncertainties.unumpy as unp from uncertainties.unumpy import (nominal_values as noms, std_devs as stds) import matplotlib.pyplot as plt import matplotlib as mpl from scipy.optimize import curve_fit plt.rcParams['figure.figsize'] = (12, 8) plt.rcParams['font.size'] = 13 plt.rcParams['lines.line...
from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentia...
''' Created on Feb 13, 2014 @author: magus0219 ''' from core.job import Job from core.jobmanager import JobManager from util.dateutil import DateUtil import unittest class JobManagerTest(unittest.TestCase): ''' TestCase of Job Manager ''' def setUp(self): self.jobmanager = JobManager() def t...
from django.db import models import datetime from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible class Category(models.Model): name = models.CharField(max_length=100) slug = models.SlugField(max_length=100, unique=True, verbose_name='slug') description = models.Te...
import os def bomze_matrices(filename="bomze.txt"): """ Yields the 48 matrices from I.M. Bomze's classification of three player phase portraits. """ this_dir, this_filename = os.path.split(__file__) handle = open(os.path.join(this_dir, filename)) for line in handle: a, b, c, d, e, f,...
from __future__ import division from builtins import str from builtins import range from past.utils import old_div import proteus from proteus.FemTools import QuadraticOnSimplexWithNodalBasis from proteus.FemTools import LagrangeOnCubeWithNodalBasis from proteus.FemTools import LinearOnCubeWithNodalBasis from proteus.F...
import sys import time import telepot from telepot.loop import MessageLoop from telepot.namedtuple import InlineQueryResultArticle, InputTextMessageContent def on_inline_query(msg): query_id, from_id, query_string = telepot.glance(msg, flavor='inline_query') print ('Inline Query:', query_id, from_id, query_stri...
class Solution(object): def removeBoxes(self, boxes): """ :type boxes: List[int] :rtype: int """ def dfs(array, memo, l, r, k): if l > r: return 0 if memo[l][r][k] != 0: return memo[l][r][k] while r > l and a...
from Tkinter import * class MyTab(Frame): def __init__(self, *args, **kwargs): Frame.__init__(self, *args, **kwargs) self.pack(fill=BOTH, expand=True) # options for Frame.pack self.frame_pack_options = options = {} options['side'] = TOP options['fill...
import arcpy from arcpy import env env.overwriteOutput = True InLayer = arcpy.GetParameterAsText(0) InField = arcpy.GetParameterAsText(1) SourceLayer = arcpy.GetParameterAsText(2) SourceField = arcpy.GetParameterAsText(3) SpatShip = arcpy.GetParameterAsText(4) MergeRule = arcpy.GetParameterAsText(5) SearchDist = arcpy....
import os.path import sys try: import configparser except ImportError: import ConfigParser as configparser from twisted.internet import reactor from twisted.python.log import startLogging from intercepting_proxy import InterceptingProxyFactory from update_modifier import WsusXmlModifier, FakeWsusUpdate PROXY_PO...
from datetime import datetime, timedelta from math import log epoch = datetime(1970, 1, 1) def epoch_seconds(date): """Returns the number of seconds from the epoch to date.""" td = date - epoch return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000) def score(ups, downs): return ups - d...
''' CodeGen ''' import sys import os import binascii python2=False if sys.version_info[0] < 3: python2=True try: from binaryninja import * except: print ("[+] Not running in BinaryNinja") class callConv(object): def __init__(self, name, arch): self.name = name self.arch = arch def gen...
import sys import django from django.template import TemplateDoesNotExist, loader from django_extensions.management.utils import signalcommand from django_extensions.compat import CompatibilityLabelCommand as LabelCommand def get_template_path(path): try: if django.VERSION < (1, 8): template = l...
from __future__ import unicode_literals from __future__ import absolute_import, division, print_function """ Tests for EntityData list view with additional inherited bibliography data """ __author__ = "Graham Klyne (GK@ACM.ORG)" __copyright__ = "Copyright 2014, G. Klyne" __license__ = "MIT (http://opensource...
__version__ = "0.1.10"
"""Some methods to help with the handling of dictionaries""" from collections import defaultdict from dataclasses import dataclass from typing import Any from yamlreader import data_merge def get_caselessly(dictionary, sought): """Find the sought key in the given dictionary regardless of case >>> things = {'Fre...
from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import jsonfield.fields from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ ...
import collections class Solution(object): def longestSubstring(self, s, k): """ :type s: str :type k: int :rtype: int """ starti = 0 maxlen = 0 l = len(s) counter = collections.defaultdict(int) incomplete = collections.defaultdict(int)...
import numpy as np import sympy from ..helpers import article from ._helpers import S2Scheme, register _source = article( authors=["J. Radon"], title="Zur mechanischen Kubatur", journal="Monatshefte für Mathematik", year="1948", volume="52", pages="286-300", issn="0026-9255", issne="1436...
import io import re import fire import logging logging.basicConfig( format='%(asctime)s [%(process)d] [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO) UNWANTED = re.compile('[^' '\u0000-\u007f\u0080-\u00ff\u0100-\u017F\u1E00-\u1EFF\u0180-\u024F' '\u2C60-\u2C7F\uA720-\uA...
""" Demonstrates a few common tricks with shaded plots. """ import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LightSource, Normalize def display_colorbar(): """Display a correct numeric colorbar for a shaded plot.""" y, x = np.mgrid[-4:2:200j, -4:2:200j] z = 10 * np.cos(x**2 +...
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.kodi, name='kodi'), url(r'^.*?_setserver_([0-9]+)$', views.setserver, name='setserver'), url(r'^addserver$', views.addserver, name='addserver'), # POST url(r'^removeserver$', views.removeserver, name='removeserver'), #...
import os import app_settings # this is our config. from flask import Flask from flask.ext.login import LoginManager from flask_wtf import CsrfProtect csrf = CsrfProtect() app = Flask(__name__) csrf.init_app(app) application_env = os.getenv('ADMIN_TOOL_ENV') if ( application_env and application_env == "production"): ...
from sb import * from ed import * from mathutil import * from dbg import * from log import * from timeutil import *
import ast import sys import os UP = 'U' DOWN = 'D' LEFT = 'L' RIGHT = 'R' TEAM_NAME = "Improved closest v2" allMoves = [RIGHT, UP, RIGHT, UP, RIGHT, UP, LEFT, UP, UP, RIGHT, RIGHT, RIGHT, UP, RIGHT, UP, RIGHT, RIGHT, UP] def debug (text) : # Writes to the stderr channel sys.stderr.write(str(text) + "\n") s...
import os import socket import subprocess import target import getpass from colorama import * from tkinter import * import cmd from start import ascii from backdoors import * from modules import * import importlib import inspect import sys import traceback from six.moves import input import six GOOD = Fore.GREEN + " + ...
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Gauge(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "indicator" _path_str = "indicator.gauge" _valid_props = { "axis", "bar", ...
import pytest import tomcatmanager as tm VERSION_VALUES = [None, '42'] def test_deploy_localwar_path_only(tomcat, safe_path): with pytest.raises(ValueError): r = tomcat.deploy_localwar(safe_path, None) with pytest.raises(ValueError): r = tomcat.deploy_localwar(safe_path, '') def test_deploy_loca...
import vcr class MockSerializer: def __init__(self): self.serialize_count = 0 self.deserialize_count = 0 self.load_args = None def deserialize(self, cassette_string): self.serialize_count += 1 self.cassette_string = cassette_string return {"interactions": []} ...
from __future__ import division import abc import sys import matplotlib.pyplot as plt from matplotlib import patches import numpy as np import numpy.random as rand import scipy.interpolate as intr class AbstractMetropolis(object): __metaclass__ = abc.ABCMeta def sample(self, steps, T, sample_rate=1, burn_in=0):...
""" WSGI config for myrig project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` set...