src
stringlengths
721
1.04M
""" Plugin responsible for setting OpenStack global options """ import glob import logging import os import uuid from packstack.installer import processors from packstack.installer import utils from packstack.installer import validators from packstack.modules.common import filtered_hosts from packstack.modules.osplu...
# -*- coding: utf8 -*- from gevent import monkey; monkey.patch_all() from pyeth.discovery import EndPoint, Server, Node import binascii from urlparse import urlparse test_boots = [ # "enode://561ab5a08c6f2e486059f2add5d08932e4f0ebbc6c2a2ba5e0f930a5441e65ec59f5b6684b3e75bed380109135d089e56380dad83357f5fda2122fdbdb...
from django import forms from enrollment.models import Servicio from enrollment.models import TipoServicio from enrollment.models import Matricula from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django.forms import ModelForm, Form from utils.models import TiposNivel from django.ut...
from models.model_21_price_history_seq2seq_dyn_dec_ins import PriceHistorySeq2SeqDynDecIns import pickle import dill from os import path, remove import numpy as np from skopt.space.space import Integer, Real, Categorical from skopt import gp_minimize import tensorflow as tf from mylibs.jupyter_notebook_helper import M...
import tornado import tornado.ioloop import tornado.web import os, uuid __UPLOADS__ = "uploads/" import sys sys.path.append('..') from odt_parse import OdtData from odt_diff import find_style_by_name ref_name = '../libro_personalizados.odt' par_prop = ['backgroundcolor', 'textalign', 'marginleft', 'marginright', 'm...
# Copyright 2021 The TensorFlow Ranking Authors. # # 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 ag...
# Copyright 2011 OpenStack Foundation # Copyright 2011 Nebula, 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/...
# -*- coding: utf-8 -*- # Copyright 2020 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...
import sys import wx import epics.wx prefix = "D100X" def onCameraSelection(event): widget = event.GetEventObject() camera = widget.GetStringSelection() monitor = widget.GetName() epics.caput("%s:%s:CAMERA" % (prefix, monitor),"%s" % camera) app = wx.App() bigfont = wx.Font(24, wx.DECORATIVE, wx.NOR...
import frappe from datetime import datetime @frappe.whitelist() def get_energy_points_heatmap_data(user, date): return dict(frappe.db.sql("""select unix_timestamp(date(creation)), sum(points) from `tabEnergy Point Log` where date(creation) > subdate('{date}', interval 1 year) and date(creation) < subdate('{...
import collections import copy import typing as tp from satella.coding.typing import T ITER_KEYS = 0 ITER_VALUES = 1 ITER_ITEMS = 2 class DictDeleter: """ Having problems deleting entries from your dict while iterating on them? No problem. Just swap the following: >>> keys_to_delete = [] >>> fo...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import datetime import werkzeug.urls from collections import OrderedDict from werkzeug.exceptions import NotFound from odoo import fields from odoo import http from odoo.http import request from odoo.addons.http_routin...
import tkinter from random import choice, randint ball_initial_number = 20 ball_minimal_radius = 15 ball_maximal_radius = 40 ball_available_colors = ['green', 'blue', 'red', 'lightgray', '#FF00FF', '#FFFF00'] balls_coord = []#cpis kor balls_num = []#cpic nom def click_ball(event): """ ooo canvas :param ...
import sim import matplotlib.pyplot as plt sim.DEBUG = True # seed sim.random.seed(13) # default values sim.tg_default_size = lambda x: 250 sim.DBA_IPACT_default_bandwidth = 5000 max_onus = 3 # seed sim.random.seed(13) # for f in range(1,max_onus): # # override suffix writer # sim.packet_w = sim.Writer("#...
# encoding:utf8 import sys import os import json from optparse import OptionParser class Transformer(object): def __init__(self, idir, prefixs, start): self.idir = idir.decode("utf8") self.prefixs = prefixs self.start = start def loadRecs(self, xaxis, yaxis): self.xaxis = xaxis...
#------------------------------------------------------------------------------ # Copyright (C) 2009 Richard W. Lincoln # # 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 restrictio...
#(C) Copyright Syd Logan 2016-2021 #(C) Copyright Thousand Smiles Foundation 2016-2021 # #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 req...
#***************************************************************************** # errors.py (part of the blacktie package) # # (c) 2013 - Augustine Dunn # James Laboratory # Department of Biochemistry and Molecular Biology # University of California Irvine # wadunn83@gmail.com # # Licenced under the GNU General P...
import os, sys import glob import optparse import tables import pandas as pd import numpy as np import h5py def parse_commandline(): """ Parse the options given on the command-line. """ parser = optparse.OptionParser() parser.add_option('-i','--ifos', type=str, default='LHO,LLO', help='GW Obser...
#!/usr/bin/env python # # $File: mutatorVSP.py $ # # This file is part of simuPOP, a forward-time population genetics # simulation environment. Please visit http://simupop.sourceforge.net # for details. # # Copyright (C) 2004 - 2010 Bo Peng (bpeng@mdanderson.org) # # This program is free software: you can redistribute...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Yannick Buron and Valeureux Copyright Valeureux.org # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # ...
def cut_out_gals(image_file,information,cutout_save_location): ''' Task : To cut out images given the main mosaic, and an information array with necessary parameters. Input : 1) Image Mosaic location 2) Information array : This array should be loaded using np.genfromtxt with the head...
""" WE'RE USING MIGRATIONS! If you make changes to this model, be sure to create an appropriate migration file and check it in at the same time as your model changes. To do that, 1. Go to the edx-platform dir 2. ./manage.py schemamigration instructor_task --auto description_of_your_change 3. Add the migration file cr...
# -*- coding: utf-8 -*- """ Production Configurations - Use Amazon's S3 for storing static files and uploaded media - Use mailgun to send emails - Use Redis for cache """ from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.utils import six from...
import os import sys import json import yaml import time import subprocess from io import StringIO import codecs from datetime import datetime import logging class StimelaLogger(object): def __init__(self, lfile, jtype="docker"): self.lfile = lfile # Create file if it does not exist if no...
# Copyright (c) 1996-2015 PSERC. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """Tests for code in C{scale_load}. """ from os.path import dirname, join from numpy import array, zeros, in1d, vstack, flatnonzero as find from pypower.loadcas...
from SOAPpy import WSDL from django.utils.translation import gettext_lazy as _ from django.conf import settings from os.path import dirname from signature import CSignature from models import MERCHANT_NUM MUZO_ORDER_STATES = { 0: _('UNKNOWN'), 1: _('REQUESTED'), 2: _('PENDING'), 3: _('CREATED'), 4: _('APPROVE...
# -*- coding: utf-8 -*- import argparse import os from config import cfg # pylint: disable=E0611,W0614 from func import file_get_contents os.environ['TZ'] = 'UTC' parser = argparse.ArgumentParser() parser.add_argument('--auto', action='store_true') parser.add_argument('--no-diff', action='store_true') parser.add_ar...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
import pytest from tests.infrastructure.test_utils import parse_local from thinglang.lexer.values.identifier import Identifier from thinglang.parser.definitions.method_definition import MethodDefinition from thinglang.parser.errors import VectorReductionError def validate_method_definition(node, name, expected_argum...
"""Base class for directory implementations.""" import abc import collections UserEntry = collections.namedtuple("UserEntry", "id join_date tags") UserEntry.__doc__ = """ Description of attributes of a single user. Internally this is a `collections.namedtuple`. """ UserEntry.id.__doc__ = """String user ID.""" User...
# This module parses MITM Proxy requests/responses into (command, data pairs) # This should mean that the MITMProxy code should simply pass the messages + its own data to this module from urlparse import urlparse import datetime import mmh3 import json import zlib import os def encode_to_unicode(msg): """ Tri...
# -*- encoding: utf-8 -*- import openerp from openerp.osv import fields, osv TAX_DEFAULTS = { 'base_reduction': 0, 'amount_mva': 0, 'amount_type': 'percent', } class account_tax_template(osv.osv): """ Add fields used to define some brazilian taxes ...
"""Chip viewer and widget. In the lower left corner of the main Pynche window, you will see two ChipWidgets, one for the selected color and one for the nearest color. The selected color is the actual RGB value expressed as an X11 #COLOR name. The nearest color is the named color from the X11 database that is closest ...
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
import codecs import os import sys from multiprocessing import Process, Queue from lxml import etree import tablib COLNAME_MODIFIED_DATE = 'last modified date' COLNAME_CREATION_DATE = 'creation date' COLNAME_KEYWORDS = 'keywords' COLNAME_EMAIL = 'email' COLNAME_WORKS = 'works' COLNAME_FUNDING = 'funding' COLNAME_AFFIL...
# 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 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # bu...
# encoding: utf-8 ''' Free as freedom will be 26/9/2016 @author: luisza ''' from __future__ import unicode_literals from .settings import (NOTIFICATION_USER_MODEL, USER_LOOKUP_FIELDS, NOTIFICATION_GROUP_MODEL, GROUP_LOOKUP_FIELDS) from .utils import extract_emails, get_model #from django.co...
import pytest import numpy from numpy.testing import assert_allclose from thinc.api import clone, concatenate, noop, add, map_list from thinc.api import Linear, Dropout, Model, NumpyOps from thinc.layers import chain, tuplify @pytest.fixture(params=[1, 2, 9]) def nB(request): return request.param @pytest.fixtur...
# Copyright 2017 Virgil Dupras # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html """This module facilitates currencies management. It exposes :class:`Currenc...
# calibre wide preferences ### Begin group: DEFAULT # database path # Path to the database in which books are stored database_path = '/home/username/library1.db' # filename pattern # Pattern to guess metadata from filenames filename_pattern = u'(?P<title>.+) - (?P<author>[^_]+)' # isbndb com key # Access key for...
# Copyright 2016 Hewlett Packard Enterprise Development, LP. # # 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...
# 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, software # d...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import from threading import Thread, Lock, Event import numpy as np, copy, sys, time, os, subprocess, json from learnbot_dsl.Clients.Devices import * from learnbot_dsl import PATHINTERFACES from datetime import timedelta from ...
# Copyright 2019 The Kubeflow Authors # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
"""The tests for numeric state automation.""" from datetime import timedelta import logging from unittest.mock import patch import pytest import voluptuous as vol import homeassistant.components.automation as automation from homeassistant.components.homeassistant.triggers import ( numeric_state as numeric_state_t...
import os from unittest import TestCase from ..data_mining.ontology import get_active_instance from ..data_mining.ontology import ( get_up_to_lca, get_lca_of_terms, group_terms_by_ontology_type, filter_obsolete_terms, parse_obo12_file ) base_path = os.path.dirname(__file__) test_obo_file = '{}/{}'...
from __future__ import print_function from __future__ import absolute_import import random import numpy as np import config from utils.dataset import Dataset class BatchGenerator(): '''Generate Batches''' def __init__(self): self.batch_size = config.FLAGS.batch_size self.buckets = buckets = config.BUCKETS se...
from typing import Iterator, Tuple, Set, List, Dict, Any, Optional, Type import argparse import logging import sys import os import concurrent.futures from ruamel.yaml import YAML import yaml from houston.mission import Mission from compare_traces import load_file as load_traces_file from compare_traces import is_tru...
# coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 ...
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # 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...
# Copyright (c) 2013 Mirantis 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 writ...
import factory from datetime import date, timedelta from decimal import Decimal from bluebottle.accounting.models import (BankTransaction, BankTransactionCategory, RemoteDocdataPayout, RemoteDocdataPayment) from bluebottle.test.factory_models.payouts import ProjectPayoutFacto...
# Cut the experiment session in small fragments # Input: ../bin/data/records/{session}/body.csv and skeletok.csv # Output: fragments/{fragment_number}.json and fragments/log.csv import os import numpy import json DELAY = 15 LENGTH = 30 OVERLAP = 0.719999 FREQUENCY = 60 MARGIN = 5 FREQUENCY = 60 CUTOFF_FREQUENCY = 1...
# # Copyright (C) 2014 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the hope that it will be...
import re from tests import marks, bootnode_address, mailserver_address, test_dapp_url, test_dapp_name, mailserver_ams, \ mailserver_gc, mailserver_hk, used_fleet, common_password from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.users import transaction_senders, basic_user, ...
from unittest import TestCase, main import pandas as pd import numpy as np # import numpy.testing as npt import pandas.util.testing as pdt from break4w.bool import Bool class BoolTest(TestCase): def setUp(self): self.map_ = pd.DataFrame([['1', '2', '2', '4'], ['TBD', '...
# -*- 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 field 'Location.has_sessions' db.add_column(u'sked_location', 'has_sessions', ...
import fudge import warnings from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured from armstrong.dev.tests.utils.base import ArmstrongTestCase from armstrong.utils.backends.base import ( Proxy, MultipleBackendProxy, GenericBackend, BackendDidNotHandle, DID...
"""Defines the class for managing a recipe definition""" from __future__ import unicode_literals import json import os from django.db.models import Q from job.configuration.data.exceptions import InvalidConnection from job.configuration.interface.scale_file import ScaleFileDescription from job.deprecation import JobC...
""" The MIT License (MIT) Copyright (c) 2015 Mike Goodfellow 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, copy, modify, mer...
import tensorflow as tf from file2buffer import File2Buffer from neural_network import NeuralNetwork from lib.nntype import NNType class SoftmaxOnehot (NeuralNetwork): Y_one_hot = None def set_placeholder(self, num_of_input, num_of_output): self.X = tf.placeholder(tf.float32, [None, num_of_input]) ...
import base64 import calendar import datetime import re import unicodedata import warnings from binascii import Error as BinasciiError from email.utils import formatdate from urllib.parse import ( ParseResult, SplitResult, _coerce_args, _splitnetloc, _splitparams, quote, quote_plus, scheme_chars, unquote, unquo...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (t...
''' Usage: python scraper_converter.py scraped.db Processes the cards scraped using the gatherer downloader and adds sane attributes fields for querying (int pow/toughness, cmc) and saves the output to the app's database location. Card attributes are saved according to finder.models.Card ''' import os import sqlso...
# -*- coding: utf-8 -*- # Copyright 2014 Objectif Libre # # 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 ...
""" Various measures that evaluate the performance of a classifier. """ import numpy as np from scipy.stats import beta from scipy.integrate import trapz from scipy.optimize import brentq from pandas import DataFrame from sklearn import metrics def naive_accuracy(confusion): """ Compute the naive accuracy rate. ...
class Data(dict): def __init__(self, xml, status=None, messages=None): """Process the xml instance into a friendly dictionary.""" content = { 'data': None, 'status': status or 200, 'messages': messages or [] } struct_nodes = xml.findall('./') ...
#- # Copyright (c) 2011 Robert N. M. Watson # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 # ("CTSRD"), as part of the DARPA CRASH research programme. # # @BERI_LICENSE_HEADER_START@ # # License...
""" Support for Homekit device discovery. For more details about this component, please refer to the documentation at https://home-assistant.io/components/homekit_controller/ """ import json import logging import os from homeassistant.components.discovery import SERVICE_HOMEKIT from homeassistant.helpers import disco...
import logging from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.views.generic.base import View from django.views.generic.detail import DetailView from getpaid.backends.skrill import PaymentProcessor from getpaid.models import Payment logger = logging.g...
#!/usr/bin/python # posts to youtube import youtube_v3_uploader import archive_uploader import rax_uploader import os import pprint import pw from process import process from django.db import DatabaseError from django.template.defaultfilters import slugify from add_to_richard import get_video_id from main.models...
# This was built from the tutorial https://www.raywenderlich.com/24252/beginning-game-programming-for-teens-with-python import pygame, math, random from pygame.locals import * import pyganim # 2 - Initialize the game pygame.init() width, height = 640, 480 screen=pygame.display.set_mode((width, height)) pygame.display...
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import pytest from byceps.services.tourney import ( match_comment_service as comment_service, match_service, ) def test_get_comments_for_match( api_client, api_client_authz_header, match, comment ): u...
# GSDView - Geo-Spatial Data Viewer # Copyright (C) 2008-2021 Antonio Valentino <antonio.valentino@tiscali.it> # # This module 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 of the License, or ...
# -*- coding: UTF-8 -*- from __future__ import unicode_literals import re import json from time import time from random import random import warnings import logging from .models import * try: from urllib.parse import urlencode basestring = (str, bytes) except ImportError: from urllib import urlencode ...
import pymongo from barin import schema as S from barin import event # TODO: test backref logic class InstanceManager(object): def __init__(self, manager, instance): self._manager = manager self.instance = instance def __getattr__(self, name): return getattr(self._manager, name) ...
# trees ready for supretree construction. # Copyright (C) 2015, Jon Hill, Katie Davis # # 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 # (a...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
#!/usr/bin/env python3 # Copyright (c) 2016-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test segwit transactions and blocks on P2P network.""" from test_framework.mininode import * from test...
# coastlib, a coastal engineering Python library # Copyright (C), 2019 Georgii Bocharov # # 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) a...
#!/usr/bin/python # Copyright 2017 John Bailey # # 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 applicabl...
#!/usr/local/env python import optparse usage_line = """ A script to extract orthologous Ensembl IDs from a genome-of-interest using a list \ of Ensembl IDs already in hand. Input is a list of Ensembl IDs and a "database" file \ downloaded from Ensembl that has the query Ensembl IDs in one column and the target/subje...
############################################################################### # Name: actionscript.py # # Purpose: Define ActionScript syntax for highlighting and other features # # Author: Cody Precord <cprecord@editra.org> ...
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # 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 of the License, or # (at you...
import xml.etree.ElementTree as et import pytest from django.urls import reverse from ..models import OptionSet users = ( ('editor', 'editor'), ('reviewer', 'reviewer'), ('user', 'user'), ('api', 'api'), ('anonymous', None), ) status_map = { 'list': { 'editor': 200, 'reviewer': 200, ...
# Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal from PyQt5.QtWidgets import QMessageBox from UM.Application import Application from UM.Preferences import Preferences from UM.Logger import Logger from U...
""" Django settings for geodjango 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, ...) ...
# Text has been moved to this class, potential to add different languages in future # Note that this is not complete, some text (eg. buttons) has not been changed # The corresponding json file, must be consistant by having all entries for all pages # If an entry is not required (or is updated using a different method ...
import unittest from RC4 import RC4 class RC4Test(unittest.TestCase): def test_RC4TestEnc1(self): algorithm = RC4() cipher = algorithm.Encrypt("abcd", "test") self.assertEqual(cipher, "ÏíDu") def test_RC4TestDec1(self): algorithm = RC4() cipher = algo...
import logging import ntpath import httplib2 from apiclient import discovery from googleapiclient import errors from googleapiclient.http import MediaFileUpload from oauth2client.client import AccessTokenCredentials from tools.config import config, general from tools.oauthtool import implicit_flow from tools.persiste...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This test checks backend configuration endpoint """ from __future__ import print_function import os import json import time import shlex from random import randint import subprocess import requests import requests_mock import unittest2 from bson.objectid import ObjectI...
"""Common tests for HomematicIP devices.""" from homematicip.base.enums import EventType from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN from homeassistant.components.homematicip_cloud.hap import HomematicipHAP from homeassistant.const import STATE_ON, STATE_UNAVAILABLE from homeassistant...
from flask import abort, request from flask_restful import Resource from mysql.connector import Error from models.schemas import PollSchema from models import Poll class PollsAPI(Resource): @staticmethod def get(poll_id=None): """HTTP GET method - returns a list of polls if no id specified, ...
""" Basic demo of drawing within an Enable component. """ from enable.api import Component, ComponentEditor from traits.api import HasTraits, Instance from traitsui.api import Item, View class MyComponent(Component): def draw(self, gc, **kwargs): w,h = gc.width(), gc.height() gc.clear() #...
import requests import urllib.parse from flask import redirect, render_template, request, session from functools import wraps def apology(message, code=400): """Render message as an apology to user.""" def escape(s): """ Escape special characters. https://github.com/jacebrowning/meme...
#-*- coding:utf-8 -*- ######################################################################### # File Name: traitsListener.py # Author: Nichol.Shen # mail: nichol_shen@yahoo.com ######################################################################### #!/usr/bin/env python3 from traits.api import HasTraits, Str, Int ...
#!/usr/bin/env python3 import glob import logging import os import sys from rofi import Rofi CURRENT_SCRIPT_NAME = os.path.splitext(os.path.basename(__file__))[0] LOG_FORMAT = ( '[%(asctime)s PID %(process)s ' '%(filename)s:%(lineno)s - %(funcName)s()] ' '%(levelname)s -> \n' '%(message)s\n' ) # Conf...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from marionette import MarionetteTestCase from marionette_driver.by import By OOP_BY_DEFAULT = "dom.ipc.browser_frames...
import os from django.core.exceptions import ImproperlyConfigured def get_env_setting(setting): """Return the value of an environment variable, or raise an exception.""" try: return os.environ[setting] except KeyError: error_msg = "Set the {} env variable".format(setting) raise Im...