content
stringlengths
4
20k
"""NetSPOT reports.""" from collections import defaultdict from django.contrib.auth.decorators import login_required from django.shortcuts import render import helpers import netspot_settings class Report(object): """Class to represent a report.""" def __init__(self, name, description, headers, rows): self....
# -*- coding: utf-8 -*- """ This module provides methods for calling objective functions """ # Future from __future__ import absolute_import, division, print_function, \ unicode_literals, with_statement # Standard Library from inspect import getargspec # First Party from metaopt.core.call.util.exception import C...
from cobra.model.aaa import User from createMo import * DEFAULT_EMPTY = '' DEFAULT_STATUS = 'active' DEFAULT_EXPIRES = 'no' DEFAULT_EXPIRATION = 'never' STATUS_CHOICES = ['inactive', 'active'] EXPIRES_CHOICES = ['yes', 'no'] def input_password(length=8): pw = input_raw_input("Password", required=True) if l...
from setuptools import setup, find_packages from career import __version__ as version with open('README.rst') as f: long_description = f.read() setup( name = 'career', version = version, description = 'The very basic to start some elearning activity', long_description = long_description, autho...
#!/usr/bin/python import getopt, sys from bloatitstats.parser.logparser import logparser from bloatitstats.commun.database import database from bloatitstats.parser.entry_processor import entry_processor version = '0.1' def parse_file(dbname, logfile): parser = logparser(logfile) base = database(dbname) ...
from collections import defaultdict import string import sys from nltk import WordNetLemmatizer sys.path.append('.') import argparse import logging from operator import itemgetter import os import numpy as np import pandas as pd import scipy.sparse as sp from scipy.io import loadmat from discoutils.tokens import Docum...
"""Test the monitoring of the server heartbeats.""" import sys import threading sys.path[0:0] = [""] from pymongo import monitoring from pymongo.errors import ConnectionFailure from pymongo.ismaster import IsMaster from pymongo.monitor import Monitor from pymongo.pool import PoolOptions from test import unittest, cl...
# -*- coding: utf-8 -*- from south.db import db from south.v2 import SchemaMigration from django.db import connection, models class Migration(SchemaMigration): def forwards(self, orm): try: # Adding M2M table for field users on 'DocumentPermission' if 'documentpermission_users' no...
import copy from pipeline.utils.tools import extract_explicit_parameter class JobParameters(object): @extract_explicit_parameter def __init__(self, work_mode=0, job_type="train", backend=0, computing_engine=None, federation_engine=None, storage_engine=None, engines_address=None,federated_mode...
import numpy as _np import scipy.optimize as _scyopt def matching(acc, objectives=None, constraints=None,variables=None, covariables=None): """ Performs the matching of optical functions using least squares. variables : Must be a list of dictionaries with keys: 'elements': family name or list of indi...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import cPickle import os import random import time import numpy import paddle import paddle.dataset.imdb as imdb import paddle.fluid as fluid import paddle.batch as batch import paddle.fluid.pr...
""" support numpy compatiblitiy across versions """ import re import numpy as np from distutils.version import LooseVersion from pandas.compat import string_types, string_and_binary_types # numpy versioning _np_version = np.__version__ _nlv = LooseVersion(_np_version) _np_version_under1p10 = _nlv < '1.10' _np_versio...
import time from electrum_cesc.i18n import _ from electrum_cesc.util import PrintError, UserCancelled from electrum_cesc.wallet import BIP44_Wallet class GuiMixin(object): # Requires: self.proto, self.device messages = { 3: _("Confirm the transaction output on your %s device"), 4: _("Confirm...
import torch import torch.nn import torch.nn.functional as nn import torch.autograd as autograd import torch.optim as optim import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import os from torch.autograd import Variable from tensorflow.examples.tutorials.mnist import input_data i...
import sys if len(sys.argv) != 4: print 'Usage: python', sys.argv[0], '[input] [output] [types]' print '\ttypes: recover the generalization not listed in this argument with "+", example: literal+psn' exit() input_name = sys.argv[1] output_name = sys.argv[2] types = set(sys.argv[3].split('+')) import codecs input_f...
# -*- coding: utf-8-*- """ Author: Marco Dinacci <<EMAIL>> They work better with Python2.5 as we can avoid writing: newf.__name__ = f.__name__ newf.__dict__.update(f.__dict__) newf.__doc__ = f.__doc__ newf.__module__ = f.__module__ """ import time def Property(func): return property(**func()) def deprecated(fu...
import sys import os.path import numpy as np from arg_parser import parse_args from printer import print_header, print_usage, print_line from polymage_common import set_vars, set_cases from exec_mg import calc_norm def init_norm(app_data): grid_data = app_data['grid_data'] U_ = grid_data['U_'] app_data['r...
from django import forms from django.core.exceptions import ValidationError from django.forms.utils import ErrorList from django.template.loader import render_to_string from django.utils.html import format_html, format_html_join from django.utils.safestring import mark_safe from wagtail.admin.staticfiles import versio...
import sqlalchemy as sa from twisted.trial import unittest from buildbot.test.util import migration from buildbot.util import sautils class Migration(migration.MigrateTestMixin, unittest.TestCase): def setUp(self): return self.setUpMigrateTest() def tearDown(self): return self.tearDownMigr...
# -*- coding: utf-8 -*- # File: common.py import numpy as np import cv2 from tensorpack.dataflow import RNGDataFlow from tensorpack.dataflow.imgaug import transform class DataFromListOfDict(RNGDataFlow): def __init__(self, lst, keys, shuffle=False): self._lst = lst self._keys = keys self...
#!/usr/bin/env python # Require setuptools. See http://pypi.python.org/pypi/setuptools for # installation instructions, or run the ez_setup script found at # http://peak.telecommunity.com/dist/ez_setup.py from setuptools import setup, find_packages setup( name = "cobe", version = "2.1.0", author = "Peter ...
#!/usr/bin/python import time def mst_handler(new_node_dict, nodedict): if nodedict.has_key('packets'): nodedict['packets'] = nodedict['packets'] + 1 else: nodedict['packets'] = 1 if nodedict.has_key('first_tv_h'): tv = time.time () tv = int (tv) total_time = t...
""" All methods must return media_ids that can be passed into e.g. like() or comment() functions. """ import random from tqdm import tqdm from . import delay def get_media_owner(self, media_id): self.mediaInfo(media_id) try: return str(self.LastJson["items"][0]["user"]["pk"]) except: ...
from config import * from context import Context class Dialplan: """ Logic to assign the call to the right context """ NOT_CREDIT_ENOUGH = '002_saldo_insuficiente.gsm' NOT_AUTH = '013_no_autorizado.gsm' NOT_REGISTERED = '015_no_access.gsm' WRONG_NUMBER = '007_el_numero_no_es_corecto.gsm' ...
# -*- coding:utf8 -*- __author__ = 'cosven' import os import json import hashlib from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtNetwork import * from base.network_manger import NetworkManager from base.logger import LOG from base.common import write_json_into_file fr...
"""Tests for OAuth2Reddit class.""" from __future__ import print_function, unicode_literals from praw import Reddit, errors from praw.objects import Submission from six import text_type from .helper import PRAWTest, USER_AGENT, betamax class OAuth2RedditTest(PRAWTest): def setUp(self): self.configure() ...
import json from gnocchiclient.tests.functional import base class AggregatesClientTest(base.ClientTestBase): def test_scenario(self): # PREPARE AN ARCHIVE POLICY self.gnocchi("archive-policy", params="create agg-fetch-test " "--back-window 0 -d granularity:1s,points:86400") ...
from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class Achievement(Base): __tablename__ = 'achievement' achievementid = Column(Integer, primary_key=Tr...
import multiprocessing import queue import os import platform import subprocess from coalib.collecting.Collectors import collect_files from coalib.collecting import Dependencies from coalib.misc.StringConverter import StringConverter from coalib.output.printers import LOG_LEVEL from coalib.processes.BearRunning import...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '../ovsdb/ovsdbmonitor/MainWindow.ui' # # by: PyQt4 UI code generator 4.7.3 # # WARNING! All changes made in this file will be lost! try: from OVEStandard import globalForcePySide if globalForcePySide: raise Exception()...
import pytest np = pytest.importorskip("numpy") npt = pytest.importorskip("numpy.testing") pytest.importorskip("scipy") import networkx as nx from networkx.generators.degree_seq import havel_hakimi_graph from networkx.generators.expanders import margulis_gabber_galil_graph class TestLaplacian: @classmethod ...
''' The following code requires python-stix v1.1.0.4 or greater installed. For installation instructions, please refer to https://github.com/STIXProject/python-stix. ''' from stix.core import STIXPackage from stix.incident import Incident from stix.common.related import RelatedObservable from cybox.core import Observa...
"""shell pip install autokeras """ import tensorflow as tf from tensorflow.keras.datasets import mnist import autokeras as ak """ To make this tutorial easy to follow, we just treat MNIST dataset as a regression dataset. It means we will treat prediction targets of MNIST dataset, which are integers ranging from 0 to...
# # -*- coding: utf-8 -*- # import Tkinter import tkFont import os class WidgetBack(object): def __init__(self, *e, **kw): self.__histback = [] self.__current = "" self.__histforward = [] self.bind("<Control-z>",self.__Back) self.bind("<Control-y>",self.__Forward) self.bind("<Key>", self.__keyPress) ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging import re import html5lib from html5lib.sanitizer import HTMLSanitizer from html5lib.serializer.htmlserializer import HTMLSerializer from . import callbacks as linkify_callbacks from .encoding import force_unicode from .sanitizer import B...
{ "name" : "mrp_bom_group_type", "version" : "1.0", "author" : "Smart Solution (<EMAIL>)", "website" : "www.smartsolution.be", "category" : "Generic Modules/Base", "description": """ """, "depends" : ["mrp",], "data" : [ 'mrp_bom_group_type_view.xml', 'mrp_bom_group_type_...
from __future__ import unicode_literals from django.contrib import admin from django.contrib.auth.models import User from emis_account.models import Account, SignupCode, AccountDeletion, EmailAddress from emis_account.models import User_Category class SignupCodeAdmin(admin.ModelAdmin): list_display = ["code", "m...
#!python # Download games from the Riot API from Challenger/Master players import configparser import multiprocessing import os import pickle import random import sys import time from Modes import Base_Mode from multiprocessing import Manager from InterfaceAPI import InterfaceAPI, ApiError, ApiError404, ApiError403 ...
import logging import os from pcs.daemon import auth from pcs.daemon.app import ui from pcs_test.tier0.daemon.app import fixtures_app from pcs_test.tools.misc import ( create_setup_patch_mixin, get_tmp_dir, ) USER = "user" PASSWORD = "password" LOGIN_BODY = {"username": USER, "password": PASSWORD} PREFIX = "/...
import proto # type: ignore from google.ads.googleads.v7.enums.types import ( response_content_type as gage_response_content_type, ) from google.ads.googleads.v7.resources.types import batch_job from google.ads.googleads.v7.services.types import google_ads_service from google.rpc import status_pb2 as gr_status #...
from django.test import TestCase from push_notifications.gcm import send_bulk_message, send_message from ._mock import mock from .responses import GCM_JSON, GCM_JSON_MULTIPLE class GCMPushPayloadTest(TestCase): def test_fcm_push_payload(self): with mock.patch("push_notifications.gcm._fcm_send", return_value=GCM...
#!/usr/bin/env python import rospy from jsk_network_tools.msg import AllTypeTest import unittest def defaultMessage(): msg = AllTypeTest() msg.bool_array[0] = True msg.uint8_atom = 12 msg.uint8_array = "abcd" msg.int8_atom = 12 msg.int8_array[0] = 12 msg.uint16_atom = 12 msg.uint16_arr...
import unittest from streamlink.plugins.canalplus import CanalPlus class TestPluginCanalPlus(unittest.TestCase): def test_can_handle_url(self): # should match self.assertTrue(CanalPlus.can_handle_url("https://www.mycanal.fr/docus-infos/l-info-du-vrai-du-13-12-politique-les-affaires-reprennent/p/1...
import os import os.path class File(object): def __init__(self, *pathComponents): self._path = FileUtils.buildPath(*pathComponents) self.content = None @property def path(self): return self._path @path.setter def path(self, value): raise NotImplemented def is...
""" Muddery text game creation system This is the main top-level API for Muddery. You can also explore the muddery library by accessing muddery.<subpackage> directly. For full functionality you need to explore this module via a django- aware shell. Go to your game directory and use the command 'muddery.py shell' to l...
#coding:utf8 ''' Created on 2014年2月20日\n 协议、工厂\n @author: lan (www.9miao.com)\n ''' from gtwisted.core.base import Transport from gevent import Greenlet from gevent.socket import create_connection from gtwisted.utils import log import socket import traceback class BaseProtocol(Greenlet): """基础协议,一个协...
from PyQt5.QtCore import Q_CLASSINFO, pyqtSlot from PyQt5.QtDBus import QDBusAbstractAdaptor, QDBusConnection class AppService(QDBusAbstractAdaptor): Q_CLASSINFO("D-Bus Interface", 'org.autokey.Service') Q_CLASSINFO( "D-Bus Introspection", ' <interface name="org.autokey.Service">\n' ...
"""This code example gets all active content categorized as a "comedy" using the network's content browse custom targeting key. This feature is only available to DFP video publishers. The LoadFromStorage method is pulling credentials and properties from a "googleads.yaml" file. By default, it looks for this file in y...
class ACOSException(Exception): def __init__(self, code=1, msg=''): self.code = code self.msg = msg super(ACOSException, self).__init__(msg) def __str__(self): return "%d %s" % (self.code, self.msg) class ACOSUnsupportedVersion(ACOSException): pass class ACOSUnknownError...
# -*- coding: utf-8 -*- from django import forms from django.conf import settings from django.core.urlresolvers import reverse_lazy as reverse from django.contrib.auth import get_user_model from mail_factory import factory import uuid from postbox.core.mails import BaseMailHeader, BaseMailForm from email_change.model...
__author__ = 'aje' # # Copyright (c) 2008 - 2013 10gen, Inc. <http://10gen.com> # # 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 r...
import unittest from dlt.field import Field from dlt.paragraph import Paragraph class ParagraphTest(unittest.TestCase): def test_default_init(self): paragraph = Paragraph() self.assertEqual(len(paragraph), 0) def test_init_one_field(self): paragraph = Paragraph(Field("name", "value",...
import sys, time from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from MumbleChannelManager import ChannelManager ''' Makes possible to add and delete Murmur channels using http requests. request format: <server host:port>/<secret>/CREATE_CHANNEL/<channel name> <server hos...
"""gbp_shared_attribute Revision ID: f4d890a9c126 Revises: d595542cf3f5 Create Date: 2014-11-12 21:13:08.98888 """ # revision identifiers, used by Alembic. revision = 'f4d890a9c126' down_revision = 'd595542cf3f5' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column( 'gp_policy...
__all__ = [ 'LinodeDNSDriver' ] from libcloud.utils.misc import merge_valid_keys, get_new_obj from libcloud.common.linode import (API_ROOT, LinodeException, LinodeConnection, LinodeResponse) from libcloud.dns.types import Provider, RecordType from libcloud.dns.types import ZoneD...
#!/usr/bin/python3 # This script parses RPM repos import hashlib import os import sys from xml.etree.ElementTree import ElementTree XMLREPONS = "{http://linux.duke.edu/metadata/repo}" XMLPKGNS = "{http://linux.duke.edu/metadata/common}" def check_file(filepath, checksumtype, checksum): filechecksum = "" if ...
#!/usr/bin/env python import telnetlib #Need the following to be able to use time.sleep import time #I need the following to be able to use try and except import socket import sys TELNET_PORT = 23 TELNET_TIMEOUT = 6 #Create Telnet Connection def telnet_connect(ip_addr): try: return telnetlib.Telnet(ip_addr, TELNE...
#!/usr/bin/env python3 # *-* coding:utf-8 *-* """ :mod:`lab_json` -- JSON to YAML and back again ========================================= LAB_JSON Learning Objective: Learn to navigate a JSON file and convert to a python object. :: a. Create a script that expects 3 command line argume...
""" Django settings for DWQMS project. Generated by 'django-admin startproject' using Django 1.9.1. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # ...
import os import logging from twisted.internet import reactor from rconsoft.plugins import Plugin from rconsoft import rcon_client, rcon_receiver from rconsoft.config import cget, has_access log = logging.getLogger('general') #------------------------------ class Lo3ScorePlugin(Plugin): #==========...
"""Tests for analysis.py.""" import unittest import warnings import numpy as np import pandas as pd import pyhande.analysis as analysis import tests.create_mock_df as create_mock_df class TestProjectedEnergy(unittest.TestCase): """Test analysis.projected_energy.""" def setUp(self): # Create mock corr...
#!/usr/bin/python # Accumulatore originale di accumunet acc = int("450da364ae10b42c83f180d01fecf5cbd0901d4b1b8eed22d8490d46a42a65e7", 16) print(format(acc, 'x').upper()) # Witness wit1 = int("357d626250e41eb0390d60e4c33859369681fec371ab532e428b63059e97c6a7", 16) wit2 = int("26ff76d0f66b8403bda6534fce3dbcaf47ffd5eb7e06...
import fnmatch import os import re import ntpath import sys import argparse def check_sqf_syntax(filepath): bad_count_file = 0 def pushClosing(t): closingStack.append(closing.expr) closing << Literal( closingFor[t[0]] ) def popClosing(): closing << closingStack.pop() with open...
import goocanvas import gcompris import gcompris.utils import gcompris.skin import gcompris.admin import gtk import gtk.gdk from gcompris import gcompris_gettext as _ import sys; # Database try: from sqlite3 import dbapi2 as sqlite # python 2.5 except: try: from pysqlite2 import dbapi2 as sqlite except: ...
import argparse from datetime import datetime, timedelta try: import json except ImportError: import simplejson as json import logging import os import re import sqlite3 import sys from time import mktime # 3rd-party modules import feedparser from pypump import PyPump from pypump import Client SPIGOT_VERSION ...
import mock import pip from unittest import TestCase from plugins.applications.db2 import db2_crawler from plugins.applications.db2.feature import DB2Feature from plugins.applications.db2.db2_container_crawler \ import DB2ContainerCrawler from plugins.applications.db2.db2_host_crawler \ import DB2HostCrawler fr...
import numpy as np import os import random from sys import platform as sys_pf import matplotlib if sys_pf == 'darwin': matplotlib.use("TkAgg") from matplotlib import pyplot as plt # --- # Demo for how to load image and stroke data for a character # --- # Plot the motor trajectory over an image # # Input # I [105 x 1...
#!/usr/bin/env python # -*- coding: utf-8 -*- from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt import sys from PyQt4.QtGui import QStandardItem from iconizer.qtconsole.list_window import ItemToActionDictInListUi, ListViewWindow def decode_str_from_encoding(str_buf, encoding): print "decode from", encod...
from unittest import TestCase from nose.tools import assert_equal, raises, assert_true from wlauto.core.extension import Extension, Parameter, Param, ExtensionMeta, Module from wlauto.utils.types import list_of_ints from wlauto.exceptions import ConfigError class MyMeta(ExtensionMeta): virtual_methods = ['vali...
""" This module provides helper functions for okconfig """ from __future__ import absolute_import from __future__ import print_function from builtins import object import re import fcntl import os from subprocess import Popen, PIPE, STDOUT from pynag import Model import okconfig def add_defaultservice_to_host(host...
#/datastore/zhenyang/bin/python import sys import os import gensim, logging import numpy as np import scipy.io as sio def main(): ############## logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) #pretrained_model = './vectors.bin' #pretrained_model = '../fr...
#!/usr/bin/env python # encoding: utf-8 from django.forms import EmailField from django.core.exceptions import ValidationError from yard.exceptions import ConversionError from yard.utils import is_iter, is_strint from .base import Parameter from datetime import datetime, time as Time import re import socket import math...
# this converts a string column into a datetime column # if a column cannot be found, it is simply skipped def convert_df_date_cols(df, date_cols): for col in date_cols: try: df[col] = pd.to_datetime(df[col]) except: # this column can't be found pass # maybe log a...
from os import listdir, sep, path, makedirs from os.path import isfile, join from diff_match_patch import diff_match_patch from urlparse import urlparse import re import sys import os import stat import datetime import importlib import tarfile import re from constants import get_log_directory from __b...
"""Volume-related Utilities and helpers.""" import math from Crypto.Random import random from oslo_concurrency import processutils from oslo_config import cfg from oslo_log import log as logging from oslo_utils import strutils from oslo_utils import timeutils from oslo_utils import units from cinder.brick.local_dev...
import pytest import spack.repo from spack.build_environment import get_std_cmake_args from spack.spec import Spec def test_cmake_std_args(config, mock_packages): # Call the function on a CMakePackage instance s = Spec('cmake-client') s.concretize() pkg = spack.repo.get(s) assert pkg.std_cmake_ar...
""" This module contains the base class for pathos servers, and describes the pathos server interface. If a third-party RPC server is selected, such as 'parallel python' (i.e. 'pp') or 'RPyC', direct calls to the third-party interface are currently used. """ __all__ = ['Server'] class Server(object): """ Server ...
""" Fixture to manipulate configuration models. """ import json import re import requests from lazy import lazy from common.test.acceptance.fixtures import LMS_BASE_URL class ConfigModelFixtureError(Exception): """ Error occurred while configuring the stub XQueue. """ pass class ConfigModelFixture...
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import os from setuptools import setup def read(*paths): """Build a file path from *paths* and return the contents.""" with open(os.path.join(*paths), 'r') as f: return f.read() setup( name='dj...
"""Min wind chill frequency""" import datetime from collections import OrderedDict import numpy as np from pandas.io.sql import read_sql from pyiem.plot.use_agg import plt from pyiem.util import get_autoplot_context, get_dbconn from pyiem.exceptions import NoDataFound MDICT = OrderedDict( [ ("all", "No Mo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging from ast import literal_eval import MySQLdb from _misc import Misc class UserHandler(object): """ Class with functions for user management. Has SQL interface. Note: No exception handling in this class. """ def __init__(self): ...
import torch from . import misc from ..types import TensorOrTensors def update_step_size(error_estimate, prev_step_size, safety=0.9, facmin=0.2, facmax=1.4, prev_error_ratio=None): """Adaptively propose the next step size based on estimated errors.""" if error_estimate > 1: pfactor = 0 ifacto...
from __future__ import absolute_import import unittest import simplejson as json from simplejson.compat import StringIO try: from collections import namedtuple except ImportError: class Value(tuple): def __new__(cls, *args): return tuple.__new__(cls, args) def _asdict(self): ...
import re import os import sys import StringIO def getFileContents(fname): if type(fname) is not str: fname = fname.group(3) # If neither the file or file.tex exists, then we just give up. if not os.path.isfile(fname): if os.path.isfile(fname + '.tex'): fname += '.tex' ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Ejercicio 1 Python CALCULAR LA LETRA QUE CORRESPONDE A UN DNI: http://www.interior.gob.es/web/servicios-al-ciudadano/dni/calculo-del-digito-de-control-del-nif-nie para consultar el algoritmo de c�lculo Se solicita la introducci�n del DNI por teclado (el formato co...
""" homeassistant.components.notify.syslog ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Syslog notification service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.syslog.html """ import logging import syslog from homeassistant.helpers import validate_...
import logging from time import time from glib import timeout_add_seconds log = logging.getLogger('jobservice') class IdleTimeout: """ Keeps track of the time since last use. If idle for too long, quit. """ def __init__(self, loop, idlemax=600): self.loop = loop self.idlemax =...
from django.conf.urls import patterns, include, url from django.views.generic import RedirectView from django.views.decorators.cache import never_cache import logging logger = logging.getLogger("toaster") # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpa...
from django.db import models from django.db.models import signals from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType from datetime import datetime ############################################################################## # Common/Abstract Djangregator Models...
from PySide import QtGui from mapclientplugins.stringsource2step.ui_configuredialog import Ui_ConfigureDialog INVALID_STYLE_SHEET = 'background-color: rgba(239, 0, 0, 50)' DEFAULT_STYLE_SHEET = '' class ConfigureDialog(QtGui.QDialog): ''' Configure dialog to present the user with the options to configure this...
""" Run Regression Test Suite This module calls down into individual test cases via subprocess. It will forward all unrecognized arguments onto the individual test scripts, other than: - `-extended`: run the "extended" test suite in addition to the basic one. - `-win`: signal that this is running in a Windows...
# -*- coding: utf-8 -*- """ Created on Sun Mar 5 22:43:20 2017 @author: Atul """ import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.preprocessing import Imputer, LabelEncoder, OneHotEncoder, StandardScaler from sklearn.model_selection import train_test_split from sklearn.linear_model...
#!/bin/sh """": # -*-python-*- bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble # Copyright (C) 2010 Rob Browning # # This code is covered under the terms of the GNU Library General # Public License as described in the bup LICENSE file. import sys, stat, err...
import gtk from gtk import gdk import gobject import widgets class DropdownPanelButton (gtk.ToggleButton): """Button which drops down a panel with (almost) arbitrary widgets. The panel iself is a specialised `gtk.Window` bound to its button. """ __gtype_name__ = "DropdownPanelButton" __gproperti...
import helium import unittest class TestFingerprints(unittest.TestCase): def test_path_fingerprint(self): mol = helium.Molecule() fp = helium.path_fingerprint(mol) fp = helium.path_fingerprint(mol, 7) fp = helium.path_fingerprint(mol, 7, 16) fp = helium.path_fingerprint(mol...
import bz2 import gzip import sys def opener(mode='r'): """Factory for creating file objects Keyword Arguments: - mode -- A string indicating how the file is to be opened. Accepts the same values as the builtin open() function. - bufsize -- The file's desired buffer size. Accepts ...
from msrest.serialization import Model class JobErrorDetails(Model): """The Data Lake Analytics job error details. Variables are only populated by the server, and will be ignored when sending a request. :ivar description: the error message description :vartype description: str :ivar details:...
""" Generic modulation and demodulation. """ from gnuradio import gr from modulation_utils import extract_kwargs_from_options_for_class from utils import mod_codes import digital_swig as digital import math try: from gnuradio import filter except ImportError: import filter_swig as filter # default values (us...
import maya.cmds as cmds import maya.mel as mel re_dict = {"diffuseChannel": ("DIFFUSE", "rawdiffuse",), "reflectChannel" : ("REFLECTION", "reflect",), "refractChannel" : ("REFRACTION", "refract",), "sampleRateChannel" : ("SAMPLE_RATE", "sampleRate",), "selfIllumChannel": ("SELF_ILLUM", "selfIllum",), "shadowChannel"...
# -*- coding: utf-8 -*- import sys import time from os.path import dirname, join as join_path from chibitest import TestCase, Benchmark, ok class BenchmarkLibraries(Benchmark): def setup(self): fp = join_path(dirname(__file__), 'data', 'markdown-syntax.md') with open(fp, 'r') as f: s...