src
stringlengths
721
1.04M
# encoding: utf-8 """Test seya.layers.recurrent module""" from __future__ import print_function import unittest import numpy as np import theano from numpy.testing import assert_allclose from keras import backend as K from keras.layers.core import Dense from keras.models import Sequential from seya.utils import ap...
from __future__ import print_function import requests # for working with remote resources import re # regular expresions import os class bib_entry: def __init__(self, bibtex_in): """ Initialise the object with its arxiv reference number """ self.bibtex = b...
"""Tests for the forms of the ``django-frequently`` app.""" from django.test import TestCase from mixer.backend.django import mixer from .. import forms class EntryFormTestCase(TestCase): """Tests for the ``EntryForm`` form class.""" def setUp(self): self.owner = mixer.blend('auth.User') def te...
# Парсер для сбора внешних ссылок с сайта from urllib.request import urlopen from urllib.error import HTTPError from bs4 import BeautifulSoup url = 'http://gymn11.ru' def get_html(url): '''Считывает страницу в html''' try: html = urlopen(url) except: print('нет сайта такого') re...
## # \namespace cross3d.softimage.external # # \remarks This class can be used even outside of softimage. It gives you info on where # softimage is installed, and allows you to run scripts in softimage. # To Access this class use: cross3d.external('softimage') # # \author dougl # \author Blur Studio ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-19 07:29 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ...
from os import path as ospath from datetime import datetime from djangodav.fs.resources import BaseFSDavResource from djangodav.utils import url_join from drastic.models import Collection, Resource, DataObject import logging logging.warn('WEBDAV has been loaded') CHUNK_SIZE = 1048576 def chunkstring(string, lengt...
from django.db.models.base import ModelBase from psqlextra.types import PostgresPartitioningMethod from .base import PostgresModel from .options import PostgresPartitionedModelOptions class PostgresPartitionedModelMeta(ModelBase): """Custom meta class for :see:PostgresPartitionedModel. This meta class extr...
from requests import Session SAFER_KEYWORD_URL = 'https://safer.fmcsa.dot.gov/keywordx.asp' SAFER_QUERY_URL = 'https://safer.fmcsa.dot.gov/query.asp' sess = Session() sess.headers.update({ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Acc...
from django import forms from .models import Image from urllib import request from django.core.files.base import ContentFile from django.utils.text import slugify class ImageCreateForm(forms.ModelForm): class Meta: model = Image fields = ('title', 'url', 'description') widgets = { ...
#!/usr/bin/env python #-*-coding:utf8-*- __author__ = 'jiangdexiang' __version__ = '1.0' __all__ = ['__author__', '__version__'] ''' Database operation module ''' import threading import time import uuid import functools import logging class Dict(dict): """ Simple dict but support access as x.y style. ...
''' Created on 21 kwi 2013 @author: jurek ''' from hra_core.special import ImportErrorMessage try: from PyQt4.QtGui import * # @UnusedWildImport from PyQt4.QtCore import * # @UnusedWildImport from hra_core.misc import Params from hra_core.collections_utils import nvl from hra_gui.qt.utils.signals...
""" Django settings for yelpsite 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, ...) i...
import os import glob import json import re from subprocess import check_output, CalledProcessError from blambda.utils.base import pGreen, pRed, pBlue, pYellow, spawn import time from pprint import pprint try: import boto3 except ImportError: print("Unable to import boto") def all_json_files(root): retur...
#!/usr/bin/python import re import sys import os import getopt import operator import random def main(): params = parseArgs() if params.phylip: #Get sequences as dict of lists seqs = readPhylip(params.phylip) #get list of columns and list of samplenames alen = getSeqLen(seqs) columns = [[]for i in range...
from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth import logout as django_logout from django.shortcuts import redirect, render, get_object_or_404 from django.contrib.auth.decorators import login_required from django.views import generic from django.utils.decorators import method_decora...
# # Proximate - Peer-to-peer social networking # # Copyright (c) 2008-2011 Nokia Corporation # # All rights reserved. # # This software is licensed under The Clear BSD license. # See the LICENSE file for more details. # from plugins import Plugin, get_plugin_by_type from proximateprotocol import PLUGIN_TYPE_COMMUNITY, ...
#!/usr/bin/env python import sys if sys.version_info < (2, 3): raise RuntimeError('Python 2.3+ is required.') import logging import os import shutil import subprocess import unittest import tests TEST_FILE_NAME = 'test.mkv' BASE_PATH = os.path.dirname(__file__) WORK_PATH = os.path.join(BASE_PATH, 'work') TEST_...
import matplotlib import matplotlib.pyplot as pyplot import numpy from matplotlib.colors import ListedColormap from sklearn import neighbors, datasets def get_iris_dataset(): iris = datasets.load_iris() return iris.data[:, :2], iris.target def get_knn_classifier(X, y, n_neighbors=None): if not n_neighbo...
# Copyright 2014 Mirantis, Inc. # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
__author__ = "Christian Kongsgaard" __license__ = 'MIT' # -------------------------------------------------------------------------------------------------------------------- # # IMPORTS # Modules import matplotlib.pyplot as plt import numpy as np import os import datetime import matplotlib.dates as mdates import pan...
############################################################################ ## ## Copyright (C) 2019 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the Quality Assurance module of the Qt Toolkit. ## ## $QT_BEGIN_LICENSE:GPL-EXCEPT$ ## Commercial License Usage ## Licensees holdi...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
import usb.core import usb.util usb_iclass_map = { usb.CLASS_PER_INTERFACE: 'PerInterface', # 0 usb.CLASS_AUDIO: 'Audio', # 1 usb.CLASS_COMM: 'Comm', # 2 usb.CLASS_HID: 'HID', # 3 usb.CLASS_PRINTER: 'Printer', # 7 usb.CLASS_MASS_STORAGE: 'MassStorage', # 8 usb.CLASS_HUB: 'Hub', # 9 ...
# -*- coding: utf-8 -*- """Test textlib module.""" # # (C) Pywikibot team, 2011-2020 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unicode_literals import codecs from collections import OrderedDict import functools import os import re import pywikibot import p...
from __future__ import absolute_import import argparse import os from .detour import detour_directory from .cache import Cache from .db import entry_point from .appconf import AppConfHelper from .assets import AssetCollection import yaml from .utils import load_file from .i18n import I18nHelper from .resource import Re...
#!/usr/bin/env python # vim: sw=4:ts=4:sts=4:fdm=indent:fdl=0: # -*- coding: UTF8 -*- # # mp4v2 object oriented wrapper module. # Copyright (C) 2010 Josiah Gordon <josiahg@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publi...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright 2002 Ben Escoto <ben@emerose.org> # Copyright 2007 Kenneth Loafman <kenneth@loafman.com> # # This file is part of duplicity. # # Duplicity is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License...
__author__ = 'Sergio Sicari' __email__ = "sergiosicari@gmail.com" from evernote.api.client import EvernoteClient import evernote.edam.type.ttypes as Types import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.userstore.UserStore as UserStore class EverCode: def __init__(self, Settings): ...
#!/usr/bin/env python3 """switchmap.Agent class. Description: This script: 1) Processes a variety of information from agents 2) Posts the data using HTTP to a server listed in the configuration file """ # Standard libraries import textwrap import sys import time import argparse import ...
import numpy as np # set camera calibration from some hard coded options def set_camera_calibration(value): if value == 0: name = "Mobius 1920x1080 (Curt)" K = np.array( [[1362.1, 0.0, 980.8], [ 0.0, 1272.8, 601.3], [ 0.0, 0.0, 1.0]] ) ...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import test from telemetry.page import page_set from webgl_conformance import WebglConformanceValidator from webgl_conformance import conforman...
# -*- coding: utf-8 -*- """ Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix) Copyright (C) 2018 Caphm (original implementation module) Copyright (C) 2019 Stefano Gottardo - @CastagnaIT Initialize the netflix session SPDX-License-Identifier: MIT See LICENSES/MIT.md for more informatio...
""" Test email as username authentication """ import json from django.core.urlresolvers import reverse import ddt from provider.constants import CONFIDENTIAL, PUBLIC from .base import OAuth2TestCase from .factories import ClientFactory USERNAME = 'some_username' EMAIL = 'test@example.com' PASSWORD = 'some_password...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from lxml import etree from odoo import api, models, fields from odoo.tools.translate import _ class Partner(models.Model): _inherit = 'res.partner' country_enforce_cities = fields.Boolean(related='country_id...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'SiteUrlDefaults' db.create_table('site_seo_siteurldefaults', ( ('id', self.gf('d...
from __future__ import print_function, unicode_literals import getpass import logging import os import subprocess import sys from distutils.util import strtobool from six.moves import input from rbtools.utils.encoding import force_unicode from rbtools.utils.errors import EditorError from rbtools.utils.filesystem imp...
"""Inserts the current time (in seconds) into the wiki page.""" revision = "$Rev: 10617 $" url = "$URL: https://svn.edgewall.org/repos/trac/tags/trac-1.0/sample-plugins/Timestamp.py $" # # The following shows the code for macro, old-style. # # The `execute` function serves no purpose other than to illustrate # the ex...
# coding: utf-8 # RDS delete import boto3 # nodelete,trueを変数化 ND = 'nodelete' TR = 'true' #def lambda_handler(event, context): if __name__ == '__main__': client = boto3.client('rds', "ap-northeast-1") resp = client.describe_db_instances() all_list = [] del_list = [] for rds in resp...
# -*- coding: utf-8 -*- # Dioptas - GUI program for fast processing of 2D X-ray diffraction data # Principal author: Clemens Prescher (clemens.prescher@gmail.com) # Copyright (C) 2014-2019 GSECARS, University of Chicago, USA # Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany ...
#! /usr/bin/env python # -*- coding: utf-8 -*- import vcsn from test import * ## -------------- ## ## dot: parsing. ## ## -------------- ## # Check invalid input. def xfail(a): XFAIL(lambda: vcsn.automaton(a)) # Syntax error: missing }. xfail(r'''digraph { vcsn_context = "lal_char(a), b" ''') # Syntax error...
from fabric.contrib.files import append, exists, sed from fabric.api import local, env, cd, run from fabric.colors import green, red REPO_URL = "https://github.com/dsimandl/teamsurmandl.git" def backup(): local('git pull') print("Enter files you want to add, or just press return for all files") files = ra...
# -*- coding:utf-8 -*- """ 工具 历史: 2011-08-03 + 重构 get_pys_members。 2011-08-15 * 修改 con_mongo_object,支持 objectid。 2011-08-20 + 增加 template_path, static_path。 2011-08-25 * 将参数检查函数从 loigc 转移过来。 2011-08-27 * 重构 get_pys_members,改名 get_members。 """ from dat...
# -*- coding: utf-8 -*- from ... import OratorTestCase from . import IntegrationTestCase, User, Post from orator import Model from orator.connections import SQLiteConnection from orator.connectors.sqlite_connector import SQLiteConnector class SchemaBuilderSQLiteIntegrationTestCase(IntegrationTestCase, OratorTestCase...
# Copyright (c) 2012 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
from django.test import TestCase from django.urls import reverse from django.contrib.auth.models import User from ..admin import FavoriteColorModelForm class AdminTest(TestCase): def setUp(self): super(AdminTest, self).setUp() # create a superuser to be logged in self.admin = User.object...
# Connection plugin for configuring docker containers # Author: Lorin Hochstein # # Based on the chroot connection plugin by Maykel Moya import os import subprocess import time from ansible import errors from ansible.callbacks import vvv class Connection(object): def __init__(self, runner, host, port, *args, **k...
import json import struct from cStringIO import StringIO import logging from datatypes import * from exc import * LOG = logging.getLogger(__name__) default_server_info = {'players': {'max': 20, 'online': 0}, 'version': {'protocol': 4, 'name': 'Minecra...
import zstackwoodpecker.test_state as ts_header import os TestAction = ts_header.TestAction def path(): return dict(initial_formation="template5", checking_point=8, path_list=[ [TestAction.create_vm, 'vm1', ], [TestAction.create_volume, 'volume1', 'flag=scsi'], [TestAction.attach_volume, 'vm1', 'volume1'], ...
# python # This file is generated by a program (mib2py). import HP_ICF_CHASSIS OIDMAP = { '1.3.6.1.4.1.11.2.14.10.2.3': HP_ICF_CHASSIS.hpicfChassisMib, '1.3.6.1.4.1.11.2.14.10.2.3.1': HP_ICF_CHASSIS.hpicfChassisConformance, '1.3.6.1.4.1.11.2.14.10.2.3.1.1': HP_ICF_CHASSIS.hpicfChassisCompliances, '1.3.6.1.4.1.11.2.1...
"""A collection of native images. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import errno import glob import io import logging import os import pwd import shutil import stat from treadmill import appcfg from...
# -*- coding: utf-8 -*- from web import form import re import db # Expresiones regulares necesarias: #formatoVisa=re.compile(r'[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}') # Funciones necesarias para las validaciones def fooFunction(): pass """ EJEMPLO DE FORMULARIO PARA DARSE DE ALTA formularioInscripcion = form....
# -*- coding: utf-8 -*- """ Created on Fri Nov 06 10:30:44 2015 Used creating all of the lines of Gcode. @author: lvanhulle """ import parameters as pr def feedMove(endPoint, ommitZ, extrudeTo, printSpeed): if ommitZ: tempString = ('X{:.3f} Y{:.3f} E{:.3f}'.format(endPoint.x, endPo...
from sqlalchemy import * from sqlalchemy.sql import select, and_ from migrate import * import logging log = logging.getLogger(__name__) def upgrade(migrate_engine): '''#1066 Change Visitor role on System from "reader" to "anon_editor".''' metadata = MetaData(migrate_engine) # get visitor ID user = Ta...
import os import subprocess import sys import timeit import csv import pandas as pd import re import string import numpy as np import shutil directory = os.getcwd() os.chdir(directory) stanford_directory = raw_input("Enter path to Stanford CoreNLP: ") input_filename = raw_input("Enter input csv filename: ") output_...
import json from flask import abort, jsonify, request, Response from flask.views import MethodView import config from finance import utils, db from finance.forms.account import AccountForm from finance.models.account import Account from finance.stats import STATS class AccountAPI(MethodView): """Account Views"...
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2017, Juan Manuel Parrilla <jparrill@redhat.com> # # Ansible 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 opt...
import json import phonenumbers from django import forms from django.forms import widgets from django.utils import six from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from frozendict import frozendict from taggit.for...
import sys class TextInterface: """Text-based interface that contains methods for getting input from the user and displaying search results. """ def __init__(self, trains_list): """Initializes the TextInterface object with a list of all train objects in the simulation. """ ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import hickle as hkl import numpy as np np.random.seed(2 ** 10) from keras import backend as K K.set_image_dim_ordering('tf') from keras.layers import Dropout from keras.models import Sequential from keras.lay...
from concurrent.futures import ThreadPoolExecutor import dcoscli import docopt from dcos import cmds, emitting, options, subcommand, subprocess, util from dcos.errors import DCOSException from dcoscli.subcommand import (default_command_documentation, default_command_info, default_doc) f...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms o...
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
#!/usr/bin/env python2.7 """\ usage: pgctl-fuser [-d] file [file ...] Shows the pids (of the current user) that have this file opened. This is useful for finding which processes hold a file lock (flock). This has the same behavior as `lsof -t file`, but is *much* faster. """ from __future__ import absolute_import from...
from PyQt5 import QtGui, QtCore, QtWidgets from nupic_studio.ui import ICON, State, Global from nupic_studio.htm.node import NodeType, Node from nupic_studio.htm.node_region import Region from nupic_studio.htm.node_sensor import Sensor from nupic_studio.ui.node_region_window import RegionWindow from nupic_studio.ui.no...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'QueuedSMS.using' db.add_column('smsgateway_queuedsms', 'using', self.gf('django.db.models....
""" PDBProp ======= """ import gzip import json import logging import os.path as op import mmtf import os from cobra.core import DictList import pandas as pd import requests import deprecation from Bio.PDB import PDBList from lxml import etree from six.moves.urllib_error import URLError from six.moves.urllib.request i...
# Copyright 2015-2016 Yelp Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
#!/usr/bin/env python """models.py Udacity conference server-side Python App Engine data & ProtoRPC models $Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $ created/forked from conferences.py by wesc on 2014 may 24 """ __author__ = 'wesc+api@google.com (Wesley Chun)' import httplib import endpoints from protor...
#!/usr/bin/env python import setuptools with open('VERSION') as f: version = f.read().strip() with open('README.md') as f: readme = f.read() setuptools.setup( name='alerta-server', version=version, description='Alerta server WSGI application', long_description=readme, url='https://github...
from Components.ActionMap import ActionMap from Components.Button import Button from Components.Label import Label from Components.config import config from Components.MenuList import MenuList from Components.TimerList import TimerList from Components.TimerSanityCheck import TimerSanityCheck from Components.UsageConfig...
from flask_app import application import unittest import logging import json import uuid ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) def make_logger(name): logger = logging.getLogger(name) ...
# -*- coding: utf-8 -*- """ Created on Wed May 15 20:11:59 2013 @author: andres """ import numpy import networkx from scipy import spatial from scipy import stats def find_peaks(th,gc): peaks=[] for i in range(1,len(th)-1): if gc[1][i-1]<gc[1][i] and gc[1][i]>gc[1][i+1]: peaks.append((th[i],gc[1][i])) ...
# pylint: disable=E1101,E1103 # pylint: disable=W0703,W0622,W0613,W0201 from pandas.compat import range, zip from pandas import compat import itertools import re import numpy as np from pandas.core.dtypes.common import ( _ensure_platform_int, is_list_like, is_bool_dtype, needs_i8_conversion) from pandas.c...
"""Compute Rossby wave source from the long-term mean flow. This example uses the iris interface. Additional requirements for this example: * iris (http://scitools.org.uk/iris/) * matplotlib (http://matplotlib.org/) * cartopy (http://scitools.org.uk/cartopy/) """ import warnings import cartopy.crs as ccrs import i...
# (c) 2014 Michael DeHaan, <michael@ansible.com> # # This file is part of Ansible # # Ansible 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 ve...
# ~*~ coding: utf-8 ~*~ """ fleaker._compat ~~~~~~~~~~~~~~~ A small series of compatibility functions and wrappers for internal use, so we aren't tied to any particular compat library. :copyright: (c) 2016 by Croscon Consulting, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import sy...
#--------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #---------------------------------------------------------------------...
import pygame from pygame.locals import * from lib.gameelements import * __version__ = "0.1.1" __author__ = 'MaxA <max.mazin@gmail.com>' WINDOWWIDTH = 480 WINDOWHEIGHT = 640 BARWIDTH = 70 BARHEIGHT = 20 BARCOLOR = (180, 180, 180) BASELINE = 10 BRICKWIDTH = 55 BRICKHEIGHT = 20 BRICKINTERVAL = 4 BRICKCOLOR = (0, ...
from __future__ import unicode_literals from collections import defaultdict from django.template.defaultfilters import timesince from mezzanine import template from mezzanine.generic.models import ThreadedComment from drum.links.utils import order_by_score from drum.links.models import LinkCategory from drum.links.v...
# -*- mode: python; coding: utf-8; -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from .action_binder import ActionBinder from .action_stack import action_stack from .actions import Action from .constants import ...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
import asyncio, contextlib, io, inspect, sys, functools, subprocess, discord from discord.ext import commands from .utils import checks @contextlib.contextmanager def stdoutIO(stdout=None): old = sys.stdout if stdout == None: stdout = io.StringIO() sys.stdout = stdout yi...
from __future__ import print_function from couchbase.bucket import Bucket from couchbase.bucket import LOCKMODE_WAIT from threading import Thread from couchbase.exceptions import KeyExistsError cb = Bucket('couchbase://10.0.0.31/default', lockmode=LOCKMODE_WAIT) cb.upsert('a_list', []) print('Will attempt concurr...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2012-2013 Hector Martin "marcan" <hector@marcansoft.com> # # 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 2 or vers...
"""myproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-bas...
#!/usr/bin/env python2 # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net> from __future__ import absolute_import, division, print_function, unicode_literals import os import sys from calibre import prints from calibre.ebooks.metadata.opf2 import OPFCreator readonly = Tr...
from django import forms from django.conf import settings from django.core.mail import EmailMessage from django.http import HttpResponse from django.shortcuts import get_object_or_404, redirect from django.template import loader from django.views.decorators.http import require_POST from django.views.generic import Deta...
import argparse import sys import unittest import os from util.Api import Api from time import sleep from util.Docker import Docker from util.Dredd import Dredd class ServiceMock: container_name = '' hostname = '' def start_container(self): command = ['docker', 'run', '-d', '--...
"""The Apple TV integration.""" import asyncio import logging from random import randrange from pyatv import connect, exceptions, scan from pyatv.const import Protocol from homeassistant.components.media_player import DOMAIN as MP_DOMAIN from homeassistant.components.remote import DOMAIN as REMOTE_DOMAIN from homeass...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2004-2014 Didotech srl (<http://www.didotech.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publish...
from unittest import TestCase from lie2me import Form, fields from lie2me.exceptions import BadValidation class FormTestCase(TestCase): def test_form_without_fields_is_always_valid(self): form = Form({'foo': 'bar'}) form.submit() self.assertEqual(form.errors, {}) def test_before_sub...
#!/usr/bin/env python import datetime from mock import patch try: import unittest2 as unittest except ImportError: import unittest import app_config app_config.DATABASE_NAME = 'carebot_test.db' app_config.date_cutoff = datetime.date(1997, 1, 1) from scrapers.npr_spreadsheet import SpreadsheetScraper from ut...
# -*- coding: utf-8 -*- """ werkzeug.serving ~~~~~~~~~~~~~~~~ There are many ways to serve a WSGI application. While you're developing it you usually don't want a full blown webserver like Apache but a simple standalone one. From Python 2.5 onwards there is the `wsgiref`_ server in the standa...
# -*- coding: utf-8 -*- # Copyright 2018 Kevin Reid and the ShinySDR contributors # # This file is part of ShinySDR. # # ShinySDR 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 Licen...
import RPi.GPIO as GPIO import datetime import time import pandas as pd import logging import logging.handlers import sys logger = logging.getLogger('fridge') handler = logging.StreamHandler() fHandler = logging.FileHandler('fridge.log') formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s", "%Y-...
import datetime import random from injectors import ExponentialInjector from injectors import PlateauInjector from module import AbstractModule from twisted.python import log from module_decorators import SkipHandler from models import SOProfileModel # ultimately pull from settings file injector_map = { "exponent...
# Copyright (C) 2008-2009 Open Society Institute # Thomas Moroz: tmoroz@sorosny.org # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License Version 2 as published # by the Free Software Foundation. You may not use, modify or distribu...