content
string
from hazelcast.serialization.bits import * from hazelcast.protocol.client_message import ClientMessage from hazelcast.protocol.custom_codec import * from hazelcast.util import ImmutableLazyDataList from hazelcast.protocol.codec.map_message_type import * REQUEST_TYPE = MAP_EXECUTEONKEYS RESPONSE_TYPE = 117 RETRYABLE = ...
from tquakes import * from matplotlib import use use('Agg') import matplotlib.pyplot as plt def plot(quakeid,component): # ############################################################ # COMPONENT # ############################################################ info=COMPONENTS_DICT[component] compnum=...
{ 'name': 'XMLRPC Printer', 'version': '0.1', 'category': 'MRP', 'description': ''' Agent installed on Windows machine with printer The machine will be used from print operation during line PHP page work ''', 'author': 'Micronaet S.r.l. - Nicola Riolini', ...
#!/usr/bin/python # -*- coding: utf-8 -*- ## Add path to library (just for examples; you do not need this) import sys, os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) ## This example uses a ViewBox to create a PlotWidget-like interface #from scipy import random import numpy as np from pyqtg...
""" Model for tree views. """ # Enthought library imports. from traits.api import Any, HasTraits, Event # Local imports. from node_event import NodeEvent class TreeModel(HasTraits): """ Model for tree views. """ #### 'TreeModel' interface ################################################ # The root of...
#!/usr/bin/python import sys sys.path.append('./') import model import sqlite3 as sqlite import getpass import role conn = sqlite.connect('_changui.db') c = conn.cursor() c.execute(''' create table sessions ( session_id char(128) UNIQUE NOT NULL, atime timestamp NOT NULL default current_timestam...
#!/usr/bin/env python import sys import json import urllib2 import argparse from operator import itemgetter from prettytable import PrettyTable AWE_URL = 'https://awe.mg-rast.org' MGP = { 'mgrast-prod-4.0.3': [ 'qc_stats', 'adapter trim', 'preprocess', 'dereplication', 'scr...
#!/usr/bin/env python # coding: utf-8 from matplotlib import pyplot as plt import argparse def parse_line(line): return list(map(float, line.strip().split())) def process_lines(lines): results = dict() assert(lines[0].startswith('dataset No.')) for i, measure in enumerate(('RD', 'RR', 'RC')): ...
# coding: utf-8 """ Error models for experiments """ from __future__ import division, print_function __author__ = "adrn <<EMAIL>>" # Standard library import os, sys import copy # Third-party import numpy as np import astropy.units as u # Project from .. import usys from gary.observation import apparent_magnitude ...
import os import sys from json import dumps as json_encode try: # pragma: no cover from collections import OrderedDict except ImportError: # pragma: no cover from ordereddict import OrderedDict from argparse import ArgumentParser, RawTextHelpFormatter from bisect import insort from io import BytesIO fro...
# The Computer Language Benchmarks Game # http://shootout.alioth.debian.org/ # contributed by Dominique Wahli # 2to3 # modified by Justin Peel from sys import stdin,stdout, path import os path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) from pcre_re import sub, findall def main(): seq = stdin.r...
from __future__ import absolute_import import uuid import ldap from keystone import clean from keystone.common import dependency from keystone.common import ldap as common_ldap from keystone.common import models from keystone.common import utils from keystone import config from keystone import exception from keystone...
from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin from django.http import Http404, HttpResponseNotAllowed, HttpResponseRedirect from django.views import generic from inboxen import models from inboxen.search.tasks import search_home_page from inboxen.search.utils import create_...
from __future__ import unicode_literals import os import copy import unittest import subprocess import tempfile import shutil def _add_to_file(path, content): """Util function to append to file to get a modification""" with open(path, 'ab') as fhand: fhand.write(content.encode('UTF-8')) def _create...
# -*- coding: utf-8 -*- from django.conf import settings # noqa from django.utils.translation import ugettext_lazy as _ from appconf import AppConf class DjangoCMSYoutubeConf(AppConf): PLUGIN_MODULE = _('Generic') PLUGIN_NAME = _('Youtube') FIELDSETS = None PAGE_ONLY = False PARENT_CLASSES = N...
# -*- coding: utf-8 """The library to focus on a single bin or multiple bins. The default client of this library is bin/anvi-refine-bin.""" import os import textwrap import anvio import anvio.dbops as dbops import anvio.terminal as terminal import anvio.constants as constants import anvio.clustering as clustering i...
from know_me.journal import serializers def test_serialize( api_rf, entry_comment_factory, entry_factory, image, serialized_time ): """ Test serializing a journal entry. """ entry = entry_factory(attachment=image) api_rf.user = entry.km_user.user request = api_rf.get(entry.get_absolute_url...
"""Tests for placeholder quality checks.""" from weblate.checks.flags import Flags from weblate.checks.models import Check from weblate.checks.placeholders import PlaceholderCheck, RegexCheck from weblate.checks.tests.test_checks import CheckTestCase, MockUnit from weblate.trans.models import Unit class Placeholder...
""" SALTS XBMC Addon Copyright (C) 2014 tknorris 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 later version. T...
#!/usr/bin/env python import optparse import os import shutil import sys import unittest def collect(): import tests runtests(tests, 1) def runtests(suite, verbosity): results = unittest.TextTestRunner(verbosity=verbosity).run(suite) return results.failures, results.errors def get_option_parser(): ...
import calendar import errno import os import time from .util import fbTimeFmt, time2utcstr, date2str, size2str, debug_log # FileSpec fields: # path - string, relative to some (externally defined) rootdir # user - string # group - string # size - in bytes # mtime - seconds since epoch # perms - string, in ls -l forma...
import proto # type: ignore from google.ads.googleads.v8.enums.types import extension_setting_device from google.ads.googleads.v8.enums.types import extension_type as gage_extension_type __protobuf__ = proto.module( package='google.ads.googleads.v8.resources', marshal='google.ads.googleads.v8', manifest...
from odoo.tests import Form, common class TestPortalPartnerSelctAll(common.TransactionCase): def setUp(self): super().setUp() Partner = self.env["res.partner"] self.partner1 = Partner.create({"name": "P1", "email": "p1@p1"}) self.partner2 = Partner.create({"name": "P2", "email": "...
import PIL from PIL import Image import numpy as np from os import listdir import operator text_file_name = '' def classify0(inX, dataSet, labels, k): # inX - input vector to classify # dataSet - training examples # labels - vector of lables # k - no.of nearest neghbours to use dataSetSize = dataSet.shape[0] #s...
#!/usr/bin/env python # -*- coding: utf-8 -*- __licence__ = """ Copyright (C) 2009 Mikhail Ryzhov <<EMAIL>> 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. This pro...
#! /usr/bin/env python '''Wallet functionality tests.''' """BitcoinCoreNoHistoryInterface functionality tests.""" from commontest import create_wallet_for_sync import pytest from jmbase import get_log from jmclient import (load_test_config, SegwitLegacyWallet, SegwitWallet, jm_single) from jmbi...
# coding: UTF-8 """ Created on 2014-9-25 @author: bxu """ import smtplib from email.mime.text import MIMEText from email.header import Header def send_mail_test(): e = EasyMail() e.mailto_list = ['<EMAIL>'] e.mail_host = "smtp.163.com" # 设置服务器 e.mail_user = "forestsheep" # 用户名 e.mail_pass = "x...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import date from flask import url_for from udata.core.site.models import Site from udata.core.site.metrics import SiteMetric from udata.core.site.views import current_site from udata.core.site.factories import SiteFactory from udata.core.d...
""" An example of a hierarchy of cortical regions in a Network. There are two levels in this demo each with a Spatial Pooler, Temporal Memory, and a classifier. Anomaly scores are output to a file while classification scores are output to console. """ import copy import csv import json import os import math from pkg_...
''' TestStoragePath =============== Tested platforms: * macOS ''' import unittest from plyer.tests.common import platform_import, PlatformTest class TestStoragePath(unittest.TestCase): ''' TestCase for plyer.storagepath. ''' @PlatformTest('macosx') def test_storagepath_macosx(self): '...
import jsonrpclib import ConfigParser, sys, os.path, logging import poster import pyDes, hashlib, base64 from urllib2 import Request, urlopen, URLError, HTTPError import progressbar class NullHandler(logging.Handler): def emit(self, record): pass logger = logging.getLogger('AgileCLU') logger.addHandler(N...
#!/usr/bin/env python2 from __future__ import division from __future__ import with_statement from __future__ import print_function import sys import numpy as np import scipy.optimize import Queue import time import threading import minimize import threadparallel import math def witness_fn(r,x,P,Q,rbf_var,weight): ...
#!/usr/bin/python """ :: This experiment is used to study the transient response of circuits The effect of a level change in the input voltage is monitored using the oscilloscope. .. raw:: html <!-- Include the core jQuery and jQuery UI --> <script type='text/javascript' src="http://ajax.googleapis.com/ajax/...
""" This is a roll the dice game. The program asks a participant to guess the roll of the dice. If the guess is larger than the roll, the participant wins. If not, the computer wins. """ from random import randint from time import sleep # Let's create spacing print "\n" * 1 # Game start print "Welcome to the Roll ...
import sys import string import re import psycopg2 # workaround for python-psycopg2 = 2.0.13 (RHEL6) # which does not import extensions by default if not hasattr(psycopg2, 'extensions'): import psycopg2.extensions import sql_base from rhn.UserDictCase import UserDictCase from spacewalk.server import rhnSQL from s...
import sublime import sublime_plugin import re try: from StatusMessage import status_message except ImportError as error: sublime.error_message("Dependency import failed; please read readme for " + "StatusMessage plugin for installation instructions; to disable this " + "message remove this plugin; message: ...
import subprocess import os, argparse, re class EFIImage: def __init__(self, image, size): """ Size in MiB """ self._image = image # Size of the disk self._sizeMB= size * 1024 * 1024 # block size self._blockSize = 512 # size of the disk in bl...
#!/usr/bin/python import base64 import ConfigParser import logging import simplejson as json import sys import urllib2 CONF_FILE = '/etc/zabbix/check_rabbit.conf' LOGGING_LEVELS = { 'CRITICAL': logging.CRITICAL, 'WARNING': logging.WARNING, 'INFO': logging.INFO, 'DEBUG': logging.DEBUG } def get_logger...
"""Add ip_learning flag to BridgeDomain Revision ID: ab95bd6852e8 Revises: acebbacca3666 Create Date: 2017-04-11 12:23:39.608507 """ # revision identifiers, used by Alembic. revision = 'ab95bd6852e8' down_revision = 'acebbacca3666' branch_labels = None depends_on = None from alembic import op import sqlalchemy as s...
import socket, sys, threading, time, pickle from random import randint class Player: def __init__(self): self.posX = int(0) self.posY = int(0) self.name = "p" def getInt(limit,mini,text): #Locks user in a while loop until conditions of user input is meet. while True: try: ...
# -*- coding: utf-8 -*- import json import morepath from .app import App from . import model def render_json(content, request): response = morepath.Response( json.dumps( morepath.generic.dump_json( request, content, lookup=request.lookup ), indent=2, sort_keys=True...
import json, os, urllib, urlparse def redirect(url, response): response.add_required_headers = False response.writer.write_status(301) response.writer.write_header("access-control-allow-origin", "*") response.writer.write_header("location", url) response.writer.end_headers() response.writer.wri...
from ..utility import settings from ..psdl import lightcmd from ..psdl import materialcmd from ..psdl.cmd import RawCommand from .export import naming from .. import utility from ..psdl import clause from ..psdl.pysdl import ( SDLReal, SDLVector3, SDLQuaternion, SDLString, SDLReference, SDLLightSource) from ..p...
#!/usr/bin/python # -*- coding: utf-8 -*- r""" Template harvesting script. Usage: * python pwb.py harvest_template -transcludes:"..." \ template_parameter PID [template_parameter PID] * python pwb.py harvest_template [generators] -template:"..." \ template_parameter PID [template_parameter PID] This will wor...
from glanceclient.v1 import images from openstack_horizon.test.test_data import utils class Namespace(dict): def __repr__(self): return "<Namespace %s>" % self._info def __init__(self, info): super(Namespace, self).__init__() self.__dict__.update(info) self.update(info) ...
# encoding: latin2 """Self Organizing Maps """ __author__ = "Juan C. Duque, Alejandro Betancourt" __credits__ = "Copyright (c) 2009-10 Juan C. Duque" __license__ = "GPL" __version__ = "1.0.0" __maintainer__ = "RiSE Group" __email__ = "<EMAIL>" import sys import os path = os.path.split(__file__)[0] path = os.path.split...
# JN 2016-01-12 """ manage spikes for data viewer """ import os from .tools import debug class SpikeManager(object): """ Represent spikes for data viewer """ def __init__(self, sign, label): self.fnames = {} self.openfiles = {} self.times = {} self.spikes = {} s...
import unittest from neo4j.contextmanager import Neo4jDBConnectionManager class TestConnectionManager(unittest.TestCase): def setUp(self): self.manager = Neo4jDBConnectionManager("http://localhost:7474", "neo4j", "testing") def test_commit(self): # Given with self.manager.write as c...
#!/usr/bin/env python import os import unittest import bot import unsubscribe import email import random import sys import jinja2 class GnuPGTest(unittest.TestCase): def setUp(self): # test keys self.public_key = open('test/keys/public.key').read() self.private_key = open('test/keys/privat...
from __future__ import unicode_literals from datetime import timedelta from django.utils import timezone from djcelery_transactions import task from redis_cache import get_redis_connection from .models import WebHookEvent, WebHookResult, COMPLETE, FAILED, ERRORED, PENDING @task(track_started=True, name='deliver_even...
from nova.tests import fixtures from nova.tests.functional.notification_sample_tests \ import notification_sample_base from nova.tests.unit import fake_notifier class TestServerGroupNotificationSample( notification_sample_base.NotificationSampleTestBase): def setUp(self): self.flags(use_neutr...
import sys import os sys.path.insert(0, os.path.abspath('..')) # from pprint import pprint as p # p(sys.path) from exploredata.order import ExploreOrder from exploredata.traffic import ExploreTraffic from exploredata.weather import ExploreWeather from prepareholdoutset import PrepareHoldoutSet from utility.datafilep...
import xmlrpc.client import http.client import hashlib from os.path import isabs, isfile import time import bpy from .utils import _read_credentials from .rpc import rffi, _do_refresh, rffi_xmlrpc_upload, rffi_xmlrpc, RFFI_VERBOSE def _random_string(length): import string import random return ''.join(ran...
import os from setuptools import setup, find_packages from subprocess import check_output from subprocess import CalledProcessError setup_path = os.path.dirname(__file__) print("setup_path: {}".format(setup_path)) def read(fname): return open(os.path.join(setup_path, fname)).read() MAJOR_VERSION = 0 MINOR_VERSI...
import unittest import tests from tests import skipUnlessGIVersionAtLeast, skipIfGI, skipIfGIVersion import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GLib, GObject, Pango from pgi import _compat try: from gi.repository import GIMarshallingTests GIMarshallingTests except ImportError: ...
"""Tests for flavor basic functions""" from nova.compute import flavors from nova import context from nova.db import api as db from nova import exception from nova import objects from nova.objects import base as obj_base from nova import test class TestValidateExtraSpecKeys(test.NoDBTestCase): def test_flavor_v...
#!/usr/bin/env python from xml.dom import minidom, Node from os.path import join import xml.dom import urllib import sys import argparse def remove_blanks(node): for x in node.childNodes: if x.nodeType == Node.TEXT_NODE: if x.nodeValue: x.nodeValue = x.nodeValue.strip() elif x.nodeType == Node.ELEMENT_NODE...
"""Unittests for the partial_mock test helper code.""" import os import sys sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')) from chromite.lib import cros_test_lib from chromite.lib import partial_mock # pylint: disable=W0212 class ComparatorT...
import re from collections import defaultdict def GetCounterSetting(counter_spec, name): """ Retrieve a particular setting from a counter specification; if that setting is not present, return None. :param counter_spec: A dict of mappings from the name of a setting to its associated value. :param name:...
""" Management class for host-related functions (start, reboot, etc). """ from nova.compute import task_states from nova.compute import vm_states from nova import conductor from nova import context from nova import exception from nova.objects import instance as instance_obj from nova.openstack.common.gettextutils impo...
""" Client library for the Evidential Tool Bus (ETB) This library can be used to write client tools for the ETB. The class ETBClient provides a command line parser that recognizes standard ETB client options such as ETB host and ETB port. It also provides a method to get a proxy to the ETB. .. Copyright (C) 2013 ...
import os import sys import time import six import numpy as np import math import argparse import paddle import paddle.fluid as fluid import time import utils import net SEED = 102 def parse_args(): parser = argparse.ArgumentParser("TagSpace benchmark.") parser.add_argument( '--neg_size', type=int, d...
""" Django settings for vk_parser project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) ...
from navitiacommon import models from tyr import tasks import logging from tyr import manager from tyr.helper import get_instance_logger, wait_or_raise @manager.command def import_last_dataset( instance_name, background=False, reload_kraken=False, custom_output_dir=None, nowait=False, allow_mimir=False ): """...
"""This module contains function of computing rank scores for documents in corpus and helper class `BM25` used in calculations. Original algorithm descibed in [1]_, also you may check Wikipedia page [2]_. .. [1] Robertson, Stephen; Zaragoza, Hugo (2009). The Probabilistic Relevance Framework: BM25 and Beyond, ...
"""Tasks for OAuth services.""" import logging from allauth.socialaccount.providers import registry as allauth_registry from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from readthedocs.core.utils.tasks import PublicTask, user_id_matches from readthedocs.oauth.notif...
# -*- coding: utf-8 -*- # # Canner documentation build configuration file, created by # sphinx-quickstart on Fri Nov 21 07:38:16 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleab...
import abc import typing import pkg_resources import google.auth # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.ads.googleads.v8.resources.types import...
""" A custom YAML based on PyYAML, that provides Ordered Dicts """ # Most ideas for this implementation comes from http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts from collections import OrderedDict import yaml as original_yaml def load(stream): """ Par...
from barbicanclient import client as barbicanclient from keystoneauth1 import loading from oslo_config import cfg class BarbicanClient(object): """Barbican client wrapper so we can encapsulate logic in one place.""" def __init__(self, verify=True): self._admin_client = None @property def ad...
#-*- coding: cp936 -*- import math from PIL import Image def spherize(image): ''' @Ч¹û£ºÇòÃæ£¬¶ÔͼÏñ½øÐÐÇòÃæÌØÐ§´¦Àí(¹þ¹þ¾µ) @param image: instance of Image @return: instance of Image ''' width, height = image.size mid_x = width / 2 mid_y = height / 2 # modified max_mid_...
import os import glob from config import conf def do_fixups(): for template in \ glob.glob(os.path.join("poller", "for-testing", "*.TEMPLATE")) + \ glob.glob(os.path.join("poller", "for-release", "*.TEMPLATE")) + \ glob.glob(os.path.join("pov", "*.TEMPLATE")) + \ glob.glob(os.path.join("lib", "*.TEMPLATE")):...
"""Setup file for pygit2.""" from __future__ import print_function import codecs from distutils.core import setup, Extension, Command from distutils.command.build import build from distutils.command.sdist import sdist from distutils import log import os import shlex from subprocess import Popen, PIPE import sys impor...
from .catom import ( Member, DEFAULT_FACTORY, DEFAULT_VALUE, USER_DEFAULT, VALIDATE_INSTANCE, USER_VALIDATE ) class Instance(Member): """ A value which allows objects of a given type or types. Values will be tested using the `PyObject_IsInstance` C API call. This call is equivalent to `isinstance...
from redis import Redis from datetime import datetime from rq import Queue from apscheduler.schedulers.blocking import BlockingScheduler from senders.console_output import Sender import json import logging from importlib import import_module from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor...
from __future__ import division from . import command from . import confreader from . import drawer from . import configurable from . import window class Gap(command.CommandObject): """ A gap, placed along one of the edges of the screen. If a gap has been defined, Qtile will avoid covering it wit...
""" Support for Xiaomi Mi Air Purifier 2. For more details about this platform, please refer to the documentation https://home-assistant.io/components/fan.xiaomi_miio/ """ import asyncio from functools import partial import logging import os import voluptuous as vol from homeassistant.helpers.entity import ToggleEnt...
from setuptools import find_packages, setup from io import open import re import os.path # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-monitor" PACKAGE_PPRINT_NAME = "Monitor" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/') # a-b-c => a.b.c namespace_na...
from setuptools import setup import os def read(*names): values = dict() for name in names: filename = name + '.rst' if os.path.isfile(filename): fd = open(filename) value = fd.read() fd.close() else: value = '' values[name] = valu...
from sqlalchemy.interfaces import ConnectionProxy from sqlalchemy.engine.default import DefaultDialect from sqlalchemy.engine.base import Connection from sqlalchemy import util import re class AssertRule(object): def process_execute(self, clauseelement, *multiparams, **params): pass def process_cursor...
"""Test Chern plotting function.""" # pylint: disable=redefined-outer-name,unused-argument,unused-wildcard-import,unexpected-keyword-arg import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import z2pack from plottest_helpers import * from monkeypatch_data import * def test_chern_plot(assert_ima...
class UnpackableMixin(object): """ This mixin class provides a classmethod from_data to unpack raw data into a python object. There is some requirements: - child class MUST define a format string for unpack in the class attribute "unpack_format" (see the struct module documentation) - ...
import os import re import shutil import pytest from dvc.info import get_dvc_info # Python's version is in the shape of: # <major>.<minor>.<patch>[{a|b|rc}N][.postN][.devN] # `patch` is more than enough for the tests. # Refer PEP-0440 for complete regex just in-case. PYTHON_VERSION_REGEX = r"Python \d\.\d+\.\d+\S*" ...
import logging from ....simos import SimWindows from .resolver import IndirectJumpResolver l = logging.getLogger("angr.analyses.cfg.indirect_jump_resolvers.x86_pe_iat") class X86PeIatResolver(IndirectJumpResolver): def __init__(self, project): super(X86PeIatResolver, self).__init__(project, timeless=Tru...
#!/usr/bin/python3 """ A script to determine the minimum number of mkdirs required to recreate a directory tree """ def parse_location(address): if address.endswith('/'): return tuple(address.strip('\n').split('/')[1:-1]) else: return tuple(address.strip('\n').split('/')[1:]) def create_direc...
"""Logging part of workflows module.""" import logging def get_logger(logger_name, db_handler_obj, level=10, **kwargs): """ Initialize and return a Python logger object. You can specifiy the handlers to output logs in sys.stderr as well as the datebase or anything you want. """ logging.basic...
import numpy as np import unittest from optpy import optimization class TestFunctionWithApproxJacobian(unittest.TestCase): def test_function(self): def f(x): return np.sum(x**2) func = optimization.FunctionWithApproxJacobian(f, epsilon=1e-8) point = np.array([1.0, 2.0, 3.0]) ...
import distutils.core import distutils.errors import os import subprocess from distutils.command.build import build as du_build from setuptools.command.build_py import build_py as st_build_py from . import excludes, resource_building class BuildCommand(du_build): command_name = 'build' def get_sub_commands...
import tornado.iostream from waterbutler.server import settings CORS_ACCEPT_HEADERS = [ 'Range', 'Content-Type', 'Authorization', 'Cache-Control', 'X-Requested-With', 'X-CSRFToken', ] CORS_EXPOSE_HEADERS = [ 'Range', 'Accept-Ranges', 'Content-Range', 'Content-Length', 'Con...
import os import platform import setuptools # PYPY vs cpython if platform.python_implementation() == 'PyPy': install_requires = ['psycopg2cffi>=2.7.2,<2.9'] else: install_requires = ['psycopg2>=2.5.1,<2.9'] # Install tornado if generating docs on readthedocs if os.environ.get('READTHEDOCS', None) == 'True': ...
#! /usr/bin/env python # -*- coding: UTF-8 -*- """ Clustering Version 2 ===================== After Feature Extraction, that returns a data of the format [(filename, linenum, vote, sentence, feat1, feat2, ...)] Improving the initial clustering mechanism (via R scripts) to SciKit based clustering and producing plots F...
#!/usr/local/bin/python3 def main(): # Test suite tests = [ [None, None], # Should throw a TypeError [5, 7, 12], [-5, -7, -12], [5, -7, -2] ] for item in tests: try: temp_result = sum_two(item[0], item[1]) if temp_result == item[2]: ...
import io import os import setuptools # Package metadata. name = 'google-cloud-redis' description = 'Google Cloud Memorystore for Redis API client library' version = '0.2.0' # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' # 'Development Status :: 5 - Production/Stable' rel...
import cv2 def draw_faces(faces, img): "Draws rectanges around faces" for (x, y, w, h) in faces: cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2) def drawString(text, img, coord, color, fontScale, fontFace, thickness): # Get the text size & baseline. textSize, baseline = cv2.getText...
import util import functools from pacardLogicGenerators import * class Labels: """ Labels describing the WumpusWorld """ WUMPUS = 'w' TELEPORTER = 't' POISON = 'p' SAFE = 'o' """ Some sets for simpler checks >>> if literal.label in Labels.DEADLY: >>> # Don't go there!!...
"""Entry point for flask app""" # pylint: disable=C0413,E0611 import time import jinja2 from flask import g from flask import Flask from typing import Tuple from urllib.parse import urlparse from utility import formatting from wqflask.markdown_routes import glossary_blueprint from wqflask.markdown_routes import refere...
import ldap from OpenSSL import crypto from barbican.common import exception as excep from barbican.common import hrefs import barbican.common.utils as utils from barbican.model import models from barbican.model import repositories as repos from barbican.plugin.interface import certificate_manager as cert from barbica...
from rpython.rlib.rrawarray import copy_list_to_raw_array, \ populate_list_from_raw_array from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.test.tool import BaseRtypingTest class TestRArray(BaseRtypingTest): def test_copy_list_to_raw_array(self): ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from collections import namedtuple from pants.base.deprecated import deprecated, deprecated_conditional from pants.util.dirutil import longest_dir_prefix fr...
import backscatter.fitacf.leastsquares as ls import numpy as np import math class ACFFitting(object): """This class is a container for methods that initiate fitting to the data There are static methods to perform fits for power, velocity and elevation, as well the methods to calculate sigmas and unwr...