src
stringlengths
721
1.04M
import base64 import mock from django.conf import settings from django.core.urlresolvers import reverse from django.test import TestCase def http_basic_auth_string(username, password): credentials = base64.encodestring('%s:%s' % (username, password)).strip() auth_string = 'Basic %s' % credentials return ...
# Automatic GPIO library # # This module attempts to be as automatic as possible. # It attempts to load RPi.GPIO to see if we are using a RaspberryPi. # If that fails, it attempts to locate an arduino using the pymata3 library. # TODO: fall back to a simulator instead of failing import sys # Prevents nesting...
# -*- coding: UTF-8 -*- # ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######. # .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....## # .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#....
# bot.py ### Copyright 2017 Cole McKown """ This file is part of SpaghettiBot. SpaghettiBot 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 optio...
"""Tests for streamalert/shared/utils.py""" import json from nose.tools import assert_equal, assert_false from streamalert.shared import utils from streamalert.shared.normalize import Normalizer MOCK_RECORD_ID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' def test_valid_ip(): """Utils - Valid IP""" test_ip_valid...
# -*- coding: utf-8 -*- # 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 # (the "Li...
''' Naive Bayes Clustering ''' import numpy as np import random from spnss.mathutil import argmax_fair, argmin_fair, logsumexp, log import knobs from fast import nbmix_likelihood_from_model as fast_nbmix_likelihood_from_model from history import best_index def nbmix_model(data, nvals, qa, smooth=0.1): data = d...
from functools import wraps, WRAPPER_ASSIGNMENTS from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from silk.config import SilkyConfig def login_possibly_required(function=None, **kwargs): if SilkyConfig().SILKY_AUTHENTICATION: return login_req...
import itertools from ..vendor.lexicon import Lexicon from .argument import Argument def translate_underscores(name): return name.lstrip('_').rstrip('_').replace('_', '-') def to_flag(name): name = translate_underscores(name) if len(name) == 1: return '-' + name return '--' + name def sort...
# -*- coding: utf-8 -*- """ Tests for the WMS Service Type. """ import unittest from httmock import with_httmock import mocks.warper from aggregator.models import Service class TestWarper(unittest.TestCase): @with_httmock(mocks.warper.resource_get) def test_create_wms_service(self): # create the ...
#!/usr/bin/env python # 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 ...
from behave import * import os import sys import inspect ROOT_DIR = os.path.dirname( os.path.abspath( inspect.getfile(inspect.currentframe() ))) sys.path.append(ROOT_DIR + "/../../classes") from ConfigurationHandler import ConfigurationHandler from ModuleHandler imp...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2014 <+YOU OR YOUR COMPANY+>. # # This 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, or (at your option) # any later version. #...
# -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = ["FeatureExtract"] import os import h5py import numpy as np from .pipeline import Pipeline def check_orbits(p1, t1, p2, t2, tmn, tmx, tol): n1 = t1 + p1 * np.arange(np.floor((tmn-t1)/p1), np.ceil((tmx-t1)/p1)) n1 = n1[(tmn <...
# -*- coding: utf-8 -*- from web.utils import render_template, expose, url_for, run_command_output, invalid_form_error from web.session_utils import create_session, is_user_admin from web.login_utils import require_login, require_admin, check_login_credentials, _find_userid_byname, _find_username_byid from werkzeug i...
# Copyright (c) 2017 Presslabs SRL # # 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...
# # Copyright (C) 2013, 2018 S3IT, University of Zurich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This progr...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.utils.termcolors import background __author__ = "Raul Perula-Martinez" __date__ = "2015-01" __version__ = "$ Revision: 1.0 $" import pygame class Player(pygame.sprite.Sprite): def __init__(self, image): self.image = image self.rect = sel...
from insights.parsers import SkipException from insights.parsers import passenger_status from insights.parsers.passenger_status import PassengerStatus from insights.tests import context_wrap import pytest import doctest PASS_STATUS = """ Version : 4.0.18 Date : 2018-10-23 15:42:04 +0800 Instance: 1265 ----------- ...
#!/usr/bin/env python """ conference.py -- Udacity conference server-side Python App Engine API; uses Google Cloud Endpoints $Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $ created by wesc on 2014 apr 21 """ __author__ = 'wesc+api@google.com (Wesley Chun)' from datetime import datetime,time im...
import llvm.core as llcore from .. ndtypes import ScalarT, FloatT, Int32, Int64 from llvm_types import llvm_value_type def const(python_scalar, parakeet_type): assert isinstance(parakeet_type, ScalarT) llvm_type = llvm_value_type(parakeet_type) if isinstance(parakeet_type, FloatT): return llcore.Constant...
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
# Copyright (c) 2014, Satoshi Nakamoto Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of conditio...
import pytest from flex.exceptions import ValidationError from flex.loading.schema.paths.path_item.operation.parameters import ( parameters_validator, ) from flex.validation.parameter import ( validate_parameters, ) from flex.constants import ( PATH, ARRAY, STRING, ) from flex.error_messages import...
#!/usr/bin/env python # -*- coding: utf-8 -*- # HORTON: Helpful Open-source Research TOol for N-fermion systems. # Copyright (C) 2011-2015 The HORTON Development Team # # This file is part of HORTON. # # HORTON is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public Licens...
#!/usr/bin/env python import pytz import datetime import csv from os import path from collections import namedtuple Row = namedtuple('Row', 'when,height_m') DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ' _NAIVE_DATETIME_FORMAT = '%y%m%dT%H:%M:00Z' _FIELDNAMES = ['datetime', 'observed_sea_level'] def main(filenames): f...
# -*- coding: utf-8 -*- """ Management Patient Line Should contain class methods Created: 20 Jun 2019 Last up: 27 oct 2020 """ from __future__ import print_function from __future__ import absolute_import from openerp import models, fields, api from .management_db import ManagementDb #from openerp.addons.op...
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-06-27 21:20 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import picklefield.fields class Migration(migrations.Migration): initial = True depende...
# vi: syntax=python:et:ts=4 def CheckOpenGL(context, libs = ["gl"]): context.Message("Checking for OpenGL... ") env = context.env backup = env.Clone().Dictionary() if env["PLATFORM"] == "win32": libnames = { "gl" : "opengl32", "glu" : "glu32" } else: libnames = { "gl" : "GL", "glu" ...
import os.path import re import junity.base as base class Titan(object): VERDICT = re.compile(r""" Test\ case\ (?P<testcase>[^\ ]+)\ finished.\ Verdict:\ (?P<verdict>[a-z]+) """, re.VERBOSE) VERDICTS = { 'fail': base.TestVerdict.FAILURE, 'n...
import tensorflow as tf import numpy as np from ionotomo.settings import TFSettings from ionotomo.tomography.interpolation import RegularGridInterpolator from ionotomo.tomography.integrate import simps class RayOp(object): r"""Linear operator that performs for any v(x) h[i1,...,ir] = \int_R[i1,...,ir]...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2014, Nicolas P. Rougier # Distributed under the (new) BSD License. # # Contributors: Nicolas P. Rougier (Nicolas.Rougier@inria.fr) # ------------------------------------------------------------------...
from pymongo import DESCENDING from django import forms from tasks.models import Tasks from tasks.exceptions import TaskDoesNotExists from .models import Project class FindTaskForBadgeForm(forms.Form): """Find task for badge form""" project = forms.ModelChoiceField( Project.objects.all(), required=Tru...
########################################################### # # Copyright (c) 2005-2008, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written ...
# -*- coding: utf-8 -*- import hashlib import requests class PaytrailException(Exception): pass def validate_failure(order_no, timestamp, authcode, secret): m = hashlib.md5() m.update('{}|{}|{}'.format(order_no, timestamp, secret).encode('UTF-8')) return authcode == m.hexdigest().upper() def vali...
import logging, re, uuid from autotest.client.shared import error from autotest.client import utils @error.context_aware def run_usb_hotplug(test, params, env): """ Test usb hotplug @param test: kvm test object @param params: Dictionary with the test parameters @param env: Dictionary with test env...
#! /usr/bin/python import string import sys INPUT="Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal" XOR_STRING="ICE" EXPECT="0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f" # hex string ge...
# -*- coding: utf-8 -*- # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import vcversi...
''' Special: "Anub'ar Ambusher" "Blood Warriors" "Burgly Bully" "Captain's Parrot" "Chromaggus" "Echo of Mediv" "Ethereal Peddler" "Flame Leviathan" "Getaway Kodo" "Gnomish Experimenter" "Headcrack" "Holy Wrath" "Ivory Knight" "Kazakus" "King's Elekk" "Krul the Unshackled" "Lock and Load" "Lorewalker Cho" "Sea Reaver" ...
#!/usr/bin/env python # Author: Solaiappan Manimaran # Splits a commands file into multiple qsub files #usage information: split_qsub.py -h # SplitQsub 1.0 - Python program that given a set of commands in one file, # will split it in to multiple qsub files, # which can then be submitted to...
import json import os from os import path from typing import List import jinja2 from virgene.common_defs import SRC_DIR, TEMPLATES_DIR, FEATURES_DIR from virgene.config import Config from virgene.default_encoder import DefaultEncoder from virgene.feature_decoder import FeatureDecoder class ConfigMgr: def __init...
import stripe from .app import app from shared.mail import send_notification, send_receipt from shared.helpers import CleanParseException, format_stripe_object def parse_hook(payload): """Parses a dictionary representation of the stripe webhook by requesting a new version of the event by it's ID from the stri...
#!/usr/bin/python # -*- coding: utf-8 -*- """ This module contains an implementation of the 'b64' transport. """ from obfsproxy.transports.base import BaseTransport import base64 import obfsproxy.common.log as logging log = logging.get_obfslogger() def _get_b64_chunks_from_str(string): """ Given a 'string...
# # Copyright (c) 2013 Red Hat, 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 t...
# coding: utf-8 import logging import os import datetime as dt from collections import OrderedDict import pandas as pd import tushare as ts import numpy as np from mymath import * class BaseScout: """ 基础策略实例 1. 有监控标的本身,如股票,期货等,直接交易其标的自身 2. 有监控指数,则要交易其对应的证券 初始化 >>> setting = {"path": "scout...
# -*- coding: utf-8 -*- from .generic import Manager class BizInvitationsManager(Manager): state_name = None # there is no local state associated object_type = None # there is no object type associated resource_type = None # there is no resource type associated def accept(self, invitation_id, inv...
# Copyright (C) 2014 SignalFuse, Inc. # # Docker container orchestration utility. import socket import subprocess import time import requests import re from . import exceptions class BaseLifecycleHelper: """Base class for lifecycle helpers.""" def test(self): """State helpers must implement this me...
# THIS FILE IS PART OF THE CYLC SUITE ENGINE. # Copyright (C) NIWA & British Crown (Met Office) & Contributors. # # 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,...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ An implementation of some of the NIFTI conventions as desribed in: http://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h A version of the same file is in the nibabel repisitory at ``doc/source/exte...
from common.challenge import MatasanoChallenge from common.tools.misc import FileLines class ECBEncryptionFinder(object): BLOCK_SIZE = 16 def __init__(self, hex_strings): self.hex_strings = hex_strings def _less_than(self, number1, number2): return number2 is None or num...
#!/usr/bin/env python ## # Copyright (c) 2012-2017 Apple 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 re...
# Copyright 2021 kubeflow.org # # 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...
import json import utils import boto.ec2.elb from fabconfig import env from fabric.api import local def get_or_create_load_balancer(): utils.status("Getting %s load balancer" % env.environment) load_balancer = get(load_balancer_name=env.load_balancer_name) if not load_balancer: return create_load...
"""DHCPv6 Renew""" # pylint: disable=invalid-name,line-too-long import pytest import srv_control import srv_msg import references import misc @pytest.mark.v6 @pytest.mark.renew def test_v6_message_renew_reply(): # Testing server ability to perform message exchange RENEW - REPLY # Message details Client...
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Copyright (C) 2009-2010 Nicolas P. Rougier # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #---------------...
# coding=utf-8 __author__ = "Dragan Vidakovic" import reader import os import writer from nltk.tokenize import RegexpTokenizer import serbian_stemmer def load_doc_num(file_path): lines = reader.read_file_line(file_path) doc_num_mapper = {} num_doc_mapper = {} clean_lines = [line[:-2] for line in lines...
# -*- coding: iso-8859-1 -*- """ MoinMoin - Utility functions for the web-layer @copyright: 2003-2008 MoinMoin:ThomasWaldmann, 2008-2008 MoinMoin:FlorianKrupicka @license: GNU GPL, see COPYING for details. """ import time from werkzeug import abort, redirect, cookie_date, Response from Mo...
from default import * from library import * import tools sys.path.append(os.path.join(CWD, 'external')) from BeautifulSoup import BeautifulSoup from urllib import quote_plus try: import simplejson as json except: import json import math class Module(BARTSIDEE_MODULE): def __init__(self, app): self.ap...
from __future__ import division, print_function import collections import numpy as np import config from diff_h5 import diff_array from data import append_carray_to_table, ColumnArray from expr import Expr, type_to_idx, idx_to_type, expr_eval, Variable from context import EntityContext import utils import importlib ...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
from mediawords.dbi.stories.stories import add_story from .setup_test_stories import TestStories class TestAddStory(TestStories): def test_add_story(self): """Test add_story().""" media_id = self.test_medium['media_id'] feeds_id = self.test_feed['feeds_id'] # Basic story ...
#!/usr/bin/env python3 ############################################################################### # # # Copyright 2019. Triad National Security, LLC. All rights reserved. # # This program was produced under U.S. Government contrac...
import numpy as np from numpy import datetime64, timedelta64 import os.path from cotede.utils import cotederc try: import pandas as pd PANDAS_AVAILABLE = True except ImportError: PANDAS_AVAILABLE = False try: from supportdata import download_file SUPPORTDATA_AVAILABLE = True except ImportError:...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/server/graphql/types/ssl.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # ...
# # Copyright (C) 2013 Savoir-Faire Linux Inc. # # This file is part of Sageo # # Sageo 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 optio...
"""Notes: User choose: 1. length of password 2. option to use special characters in password """ import random, string def password_length(pass_len = 0): limit = 1000 print "Please enter the desired length for your password." print "The length must be an integer greater than 5." pass_len = raw_input("Enter ...
# -*- coding: utf-8 -*- """ Translation API @copyright: 2012-2016 (c) Sahana Software Foundation @license: MIT 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 res...
import h5py ''' Place all the weight files here (should automatically be placed after running weight_load.py for all the checkpoints, and then simply run this script to change the weights to support 1000 classes instead of 1001. ''' base = "mobilenet_" alphas = ["1_0", "7_5", "5_0", "2_5"] sizes = [224, 192, 160, 12...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from collections import OrderedDict from django.core.urlresolvers import reverse from django.db import models from django.db.transaction import atomic from django.template.defaultfilters import slugify from django.utils.crypto import get_rand...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
#python 2/3 compatibility from __future__ import (absolute_import, division, print_function, unicode_literals) from itertools import chain from flask import (Blueprint, render_template, request, abort, url_for, g, Response, make_response, current_app) import threading import z...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz> # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """ Automated tests for checking transformation algorithms (the models package). """ import logging import unittest import os import o...
#!/usr/bin/env python """csv2asana Script to import csv file to Asana <http://asana.com> Copyright (c) 2013 Witchakorn Kamolpornwijit <me@chalet16.com> 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 So...
""" SublimeGerrit - full-featured Gerrit Code Review for Sublime Text Copyright (C) 2015 Borys Forytarz <borys.forytarz@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 published by the Free Software Foundation; either version 2 of...
# To execute this test run python test.py on the Terminal from portfolio.application.base import application from portfolio.models import needs_db import os import json import unittest import tempfile class PortfolioTestCase(unittest.TestCase): def setUp(self): self.tester = application.test_client() ...
# -*- coding: utf-8 -*- from Screens.ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector from Components.ActionMap import ActionMap, HelpableActionMap from Components.ActionMap import NumberActionMap from Components.Harddisk import harddiskmanager, findMountPoint from Components.Input impo...
import unittest from shapely.geometry import Point from geopandas import GeoSeries class TestSeries(unittest.TestCase): def setUp(self): N = self.N = 10 r = 0.5 self.pts = GeoSeries([Point(x, y) for x, y in zip(range(N), range(N))]) self.polys = self.pts.buffer(r) def test_sl...
#!/usr/bin/env python3 import os.path from collections import defaultdict import pickle from optparse import OptionParser import sys n = 3 def analyse(counts, text, n): """analyse text with n chars markov state, update the counts""" text = '^' * n + text + '$' * n for i in range(len(text) - n): ...
# # Copyright (C) 2006-2016 Nexedi SA # # 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...
# -*- coding: utf-8 -*- """ *************************************************************************** QgisAlgorithmTests.py --------------------- Date : January 2016 Copyright : (C) 2016 by Matthias Kuhn Email : matthias@opengis.ch ***********************...
import re from datetime import datetime, timedelta import mock from nose.tools import eq_ from pyquery import PyQuery as pq from django.core.files import temp import amo import amo.tests from amo.urlresolvers import reverse from amo.tests import formset, initial from addons.models import Addon from applications.mode...
# Author: Denys Makogon # # 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 t...
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
""" tebdIsing2.py Use TEBD to compute ground state of transverse field Ising model. 2014-09-15 """ import numpy as np from cmath import * from mpstest16 import * import time def main(): test0() def test0(): (J,muB,N,t,nsteps,chi) = (0.1,1,3,0.1,100,5) for N in xrange(3,11): test2(J,muB,N,t,nsteps...
import warnings import unittest import sys import os import atexit import numpy as np from scipy import sparse from sklearn.utils.deprecation import deprecated from sklearn.utils.metaestimators import if_delegate_has_method from sklearn.utils.testing import ( assert_raises, assert_less, assert_greater, ...
# -*- coding: utf-8 -*- # # Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.org/> # # 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, eith...
from django.contrib.messages.storage.fallback import FallbackStorage from django.contrib.redirects.models import Redirect from django.test import TestCase from django.http.request import HttpRequest from generic_admin.sites import SiteWithTableEditor from generic_admin.mixins import PermissionsControl, ChangeItemsStat...
# PasswdManager -- Password management tool # Copyright (C) 2009 -- 2013 Kai Yuan <kent.yuan@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 published by # the Free Software Foundation, either version 3 of the License, or # (...
import io import re from contextlib import redirect_stdout from unittest import TestCase from hamcrest import * from chapter15.exercise15_5_1 import construct_optimal_bst from chapter15.textbook15_5 import optimal_bst from test_chapter15.test_textbook15_5 import get_probabilities_for_optimal_bst def assert_optimal_...
# -*- coding: utf-8 -*- """ Sahana Eden Assets Model @copyright: 2009-2014 (c) Sahana Software Foundation @license: MIT 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 withou...
#!/usr/bin/env python3 # # author == __gandhi__ # ngakan.gandhi@packet-systems.com import pexpect import sys import os import json import time import re # Load node user and password configuration file def load_node_config(node_config_file): with open(node_config_file) as node_confile: retu...
#-*-coding=utf8-*- import sys reload(sys) sys.setdefaultencoding('utf8') from framework import TestFrameworkClass class myTestCases(TestFrameworkClass): _resource = '/v1.0/devices' _resDeviceOne = '/v1.0/device/' user1 = { 'name':'古城', 'pwd':'iotx12345古城', 'userDefArea':...
from p2pool.bitcoin import networks from p2pool.util import math # CHAIN_LENGTH = number of shares back client keeps # REAL_CHAIN_LENGTH = maximum number of shares back client uses to compute payout # REAL_CHAIN_LENGTH must always be <= CHAIN_LENGTH # REAL_CHAIN_LENGTH must be changed in sync with all other clients # ...
# 各組分別在各自的 .py 程式中建立應用程式 (第1步/總共3步) from flask import Blueprint, render_template, make_response # 利用 Blueprint建立 ag1, 並且 url 前綴為 /ag1, 並設定 template 存放目錄 bg11_40323247 = Blueprint('bg11_40323247', __name__, url_prefix='/bg11_40323247', template_folder='templates') @bg11_40323247.route('/task47_1') def task47_1(): ...
#-*- coding: utf-8 -*- """ Copyright (C) 2016 Michal Goral. This file is part of Subconvert Subconvert 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 la...
# Copyright 2013 Huawei Technologies Co.,LTD. # 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 # # Unl...
# (C) Datadog, Inc. 2021-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from __future__ import annotations from typing import Optional from pydantic import BaseModel, root_validator, validator from datadog_checks.base.utils.functions import identity from datadog_checks.base...
import time class DebugPort: def __init__ (self, swd): self.swd = swd # read the IDCODE # Hugo: according to ARM DDI 0316D we should have 0x2B.. not 0x1B.., but # 0x1B.. is what upstream used, so leave it in here... if self.idcode() not in [0x1BA01477, 0x2BA01477]: ...
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=too-many-branches,too-many-...
import pytest from supplies.annotate import delay from supplies.params import param, Params __author__ = 'dwae' class Foo(Params): @param def bar(self, val: (1, 42)=23): return val @delay def bla(self): return ... class Bar(Foo, Params): @param def baz(self, val: str='f00')...