code
stringlengths
1
199k
from . uuid64 import *
import os import json def get_CMTs_in_file(aFile): ''' Gets a list of the CMTs found in a file. Parameters ---------- aFile : string, required The path to a file to read. Returns ------- A list of CMTs found in a file. ''' data = read_paramfile(aFile) cmtkey_list = [] for line in data: i...
""" Scheduling utility methods and classes. @author: Jp Calderone """ __metaclass__ = type import time from zope.interface import implements from twisted.python import reflect from twisted.python.failure import Failure from twisted.internet import base, defer from twisted.internet.interfaces import IReactorTime class L...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ ...
from network import WLAN WLAN_MODE = 'off' LORA_MODE = 'otaa' LORA_OTAA_EUI = '70B3D57EF0001ED4' LORA_OTAA_KEY = None # See README.md for instructions! LORA_SEND_RATE = 180 GNSS_UART_PORT = 1 GNSS_UART_BAUD = 9600 GNSS_ENABLE_PIN = 'P8'
from django.dispatch import Signal user_email_bounced = Signal() # args: ['bounce', 'should_deactivate'] email_bounced = Signal() # args: ['bounce', 'should_deactivate'] email_unsubscribed = Signal() # args: ['email', 'reference']
a = [int(i) for i in input().split()] print(sum(a))
from django.conf import settings from django.conf.urls import static from django.urls import include, path, re_path from django.contrib import admin urlpatterns = [ path(r"admin/", admin.site.urls), path(r"flickr/", include("ditto.flickr.urls")), path(r"lastfm/", include("ditto.lastfm.urls")), path(r"pi...
from os import listdir import os import re import sys from argparse import ArgumentParser import random import subprocess from math import sqrt import ast from adderror import adderror """ENSAMBLE, -d directory -n number of models """ """-k number of selected structure""" """-r repet of program""" files = [] pdb_files ...
import collections puzzle_input = (0,13,1,8,6,15) test_inputs = [ ([(0,3,6), 10], 0), ([(1,3,2)], 1), ([(2,1,3)], 10), ([(1,2,3)], 27), ([(2,3,1)], 78), ([(3,2,1)], 438), ([(3,1,2)], 1836), # Expensive Tests # ([(0,3,6), 30000000], 175594), # ([(1,3,2), 30000000], 2578), # ([...
import os import time import argparse import tempfile import PyPDF2 import datetime from reportlab.pdfgen import canvas parser = argparse.ArgumentParser("Add signatures to PDF files") parser.add_argument("pdf", help="The pdf file to annotate") parser.add_argument("signature", help="The signature file (png, jpg)") parse...
import pexpect import sys import logging import vt102 import os import time def termcheck(child, timeout=0): time.sleep(0.05) try: logging.debug("Waiting for EOF or timeout=%d"%timeout) child.expect(pexpect.EOF, timeout=timeout) except pexpect.exceptions.TIMEOUT: logging.debug("Hit timeout and have %d characte...
import json from axe.http_exceptions import BadJSON def get_request(request): return request def get_query(request): return request.args def get_form(request): return request.form def get_body(request): return request.data def get_headers(request): return request.headers def get_cookies(request): ...
def tryprint(): return ('it will be oke')
import time from nicfit.aio import Application async def _main(args): print(args) print("Sleeping 2...") time.sleep(2) print("Sleeping 0...") return 0 def atexit(): print("atexit") app = Application(_main, atexit=atexit) app.arg_parser.add_argument("--example", help="Example cli") app.run() asse...
# -*- coding: utf-8 -*- """ Organization Registry - Controllers """ module = request.controller resourcename = request.function if not settings.has_module(module): raise HTTP(404, body="Module disabled: %s" % module) def index(): """ Module's Home Page """ return s3db.cms_index(module, alt_function="in...
from wsgidav.dav_provider import DAVCollection, DAVNonCollection from wsgidav.dav_error import DAVError, HTTP_FORBIDDEN from wsgidav import util from wsgidav.addons.tracim import role, MyFileStream from time import mktime from datetime import datetime from os.path import normpath, dirname, basename try: from cStrin...
from ez_setup import use_setuptools use_setuptools() import os import sys from fnmatch import fnmatchcase from distutils.util import convert_path from propane_distribution import cmdclassdict from setuptools import setup, find_packages from engineer import version PROJECT = 'engineer' standard_exclude = ('*.py', '*.pyc...
from ._test_base import TestBase __all__ = ['TestBase']
import collections import threading import logging import Queue from ant.base.ant import Ant from ant.base.message import Message from ant.easy.channel import Channel from ant.easy.filter import wait_for_event, wait_for_response, wait_for_special _logger = logging.getLogger("garmin.ant.easy.node") class Node(): def...
import os from ConfigParser import ConfigParser from amlib import argp tmp_conf = ConfigParser() tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here tmp_path = tmp_path.split('/') conf_path = '/'.join(tmp_path[0:-1]) # /base/lib tmp_conf.read(conf_path+'/ampush.conf') c = {} c.update(tmp_conf.item...
from __future__ import unicode_literals import operator import pytest from marrow.mongo import Filter from marrow.schema.compat import odict, py3 @pytest.fixture def empty_ops(request): return Filter() @pytest.fixture def single_ops(request): return Filter({'roll': 27}) def test_ops_iteration(single_ops): assert lis...
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pip...
"""Contains tests for oweb.views.updates.item_update""" from unittest import skip from django.core.urlresolvers import reverse from django.test.utils import override_settings from django.contrib.auth.models import User from oweb.tests import OWebViewTests from oweb.models.account import Account from oweb.models.researc...
import os import sys if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.prod') from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer path = os.path.join(os.path.dirname(__file__), 'py_apps/pyscope') sys.path.append(path) path = os.path.join(os.path.dirname(__file__), '../py_apps/twit_feed') sys.path.append(path) import pyscope import ...
import asyncio from abc import ABCMeta from collections.abc import MutableMapping from aiohttp import web from aiohttp.web_request import Request from aiohttp_session import get_session from collections.abc import Sequence AIOLOGIN_KEY = '__aiologin__' ON_LOGIN = 1 ON_LOGOUT = 2 ON_AUTHENTICATED = 3 ON_FORBIDDEN = 4 ON...
import inspect import sys from typing import TypeVar, Optional, Sequence, Iterable, List, Any from owlmixin import util from owlmixin.errors import RequiredError, UnknownPropertiesError, InvalidTypeError from owlmixin.owlcollections import TDict, TIterator, TList from owlmixin.owlenum import OwlEnum, OwlObjectEnum from...
"""Chapter 22 Practice Questions Answers Chapter 22 Practice Questions via Python code. """ from pythontutorials.books.CrackingCodes.Ch18.vigenereCipher import decryptMessage def main(): # 1. How many prime numbers are there? # Hint: Check page 322 message = "Iymdi ah rv urxxeqfi fjdjqv gu gzuqw clunijh." ...
from __future__ import absolute_import, print_function, division from future.utils import with_metaclass import numpy as np import scipy as sp from abc import ABCMeta, abstractmethod from scipy import integrate import scipy.interpolate as interpolate from . import core from . import refstate __all__ = ['GammaEos','Gamm...
import numpy import pytest import theano class TestInputLayer: @pytest.fixture def layer(self): from lasagne.layers.input import InputLayer return InputLayer((3, 2)) def test_input_var(self, layer): assert layer.input_var.ndim == 2 def test_get_output_shape(self, layer): ...
''' Created on Nov 19, 2011 @author: scottporter ''' class BaseSingleton(object): _instance = None @classmethod def get_instance(cls): if cls._instance is None: cls._instance = cls() return cls._instance
"""Device tracker for Synology SRM routers.""" from __future__ import annotations import logging import synology_srm import voluptuous as vol from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA as DEVICE_TRACKER_PLATFORM_SCHEMA, DeviceScanner, ) from homeassistant.const import ( ...
''' utils.py: helper functions for DLP api Copyright (c) 2017 Vanessa Sochat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, cop...
''' Description: Extract the feature from the text in English. Version: python3 ''' from sklearn.feature_extraction.text import CountVectorizer VECTORIZER = CountVectorizer(min_df=1) CORPUS = [ 'This is the first document.', 'This is the second second document.', 'And the third one.', 'Is this t...
import _plotly_utils.basevalidators class YValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="y", parent_name="bar", **kwargs): super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, anim=kwargs.pop("an...
from .record import ( Metadata, Record, ) __all__ = ['Parser'] class Parser: def __init__(self, store): self.store = store def parse_record(self, metadata, line): factors = line.split('|') if len(factors) < 7: return registry, cc, type_, start, value, dete, st...
class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ if not s: return True start = 0 end = len(s)-1 s = s.lower() while start < end: while start < end and not s[start].isalnum(): ...
""" ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from orcid_api_v3.models...
import collections import json import unittest import responses from requests import HTTPError from mock import patch from batfish import Client from batfish.__about__ import __version__ class TestClientAuthorize(unittest.TestCase): def setUp(self): with patch('batfish.client.read_token_from_conf', ...
from .. import console, fields from ..exceptions import ConsoleError from . import mock import pytest console.raw_input=mock.raw_input def test_prompt(): field=fields.Field("test_field", "test field", fields.Field.TYPE_TEXT_ONELINE, "this is a test field") assert console.prompt(field)=="999" def test_input_pars...
import sys import petsc4py petsc4py.init(sys.argv) from ecoli_in_pipe import head_tail head_tail.main_fun()
raise SystemExit import magic print magic.from_file("my_image.jpg") if magic.from_file("upload.jpg", mime=True) == "image/jpeg": continue_uploading("upload.jpg") else: alert("Sorry! This file type is not allowed") import imghdr print imghdr.what("path/to/my/file.ext") import binascii def spoof_file(file, magic_...
from django.contrib.auth import get_user_model from rest_framework.authentication import SessionAuthentication, BasicAuthentication from rest_framework import routers, serializers, viewsets, permissions from rest_framework_jwt.authentication import JSONWebTokenAuthentication from rest_framework.reverse import reverse ...
<<<<<<< HEAD <<<<<<< HEAD """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py. """#" import codecs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'...
""" Setup file """ import os from setuptools import find_packages, setup HERE = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(HERE, "README.rst")) as f: README = f.read() with open(os.path.join(HERE, "CHANGES.rst")) as f: CHANGES = f.read() REQUIREMENTS_TEST = open(os.path.join(HERE, "requir...
import Config import Database import atexit, os, time from flask import Flask from concurrent.futures import ThreadPoolExecutor from classes import CRONTask executor = ThreadPoolExecutor(5) app = Flask( __name__ ) @app.route( "/" ) def index( ) : return "View Generator Service is Active!" @app.route( "/View" ) def vie...
from __future__ import unicode_literals from django.db import migrations, models import oktansite.models class Migration(migrations.Migration): dependencies = [ ('oktansite', '0004_news_attachment'), ] operations = [ migrations.AddField( model_name='news', name='image...
from Models.FeatureProcessing import * from keras.models import Sequential from keras.layers import Activation, Dense, LSTM from keras.optimizers import Adam, SGD import numpy as np import abc from ClassificationModule import ClassificationModule class descriptionreponamelstm(ClassificationModule): """A basic lstm ...
__author__ = 'sekely' ''' we are using variables almost everywhere in the code. variables are used to store results, calculations and many more. this of it as the famous "x" from high school x = 5, right? the only thing is, that in Python "x" can store anything ''' x = 5 y = x + 3 print(y) x = 'hello' y = ' ' z = 'worl...
import os import requests import sqlite3 def get_card(browser): attributes = browser.find_elements_by_xpath('//table[@class="status"]/tbody/tr/td') image = attributes[0].find_element_by_xpath('./img').get_attribute('src') if attributes[1].find_element_by_xpath('./span[@class="kana"]').text: card_nam...
from brightcove.core import APIObject, Field, DateTimeField, ListField, EnumField from brightcove.objects import ItemCollection, enum ChannelNameEnum = enum('ten', 'eleven', 'one') PlaylistTypeEnum = enum('full_episodes', 'web_extras', 'news', 'season', 'week', 'category', 'special', 'preview') MediaDeliveryEnum = enum...
from Bio import SeqIO def get_proteins_for_db(fastafn, fastadelim, genefield): """Runs through fasta file and returns proteins accession nrs, sequences and evidence levels for storage in lookup DB. Duplicate accessions in fasta are accepted and removed by keeping only the last one. """ records = {ac...
''' Test BLEUScore metric against reference ''' from neon.transforms.cost import BLEUScore def test_bleuscore(): # dataset with two sentences sentences = ["a quick brown fox jumped", "the rain in spain falls mainly on the plains"] references = [["a fast brown fox jumped", ...
from .grant import Grant from ..endpoint import AuthorizationEndpoint class ImplicitGrant(Grant): """ The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These cli...
from framework import do_exit, get_globals, main def do_work(): global g_test_import global globals1 print("do_work") globals1 = get_globals() g_test_import = globals1["g_test_import"] print("do_work: g_test_import = %s" % str(g_test_import)) main(do_work)
__revision__ = "test/Execute.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" """ Test the Execute() function for executing actions directly. """ import TestSCons _python_ = TestSCons._python_ test = TestSCons.TestSCons() test.write('my_copy.py', """\ import sys open(sys.argv[2], 'wb').write(open(sys.argv[1...
from django import forms from django.core.validators import validate_email from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from .utils import get_user_model class PasswordRecoveryForm(forms.Form): username_or_email = forms.CharField() error_messages = { 'not_found'...
from bioscrape.inference import DeterministicLikelihood as DLL from bioscrape.inference import StochasticTrajectoriesLikelihood as STLL from bioscrape.inference import StochasticTrajectories from bioscrape.inference import BulkData import warnings import numpy as np class PIDInterface(): ''' PID Interface : Par...
from flask_bcrypt import generate_password_hash generate_password_hash('password1', 8)
""" Module for main window related functionality """ import PyQt4.QtGui from herculeum.ui.controllers import EndScreenController, StartGameController from herculeum.ui.gui.endscreen import EndScreen from herculeum.ui.gui.eventdisplay import EventMessageDockWidget from herculeum.ui.gui.map import PlayMapWindow from herc...
from utils.face import Face import pygame from utils.message import Message from utils.alarm import Alarm class Button(pygame.sprite.Sprite): def __init__(self, rect, color=(0,0,255), action=None): pygame.sprite.Sprite.__init__(self) self.color = color self.action = action self.rect ...
from django import forms from django.utils.translation import ugettext_lazy as _ from django.forms import inlineformset_factory from djangosige.apps.financeiro.models import PlanoContasGrupo, PlanoContasSubgrupo class PlanoContasGrupoForm(forms.ModelForm): class Meta: model = PlanoContasGrupo fields...
from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.admin import UserAdmin from django.contrib import admin from django import forms class VoterCreationForm(UserCreationForm): section = forms.CharField() def save(self, commi...
import logging logging.basicConfig(level=logging.DEBUG) from gntp.notifier import GrowlNotifier import platform growl = GrowlNotifier(notifications=['Testing'],password='password',hostname='ayu') growl.subscribe(platform.node(),platform.node(),12345)
from django.conf.urls.defaults import * urlpatterns = patterns('member.views', url(r'^$', 'login', name='passport_index'), url(r'^register/$', 'register', name='passport_register'), url(r'^login/$', 'login', name='passport_login'), url(r'^logout/$', 'logout', name='passport_logout'), url(r'^active/$...
""" The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. """ from pushbots import Pushbots def example_get_analytics(): """Get analytic...
from __future__ import unicode_literals import httpretty import json import sure from pyeqs import QuerySet, Filter from pyeqs.dsl import Term, Sort, ScriptScore from tests.helpers import homogeneous @httpretty.activate def test_create_queryset_with_host_string(): """ Create a queryset with a host given as a st...
from typing import Union, Iterator from ...symbols import NOUN, PROPN, PRON from ...errors import Errors from ...tokens import Doc, Span def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]: """ Detect base noun phrases from a dependency parse. Works on both Doc and Span. """ # fmt: off labe...
from random import randint, seed, choice, random from numpy import zeros, uint8, cumsum, floor, ceil from math import sqrt, log from collections import namedtuple from PIL import Image from logging import info, getLogger class Tree: def __init__(self, leaf): self.leaf = leaf self.lchild = None self.rchild = None...
import unittest import numpy import chainer from chainer.backends import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr def _uniform(*shape): return numpy.random.uniform(-1, 1, shape).astype(numpy.float32) @testing.parameterize(*tes...
from modelmapper.declarations import Mapper, Field from modelmapper.qt.fields import QLineEditAccessor class String(QLineEditAccessor): def get_value(self): return str(self.widget.text()) def set_value(self, value): self.widget.setText(str(value)) class Integer(QLineEditAccessor): def get_va...
__author__ = 'bptripp' import numpy as np from scipy.optimize import curve_fit import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from keras.models import Sequential from keras.layers.core import Dense, Activation, Flatten from keras.l...
tokens = [ 'LPAREN', 'RPAREN', 'LBRACE', 'RBRACE', 'EQUAL', 'DOUBLE_EQUAL', 'NUMBER', 'COMMA', 'VAR_DEFINITION', 'IF', 'ELSE', 'END', 'ID', 'PRINT' ] t_LPAREN = r"\(" t_RPAREN = r"\)" t_LBRACE = r"\{" t_RBRACE = r"\}" t_EQUAL = r"\=" t_DOUBLE_EQUAL = r"\=\=" def t...
import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,viewer, parent): super(FeatureSelectionDialog, self).__init__(parent) ...
from engine.api import API from engine.utils.printing_utils import progressBar from setup.utils.datastore_utils import repair_corrupt_reference, link_references_to_paper def remove_duplicates_from_cited_by(): print("\nRemove Duplicates") api = API() papers = api.get_all_paper() for i, paper in enumerate...
from polyphony import testbench def g(x): if x == 0: return 0 return 1 def h(x): if x == 0: pass def f(v, i, j, k): if i == 0: return v elif i == 1: return v elif i == 2: h(g(j) + g(k)) return v elif i == 3: for m in range(j): ...
import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(os.path.dirname(BASE_DIR)) from global_variables import * from evaluation_helper import * cls_names = g_shape_names img_name_file_list = [os.path.join(g_real_images_voc12val_det_bbox_folder, name+'.txt')...
from boto.swf.exceptions import SWFResponseError from swf.constants import REGISTERED from swf.querysets.base import BaseQuerySet from swf.models import Domain from swf.models.workflow import (WorkflowType, WorkflowExecution, CHILD_POLICIES) from swf.utils import datetime_timestamp, pas...
import tensorflow as tf from ocnn import * def network_resnet(octree, flags, training=True, reuse=None): depth = flags.depth channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8] with tf.variable_scope("ocnn_resnet", reuse=reuse): data = octree_property(octree, property_name="feature", dtype=tf.float32, ...
from distutils.core import setup from dangagearman import __version__ as version setup( name = 'danga-gearman', version = version, description = 'Client for the Danga (Perl) Gearman implementation', author = 'Samuel Stauffer', author_email = 'samuel@descolada.com', url = 'http://github.com/sayme...
from __future__ import print_function import sys import re from utils import CDNEngine from utils import request if sys.version_info >= (3, 0): import subprocess as commands import urllib.parse as urlparse else: import commands import urlparse def detect(hostname): """ Performs CDN detection tha...
""" ================================================= Modeling quasi-seasonal trends with date features ================================================= Some trends are common enough to appear seasonal, yet sporadic enough that approaching them from a seasonal perspective may not be valid. An example of this is the `"...
import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in_decimal"] pass class ApplicableAddon(Mod...
import math from service.fake_api_results import ALL_TITLES, OFFICIAL_COPY_RESULT, SELECTED_FULL_RESULTS SEARCH_RESULTS_PER_PAGE = 20 def get_title(title_number): return SELECTED_FULL_RESULTS.get(title_number) def _get_titles(page_number): nof_results = len(ALL_TITLES) number_pages = math.ceil(nof_results /...
import os import sys on_rtd = os.environ.get("READTHEDOCS") == "True" sys.path.insert(0, os.path.abspath("..")) extensions = [ "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.todo", "sphinx.ext.coverage", "sphinx.ext.mathjax", "sphinx.ext.ifconfig", "sphinx.ext.viewcode", "sphinx...
import datetime import re import sys from collections import deque from decimal import Decimal from enum import Enum from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network from pathlib import Path from types import GeneratorType from typing import Any, Callable, Dict, Typ...
import ROOT from math import pi, sqrt, pow, exp import scipy.integrate import numpy from array import array alpha = 7.2973e-3 m_e = 0.51099892 Z_Xe = 54 Q = 2.4578 def F(Z, KE): E = KE + m_e W = E/m_e Z0 = Z + 2 if W <= 1: W = 1 + 1e-4 if W > 2.2: a = -8.46e-2 + 2.48e-2*Z0 + 2.37e-4*...
class SubscriptionTracking(object): def __init__(self, enable=None, text=None, html=None, substitution_tag=None): self._enable = None self._text = None self._html = None self._substitution_tag = None if enable is not None: self.enable = enable if text is n...
import novaclient from novaclient.exceptions import NotFound import novaclient.client from keystoneauth1 import loading from keystoneauth1 import session import neutronclient.v2_0.client import cinderclient.v2.client from osc_lib.utils import wait_for_delete import taskflow.engines from taskflow.patterns import linear_...
import unittest import greatest_common_divisor as gcd class TestGreatestCommonDivisor(unittest.TestCase): def setUp(self): # use tuple of tuples instead of list of tuples because data won't change # https://en.wikipedia.org/wiki/Algorithm # a, b, expected self.test_data = ((12, 8, 4)...
""" Модуль с преднастроенными панелями-деевьями """ from __future__ import absolute_import from m3.actions.urls import get_url from m3_ext.ui import containers from m3_ext.ui import controls from m3_ext.ui import menus from m3_ext.ui import render_component from m3_ext.ui.fields import ExtSearchField class ExtObjectTre...
from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import List, Optional __version__ = "20.0.dev0" def main(args=None): # type: (Optional[List[str]]) -> int """This is an internal API only meant for use by pip's own console scripts. For additional details, see h...
from keras.models import Sequential, model_from_json from keras.layers import Dense, Dropout, Activation, Flatten, Convolution2D, MaxPooling2D, Lambda, ELU from keras.layers.normalization import BatchNormalization from keras.optimizers import Adam import cv2 import csv import numpy as np import os from random import ra...
from __future__ import unicode_literals import os, sys, json import webnotes import webnotes.db import getpass from webnotes.model.db_schema import DbManager from webnotes.model.sync import sync_for from webnotes.utils import cstr class Installer: def __init__(self, root_login, root_password=None, db_name=None, site=N...
import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and ...
"""OPP Hardware interface. Contains the hardware interface and drivers for the Open Pinball Project platform hardware, including the solenoid, input, incandescent, and neopixel boards. """ import asyncio from collections import defaultdict from typing import Dict, List, Set, Union, Tuple, Optional # pylint: disable-ms...
from django.db import models from constituencies.models import Constituency from uk_political_parties.models import Party from elections.models import Election class Person(models.Model): name = models.CharField(blank=False, max_length=255) remote_id = models.CharField(blank=True, max_length=255, null=True) ...
import json from app import models from django.test import Client, TestCase from django.contrib.auth.hashers import make_password from django.contrib.auth.models import User from django.core.urlresolvers import reverse class TestLecturerWeb(TestCase): def _init_test_lecturer(self): if hasattr(self, '_lectur...
from settings.common import Common class Dev(Common): DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'ffrpg.sql', # Or path to database file if using sqlite3. # ...