content
stringlengths
4
20k
# Django settings for GePTCOdont project. import os import Application DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '<EMAIL>'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'or...
# coding: utf-8 from __future__ import print_function import os import numpy as np import time np.random.seed(1337) from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.utils.np_utils import to_categorical from keras.layers import Dense, Flatten, Activation ...
import os import web global_server_instance = 0 def global_server (): global global_server_instance if global_server_instance == 0: global_server_instance = server (globals ()) return global_server_instance class server (object): def __init__ (self, global_vars): urls = ( ...
import argparse import codecs import re from nototools.py23 import unichr """Generate samples from a description file.""" USAGE = """ 'python generate_samples.py [options] description_file [output_file]' This uses a description file containing character patterns to generate text samples, writing them to output_file...
''' Provide a hook for supplying authorization mechanisms to a Bokeh server. ''' #----------------------------------------------------------------------------- # Boilerplate #----------------------------------------------------------------------------- import logging # isort:skip log = logging.getLogger(__name__) #-...
from assembly2.constraints.common import * from assembly2.constraints.circularEdgeConstraint import parseSelection from assembly2.importPart import duplicateImportedPart class CircularEdgeSelectionGate: def allow(self, doc, obj, sub): return CircularEdgeSelected( SelectionExObject(doc, obj, sub) ) class ...
""" tests.test_attrs ~~~~~~~~~~~~~~~~ Test Yaspin attributes magic hidden in __getattr__. """ import pytest from yaspin import yaspin from yaspin.constants import COLOR_MAP, SPINNER_ATTRS from yaspin.spinners import Spinners @pytest.mark.parametrize("attr_name", SPINNER_ATTRS) def test_set_spinner_by_name(attr_nam...
ADDED, REMOVED, INIT = range(3) PARTOF, VERSION, CONFLICT, DEPENDENCY, REQUIRES = range(5) class With: def __init__(self): pass def with_action(types, action, data): w = With() w.types = types w.action = action w.data = data return w def with_partof(partof): return with_action(PAR...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test of javac.py when building java code from derived sources. Original issue definition: Java emitter for derived sources outputs bogus class files. Repeatable with any N-tier, with N > 1, Java derived-source builds where any of the following conditi...
import os from sqlalchemy import create_engine from datetime import datetime import pandas as pd import bz2 def get_env_variable(var_name, default=-1): try: return os.environ[var_name] except KeyError: if default != -1: return default error_msg = "Set the %s os.environment v...
{ "name": "Employee Training - Allowance", "version": "8.0.1.3.0", "category": "Human Resource", "website": "https://opensynergy-indonesia.com", "author": "OpenSynergy Indonesia", "license": "AGPL-3", "installable": True, "depends": [ "hr_employee_training", "product", ...
import ast import fnmatch from bandit.core import issue def report_issue(check, name): return issue.Issue( severity=check.get('level', 'MEDIUM'), confidence='HIGH', text=check['message'].replace('{name}', name), ident=name, test_id=check.get("id", 'LEGACY')) def blacklist(context, confi...
"""EDNS Options""" from __future__ import absolute_import import math import struct import dns.inet #: NSID NSID = 3 #: DAU DAU = 5 #: DHU DHU = 6 #: N3U N3U = 7 #: ECS (client-subnet) ECS = 8 #: EXPIRE EXPIRE = 9 #: COOKIE COOKIE = 10 #: KEEPALIVE KEEPALIVE = 11 #: PADDING PADDING = 12 #: CHAIN CHAIN = 13 class O...
from enum import Enum from f5_openstack_agent.lbaasv2.drivers.bigip.utils import get_filter from oslo_log import log as logging LOG = logging.getLogger(__name__) class ResourceType(Enum): u"""Defines supported BIG-IP resource types.""" nat = 1 pool = 2 sys = 3 virtual = 4 member = 5 fol...
''' SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D. 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. ...
from test_framework import GreencoinTestFramework from greencoinrpc.authproxy import AuthServiceProxy, JSONRPCException from decimal import Decimal from util import * import os import shutil class TxnMallTest(GreencoinTestFramework): def add_options(self, parser): parser.add_option("--mineblock", dest="mi...
from telegram import ChatAction import utils import security import sqlite3 import configuration def send_broadcast_all(bot, update): bot.sendChatAction(chat_id=update.message.chat.id, action=ChatAction.TYPING) if utils.is_private(update.message) and security.is_authorized(update.message, 'admin'): c...
''' Created on 2015-05-11 @author: zhangxulong ''' """ This tutorial introduces logistic regression using Theano and stochastic gradient descent. Logistic regression is a probabilistic, linear classifier. It is parametrized by a weight matrix :math:`W` and a bias vector :math:`b`. Classification is done by projecting ...
""" Progress bars in Nuitka. This is responsible for wrapping the rendering of progress bar and emitting tracing to the user while it's being displayed. """ from nuitka import Tracing from nuitka.Tracing import general from nuitka.utils.Importing import importFromInlineCopy from nuitka.utils.ThreadedExecutor import ...
#-*- coding: iso-8859-2 -*- import sys import time from django.conf import settings from django.core.management import call_command from django.db.utils import load_backend from pycassa.types import * TEST_DATABASE_PREFIX = 'test_' class CassandraDatabaseCreation(object): data_types = { 'Au...
from __future__ import print_function from .enforce_target_file_presence import find_missing_target_files from .enforce_readme_content import verify_readme_content from .enforce_changelog_content import verify_changelog_content from .index_packages import index_packages, render from .WardenConfiguration import WardenC...
#!/usr/bin/env python """ Working with lxml. HTML elements have all the methods that come with ElementTree, but also include some extra methods (see http://lxml.de/lxmlhtml.html, section HTML Element Methods). Element: http://docs.python.org/library/xml.etree.elementtree.html#element-objects. """ from jabbapylib.w...
from __future__ import absolute_import from django.conf import settings from zerver.lib.response import json_error from django.db import connection from zerver.lib.utils import statsd from zerver.lib.queue import queue_json_publish from zerver.lib.cache import get_memcached_time, get_memcached_requests from zerver.lib...
import base64 import logging import pprint import re import werkzeug from odoo import _, http from odoo.exceptions import ValidationError from odoo.http import request from odoo.tools import ustr _logger = logging.getLogger(__name__) class OgoneController(http.Controller): _flexcheckout_return_url = '/payment/...
# Term Frequency Graph based on .jsonl data from TheRealDonaldTrump import sys import string import json from collections import Counter from nltk.tokenize import TweetTokenizer from nltk.corpus import stopwords import matplotlib.pyplot as plt def process(text, tokenizer=TweetTokenizer(), stopwords=[]): """Process...
from __future__ import (absolute_import, division, print_function) # Python import os # Ansible import ansible # Because of the way Ansible loads plugins, it's not possible to import # ansible.plugins.callback.minimal when being loaded as the minimal plugin. Ugh. with open(os.path.join(os.path.dirname(ansible.__file...
""" sentry.plugins.sentry_urls.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import sentry from django.utils.translation import ugettext_lazy as _ from sentry.plugins import register from sentry.pl...
# Automatically restart when the source code changes. # From http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode import os import sys import time import signal import threading import atexit import Queue _interval = 1.0 _times = {} _files = [] _running = False _queue = Queue.Queue() _lock = threading.Lock() d...
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import argparse import numpy as np import scipy.ndimage from google.protobuf import text_format #https://github.com/BVLC/caffe/issues/861#issuecomment-70124809 import matplotlib matplotlib.use('Agg') BASE_DIR = os.path.dirname(os.path.abspath(__file__))...
""" Test Role-Based Access Control (RBAC). """ import inspect import logging import sys import threading import unittest import nose from openmdao.main.rbac import Credentials, get_credentials, need_proxy, rbac, rbac_methods, check_role, \ remote_access, \ AccessController, CredentialsError, RoleError from op...
from __future__ import print_function, unicode_literals import os import re import subprocess import sys from distutils.version import LooseVersion NO_MERCURIAL = ''' Could not find Mercurial (hg) in the current shell's path. Try starting a new shell and running the bootstrapper again. ''' MERCURIAL_UNABLE_UPGRADE...
# pylint: disable=too-few-public-methods """ SANSConvertToWavelengthAndRebin algorithm converts to wavelength units and performs a rebin.""" from __future__ import (absolute_import, division, print_function) from mantid.kernel import (Direction, StringListValidator, Property) from mantid.dataobjects import EventWorks...
"""Finds CrOS browsers that can be controlled by telemetry.""" import logging import sys import os from telemetry.core import browser from telemetry.core import possible_browser from telemetry.core import profile_types from telemetry.core.chrome import cros_browser_backend from telemetry.core.chrome import cros_inter...
from subprocess import Popen, PIPE # Cloudify imports from cloudify import ctx from cloudify import exceptions def run(command): command_as_list = command.split() ctx.logger.info(command_as_list) try: run = Popen(command_as_list, stdout=PIPE) except Exception as e: raise exceptions...
""" Python script 'process_NCEI_03_vpd_30d.py' by Matthew Garcia, PhD student Dept. of Forest and Wildlife Ecology University of Wisconsin - Madison <EMAIL> Copyright (C) 2015-2016 by Matthew Garcia Licensed Gnu GPL v3; see 'LICENSE_GnuGPLv3.txt' for complete terms Send questions, bug reports, any related requests to ...
import sys sys.path.insert(1, "../../../") import h2o import pandas as pd import zipfile import statsmodels.api as sm def link_functions_gamma(ip,port): print("Read in prostate data.") h2o_data = h2o.import_file(path=h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) h2o_data.head() sm_data = pd.rea...
import boto.glacier.layer1 import ConfigParser import hashlib import os import random import string import time class Util: @staticmethod def randomname(l): return ''.join(random.choice(string.ascii_lowercase) for i in range(l)) @staticmethod def get_new_vault(): name = '%s-%s-%d' % (...
#!/usr/bin/env python import sys import os import re import numpy from PIL import Image import StringIO # you need to install this library yourself # recent versions handle bigtiff too... import tifffile """ Extract a pyramidal TIFF with JPEG tiled storage into a tree of separate JPEG files as expected by Zoomify. ...
"""ttLib/sfnt.py -- low-level module to deal with the sfnt file format. Defines two public classes: SFNTReader SFNTWriter (Normally you don't have to use these classes explicitly; they are used automatically by ttLib.TTFont.) The reading and writing of sfnt files is separated in two distinct classes, since whene...
import subprocess import unittest from os.path import join from subprocess import PIPE import os from enot.__main__ import create from enot.compiler.c_compiler import CCompiler from enot.compiler.enot import EnotCompiler from enot.packages.config.enot import EnotConfig from enot.packages.package import Package from e...
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- """ **Project Name:** MakeHuman **Product Home Page:** http://www.makehuman.org/ **Code Home Page:** https://bitbucket.org/MakeHuman/makehuman/ **Authors:** Glynn Clements **Copyright(c):** MakeHuman Team 2001-2014 **Licensing:** AGPL3 (h...
from nose.tools import * from framework.auth import Auth from tests.base import ApiTestCase from tests.factories import InstitutionFactory, AuthUserFactory, NodeFactory from api.base.settings.defaults import API_BASE class TestNodeRelationshipInstitutions(ApiTestCase): def setUp(self): super(TestNodeRel...
from . import ann from . import glideid from . import utils from . import visuals from .analysis import Analysis def create_project(path_project): """Generate project based on values in *d*.""" from collections import OrderedDict import datetime import importlib import os import shutil impo...
""" functions in charge of creating graph objects and populating them with the requested information""" import os import ast import modulefinder import networkx import astunparse from codeink.atelier import secretary from codeink.atelier import scientist from codeink.parchment import peephole def sketch_blocks(modu...
""" Sample script that runs nibabel functions logged by recipy. """ # Copyright (c) 2016 University of Edinburgh. from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) import recipy import os im...
import mock import pytest from k8s.client import NotFound from k8s.models.common import ObjectMeta from k8s.models.cronjob import CronJob, CronJobSpec from k8s.models.job import JobSpec, JobTemplateSpec from k8s.models.pod import Container, PodTemplateSpec, PodSpec NAME = "my-name" NAMESPACE = "my-namespace" @pyte...
"""Contains exceptions and error codes.""" import logging logger = logging.getLogger(__name__) class Codes(object): UNRECOGNIZED = "M_UNRECOGNIZED" UNAUTHORIZED = "M_UNAUTHORIZED" FORBIDDEN = "M_FORBIDDEN" BAD_JSON = "M_BAD_JSON" NOT_JSON = "M_NOT_JSON" USER_IN_USE = "M_USER_IN_USE" ROOM...
""" Builds applications in release mode: - Concatenates autostart modules, application modules' module.json descriptors, and the application loader into a single script. - Builds app.html referencing the application script. """ from cStringIO import StringIO from os import path from os.path import join import copy imp...
# -*- coding: utf-8 -*- import sqlite3, os, shutil import plistlib import logging log = logging.getLogger(__name__) ######################################## # util ######################################## DEFAULT_DOCSET_PATH = os.path.expanduser("~/Library/Application Support/Dash/DocSets/") def create_anchor(dash...
import os import wx from wx.lib.agw.genericmessagedialog import GenericMessageDialog import ConfigParser import manage_projector as mngP import manage_arduino as mng import panels.cameraPanel as camP import panels.runPanel as runP import panels.tablePanel as tabP import popup import panels.extraPanel as extraP class...
from UM.Job import Job from UM.Scene.SceneNode import SceneNode from UM.Math.Vector import Vector from UM.Operations.SetTransformOperation import SetTransformOperation from UM.Operations.TranslateOperation import TranslateOperation from UM.Operations.GroupedOperation import GroupedOperation from UM.Logger import Logger...
# # The Python v3.5 release API of xAI vision. # Yotam Salmon 2018 (C) All rights reserved. # Last stable version: 0.0.1 # numpy_exists = True try: import numpy as np except: numpy_exists = False import requests import base64 import json __server = "http://localhost:8080/v?id=" def __hexdump_bytes(b):...
from __future__ import absolute_import import math import os import random import numpy as np import PIL.Image import PIL.ImagePalette from digits.utils import image, subclass, override, constants from digits.utils.constants import COLOR_PALETTE_ATTRIBUTE from ..interface import DataIngestionInterface from .forms im...
""" Defines the Domain class, which represents a specific application or use case for a semantic parsing system. Each domain can define a number of attributes specific to and appropriate for its intended use case: - a list of examples - a list of grammar rules - a list of annotators - a default method...
import maya.cmds import IECore import IECoreMaya __dagMenuCallbacks = [] ## Registers a callback to be used when creating the right click dag # menu for scene shapes. Callbacks should have the following signature : # # callback( menu, sceneShape ). def addDagMenuCallback( callback ) : if not callback in __dagMenuCa...
""" convert.py """ import os import re import numpy as np import logging from log import LOG_NAME from variables import Point from share import FILLVALUE_I # -------------------------------------------------------------------- # # create logger log = logging.getLogger(LOG_NAME) # --------------------------------------...
from PyQt4.Qt import Qt from PyQt4.QtCore import QRectF from PyQt4.QtGui import QGraphicsEllipseItem, QPen, QBrush, QColor class PortItem(QGraphicsEllipseItem): def __init__(self, name, radius, parent=None): QGraphicsEllipseItem.__init__(self, QRectF(-radius, -radius, radius*2.0, radius*2.0), parent=pare...
import glob import os from setuptools import setup import flo # get all of the scripts scripts = glob.glob("bin/*") # read in the description from README with open("README.md") as stream: long_description = stream.read() github_url='https://github.com/deanmalmgren/flo' # read in the dependencies from the virtu...
import unittest from PyDealII.Debug import * class TestPointWrapper(unittest.TestCase): def test_2d_point(self): point = Point([0., 1.]) self.assertEqual(point.x, 0.) self.assertEqual(point.y, 1.) point.x = 1. point.y = 2. self.assertEqual(point.x, 1.) self...
""" .. module:: filter :platform: Unix :synopsis: A base class for all standard filters .. moduleauthor:: Mark Basham <<EMAIL>> """ from savu.plugins.plugin import Plugin import logging class BaseFilter(Plugin): """ A Plugin to apply a simple dark and flatfield correction to some raw timeseries d...
# A* Shortest Path Algorithm # http://en.wikipedia.org/wiki/A* # FB - 201012256 from heapq import heappush, heappop # for priority queue import math class node: # current position xPos = 0 yPos = 0 # total distance already travelled to reach the node distance = 0 # priority = distance + remaini...
"""HPCBench benchmark driver for cuda STREAM https://github.com/bcumming/cuda-stream """ import re from cached_property import cached_property from hpcbench.api import Benchmark, Metrics, MetricsExtractor from hpcbench.toolbox.process import find_executable class CUDAStreamExtractor(MetricsExtractor): """Ig...
import curses, time, traceback, sys import curses.wrapper from twisted.python import log from twisted.internet import reactor class CursesStdIO: """fake fd to be registered as a reader with the twisted reactor. Curses classes needing input should extend this""" def fileno(self): """ We want to...
import sys import generate class ExceptionItem: def __init__(self, type, ID, text, param_num): self.type = type self.ID = ID self.text = text self.param_num = param_num class StringItem: def __init__(self, ID, text, param_num): self.ID = ID self.text = text ...
# -*- coding: utf-8 -*- """Contains helper functions for generating correctly formatted hgrid list/folders. """ import logging import datetime import hurry.filesize from framework import sentry from framework.auth.decorators import Auth from website.util import paths from website.util import sanitize from website.se...
from pluggdapps.plugin import implements, Singleton from pluggdapps.interfaces import ICommand import pluggdapps.utils as h class Commands( Singleton ): """Subcommand plugin for pa-script to list all available sub-commands along with a short description. Like, .. code-block:: ba...
from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' group_stock_request_order = fields.Boolean( implied_group='stock_request.group_stock_request_order') module_stock_request_purchase = fields.Boolean( string='Stock Request...
from __future__ import (absolute_import, division, print_function, unicode_literals) import time import testcommon import backtrader as bt import backtrader.indicators as btind BUYCREATE = [ '3641.42', '3798.46', '3874.61', '3860.00', '3843.08', '3648.33', '3526.84', '3632.93', '3788...
#!/usr/bin/python import ast from distutils.core import setup from setuptools import setup, find_packages def get_version(fname): with open(fname) as f: source = f.read() module = ast.parse(source) for e in module.body: if isinstance(e, ast.Assign) and \ len(e.targets) == 1...
# oppia/tests/test_site.py from django.contrib.auth.models import User from django.test import TestCase from django.test.client import Client class BasicTest(TestCase): def setUp(self): self.client = Client() def test_home(self): response = self.client.get('/') self.assertEqual(respon...
#MenuTitle: Glyph Width Histogram # by Jens 2014-09-08 from math import ceil import vanilla from defconAppKit.windows.baseWindow import BaseWindowController import traceback try: import GlyphsApp env = "glyphs" except: env = "robofont" if env == "robofont": from mojo.canvas import Canvas import m...
from django.db import models from sorl.thumbnail import ImageField class Category(models.Model): name = models.CharField(max_length=80) parent = models.ForeignKey('self', blank=True, null=True) pub_date = models.DateTimeField(auto_now=True) def __unicode__(self): # Python 3: def __str__(self): ...
from __future__ import print_function import sh import array import extract import numpy as np import window import edimax import sys import csv from datetime import datetime import argparse class AudioSampleCollector(object): def __init__(self, device_name, edimax_ip, audio_device="hw:0,0"): self.featur...
""" Django settings for UCLGoProject project. Generated by 'django-admin startproject' using Django 1.11.3. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ impo...
import wx from cairis.core.armid import * from MemoPanel import MemoPanel from cairis.core.MemoParameters import MemoParameters import DialogClassParameters __author__ = 'Shamal Faily' class MemoDialog(wx.Dialog): def __init__(self,parent,parameters): wx.Dialog.__init__(self,parent,parameters.id(),parameters.la...
""" You found your very first laptop in the attic, and decided to give in to nostalgia and turn it on. The laptop turned out to be password protected, but you know how to crack it: you have always used the same password, but encrypt it using permutation ciphers with various keys. The key to the cipher used to protect...
scenarios = [ { "url": "/key/current", "method": "get", "status_code": 200, "json": {"api_key": "111", "auth_level": 500, "auth_level_name": "elevated"}, "headers": { "content-type": "application/json", "webservice-version": "8.10", "api-ve...
""" JSONAPI Spec implementation of API for models. """ from __future__ import (absolute_import, division, print_function, unicode_literals) try: from builtins import * # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import except ImportError: import sys print("WARNING: Cannot Load built...
from .common import BaseTest, functional from botocore.exceptions import ClientError class RDSParamGroupTest(BaseTest): @functional def test_rdsparamgroup_delete(self): session_factory = self.replay_flight_data("test_rdsparamgroup_delete") client = session_factory().client("rds") nam...
from eventlet import Timeout import mock import trove.common.context as context from trove.common import exception from trove.common.rpc.version import RPC_API_VERSION from trove.common.strategies.cluster.experimental.vertica.guestagent import ( VerticaGuestAgentAPI) from trove import rpc from trove.tests.unittest...
from __future__ import unicode_literals import frappe from frappe import _, throw from frappe.utils import flt def get_company_currency(company): currency = frappe.db.get_value("Company", company, "default_currency", cache=True) if not currency: currency = frappe.db.get_default("currency") if not currency: thro...
from __future__ import print_function, division # import sys,os quspin_path = os.path.join(os.getcwd(),"../../") sys.path.insert(0,quspin_path) # from quspin.operators import hamiltonian # operators from quspin.basis import spin_basis_general # spin basis constructor import numpy as np # general math functions # ######...
import json class Dajax(object): def __init__(self): self.calls = [] def json(self): return json.dumps(self.calls) def alert(self, message): self.calls.append({'cmd': 'alert', 'val': message}) def assign(self, id, attribute, value): self.calls.append({'cmd': 'as', '...
''' server implementation ''' import select import socket import sys import threading from SynchronizedList import SList class Server(threading.Thread): def __init__(self, host, port): self.init_values(host, port) def init_values(self, host, port): self.list = SList() self.host = ...
from __future__ import unicode_literals from functools import partial from flask import g from sqlalchemy.event import listens_for, listen from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import joinedload from indico.core.db import db from indico.core.db.sqlalchemy import PyIntEnum, UTCDateT...
from tests import BaseTestCase from redash.models import User, db class TestUserUpdateGroupAssignments(BaseTestCase): def test_default_group_always_added(self): user = self.factory.create_user() user.update_group_assignments(["g_unknown"]) db.session.refresh(user) self.assertItem...
""" Download topo and dtopo files needed for this example. Call functions with makeplots==True to create plots of topo, slip, and dtopo. """ from __future__ import print_function import os,sys import clawpack.clawutil.data from clawpack.geoclaw import topotools from numpy import * # Center of Gaussian f...
"""This example displays all subaccounts. Note that the permissions assigned to a subaccount are not returned in a human-readable format with this example. Run get_available_permissions.py to see what permissions are available on a subaccount. """ import argparse import sys from apiclient import sample_tools from oa...
#!/Library/Frameworks/Python.framework/Versions/3.1/bin/python3 # -*- coding: utf-8 -*- import os, sys sys.path.append(os.getcwd().split('projects')[0]+'projects/slps/shared/python') import BGF3 from functools import reduce def isalpha(x): if len(x)<2 or (len(x)==2 and not x.isalpha()) or x=='...' or x=='===': retu...
from msrest.serialization import Model class Resource(Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :ivar id: Resource Id :vartype id: str...
__author__ = 'david' from typing import List, Iterable from multiprocessing import Pool import time def compute(a: float)->float: """ Here will just compute the result and return it """ a = a*2+1 a = 0.0+a-1 a = a/2 return a ** 2 + 1 + 0.6 ** a def f1(): """ first try is to run a ...
from rdkit import Chem from rdkit import rdBase from rdkit import RDConfig import os from rdkit.Chem import rdMolDescriptors as rdMD from rdkit.Chem import AllChem haveDescrs3D = hasattr(rdMD,'CalcAUTOCORR3D') import time,unittest def _gen3D(m,is3d,calculator): if not is3d: m = Chem.AddHs(m) ps ...
from django.db import models, connection from django.db.models import Q class Category(models.Model): id = models.AutoField(primary_key=True) parent = models.ForeignKey('self') name = models.CharField(max_length=20) def __init__(self, *args, **kwargs): super(Category, self).__init__(*args, **...
import os import cgi import sickbeard from sickbeard import logger, common from sickrage.helper.encoding import ek def diagnose(): """ Check the environment for reasons libnotify isn't working. Return a user-readable message indicating possible issues. """ try: from gi.repository import N...
from django.shortcuts import render, redirect from django.conf import settings from django.core.files.storage import FileSystemStorage from uploads.core.models import Document, Sprite from uploads.core.forms import DocumentForm, SpriteForm from uploads.core.load import load_all_images, get_closests import numpy as n...
# Steering Manager example # KidsCanCode 2016 # TODO: weights # TODO: seek w/approach # TODO: flocking # TODO: pursuit # TODO: flow field # TODO: obstacle avoidance # TODO: default (max speed) import pygame as pg from random import uniform vec = pg.math.Vector2 class SteeringManager: def __init__(self, host): ...
# Catherine wheel import PyIgnition, pygame, sys screen = pygame.display.set_mode((600, 600)) pygame.display.set_caption("PyIgnition demo: catherine wheel") clock = pygame.time.Clock() wheel = PyIgnition.ParticleEffect(screen, (0, 0), (600, 600)) flame = wheel.CreateSource((300, 300), initspeed = 20.0, in...
"""Tests Policies.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.eager import context from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import test_util fr...
''' Module for testing the Elasticsearch datastore. ''' import os import sys import mock import unittest from elasticsearch import Elasticsearch from elasticsearch.client import IndicesClient, IngestClient CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file_...
import platform import Queue import re import threading import time import urllib HTTP_TIMEOUT = 10.0 # Max. seconds to wait for a response HTTP_TITLE = "Wheel Index" # HTTP Title to look for to validate the page MAX_THREADS = 10 MIRROR_LIST = ["http://mirror.dfw.rax.openstack.org/wheel/", "htt...