src
stringlengths
721
1.04M
# MIT License # # Copyright (c) 2017 Matt Boyer # # 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, merge, p...
## # Copyright 2013-2020 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), # Flemish Research Foundation (F...
"""MODFLOW support utilities""" import os from datetime import datetime import shutil import warnings import numpy as np import pandas as pd import re pd.options.display.max_colwidth = 100 from pyemu.pst.pst_utils import ( SFMT, IFMT, FFMT, pst_config, parse_tpl_file, try_process_output_file, )...
# # ------------------------------------------------------------ # Copyright (c) All rights reserved # SiLab, Institute of Physics, University of Bonn # ------------------------------------------------------------ # # Initial version by Chris Higgs <chris.higgs@potentialventures.com> # # pylint: disable=pointless-stat...
# -*- coding: utf-8 -*- # Copyright (c) 2013 Ole Krause-Sparmann # 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,...
import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.plant import PlantEquipmentOperationUncontrolled log = logging.getLogger(__name__) class TestPlantEquipmentOperationUncontrolled(unittest.TestCase): def setUp(self): ...
'''' In this code we'll have a bunch of examples you can use at your own discretion. Simply remove the three ' marks above and below the code you want in order to run it, while leaving the text within a new set of three ' marks. Once that's done, go to your Terminal, navigate to where this code and the twitter_follo...
#!/usr/bin/env python # -*- coding: utf-8 -*- __title__ = "echobot" __version__ = "0.0.11" __author__ = "Anton Batenev" __license__ = "BSD" import sys import os import time import re from pytoxcore import ToxCore # PEP-8 try: import configparser as EchoBotConfigParser except ImportError: import Conf...
#!/usr/bin/env python import os import sys import django import random randomUser = lambda: get_user_model().objects.all()[random.randrange(0, get_user_model().objects.count())] rr = lambda x, y: random.randrange(x, y) def endall(): # Delete Snippets. for obj in Recipe.objects.all(): obj.delete() # Delete U...
# coding=utf-8 """ OBJETO Maneja objetos del mundo, como pistas y decoraciones, dibuja a los elementos en pantalla. Autor: PABLO PIZARRO @ppizarror Fecha: ABRIL 2015 """ if __name__ == '__main__': # noinspection PyUnresolvedReferences from path import * class Gameobject(object): """Objet...
""" The :mod:`sklearn.lda` module implements Linear Discriminant Analysis (LDA). """ # Authors: Matthieu Perrot # Mathieu Blondel import warnings import numpy as np from scipy import linalg, ndimage from .base import BaseEstimator, ClassifierMixin, TransformerMixin from .utils.extmath import logsumexp cla...
from sys import stdout from os import makedirs from os.path import exists, abspath from requests import Session from datetime import datetime, timedelta from getpass import getpass periods_path = abspath(__file__ + "/../periods.txt") site_url = "http://meterdata.submetersolutions.com" login_url = "/login.php" file_ur...
# -*- coding: utf-8 -*- # # This file is based upon the file generated by sphinx-quickstart. However, # where sphinx-quickstart hardcodes values in this file that you input, this # file has been changed to pull from your module's metadata module. # # This file is execfile()d with the current directory set to its contai...
# -*- encoding: utf-8 -*- # # 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, so...
#! /usr/bin/python """ Software-in-the-loop simulation script for the multi quadcopter flocking control. This is the main script for the multi quadcopter flocking control (SITL). The script runs under the dronekit-sitl environment. A high-level XBee module should be connected for the inter communication between the d...
import numpy as np from rllab.core.serializable import Serializable from rllab.core.parameterized import Parameterized from rllab.misc import logger # the regressor will be choosen to be from the same distribution as the latents from rllab.regressors.gaussian_mlp_regressor import GaussianMLPRegressor from rllab.regre...
#!/usr/bin/python # -*- coding: utf-8 -*- """Test tools package alone which don't fit into other tests.""" # # (C) Pywikibot team, 2016 # # Distributed under the terms of the MIT license. from __future__ import absolute_import, unicode_literals __version__ = '$Id$' import collections import decimal import inspect im...
# -*- coding: utf-8 -*- from __future__ import with_statement import sys import tarfile from .Extractor import ArchiveError, CRCError, Extractor from .misc import encode, fsjoin class UnTar(Extractor): __name__ = "UnTar" __type__ = "extractor" __version__ = "0.05" __status__ = "stable" __descr...
""" Verify traffic_dump functionality. """ # 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 Licen...
# 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 # distributed under the...
# Copyright (C) 2008 One Laptop Per Child # Copyright (C) 2014 Ignacio Rodriguez # # 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 late...
""" Objects for dealing with Chebyshev series. This module provides a number of objects (mostly functions) useful for dealing with Chebyshev series, including a `Chebyshev` class that encapsulates the usual arithmetic operations. (General information on how this module represents and works with such polynomials is in...
# Copyright 2019-2020 by Christopher C. Little. # This file is part of Abydos. # # Abydos 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 versio...
# -*- 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): # Deleting model 'ActionTutorial' db.delete_table('website_actiontutorial') # Deleting model 'Perso...
# WARNING: This recipe currently breaks display of the representation of strings containing other string escape sequences such as '\n'. I can't find a way to get ASPN to hide the recipe from public view until I can figure out a way to fix it though :( # NOTE: This recipe is written to work with Python 3.0 # It would l...
## # Copyright (c) 2005-2015 Apple Inc. All rights reserved. # # 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, mod...
# -*- coding: utf-8 -*- """A plugin to generate a list of unique hashes and paths.""" from plaso.analysis import interface from plaso.analysis import manager from plaso.containers import reports class FileHashesPlugin(interface.AnalysisPlugin): """A plugin for generating a list of file paths and corresponding hash...
""" This module provides a direct client interface for managing an IRC connection. If you are trying to build a bot, :class:`ircutils.bot.SimpleBot` inherits from :class:`SimpleClient` so it has the methods listed below. """ from __future__ import absolute_import import collections import pprint from . import con...
import asyncio import logging from aiohttp import web from .endpoint import cancel from .endpoint import endpoint from ..adjust import adjust from .. import clone from .. import pull from .. import repo from .endpoint import validation from ..auth import auth from ..config import config logger = logging.getLogger(__...
# -*- encoding: utf-8 -*- ############################################################################## # # partner_billing # (C) 2015 Mikołaj Dziurzyński, Grzegorz Grzelak, Thorsten Vocks (big-consulting GmbH) # All Rights reserved # # This program is free software: you can redistribute it and/or modify #...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Post' db.create_table(u'post_post', ( ('id', ...
# -*- coding: utf-8 -*- from __future__ import division import numpy as np from library import gibbs from absolute_salinity_sstar_ct import CT_from_t from gsw.utilities import match_args_return, strip_mask from conversions import pt_from_CT, pt_from_t, pt0_from_t from constants import Kelvin, db2Pascal, P0, SSO, cp0...
#!/usr/bin/env python3 import unittest TestCase = unittest.TestCase from BioUtil import fastqFile import os print("test fastqFile") data_dir = os.path.join(os.path.dirname(__file__), "..", "data") def readfile(file): fh = open(file, 'r') content = fh.readlines() fh.close() return content class TestFas...
import socket import sys import argparse from thread import allocate_lock import time import select import requesthandler import ConfigParser class Server(object): def __init__(self, max_clients, port, accounts): self.max_clients = max_clients self.port = port self.accounts = accounts self.connection = None ...
#!/usr/bin/env python3 # This file is part of Shoop. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. """ License header updater. """ from __future__ import unicode_literals impo...
"""Support to interface with the Plex API.""" from datetime import timedelta import json import logging import plexapi.exceptions import plexapi.playlist import plexapi.playqueue import requests.exceptions from homeassistant.components.media_player import MediaPlayerDevice from homeassistant.components.media_player.c...
# Adapted for numpy/ma/cdms2 by convertcdms.py import numpy import cdtime class VCSUtilsError (Exception): def __init__ (self, args=None): """Create an exception""" self.args = args def __str__(self): """Calculate the string representation""" return str(self.args) __repr__ =...
# -*- coding: utf-8 -*- # # Copyright © 2014 Petr Zelenin (po.zelenin@gmail.com) # # Distributed under terms of the MIT license. import hashlib import os import unittest import transaction from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from zope.sqlalchemy import ZopeTr...
import argparse import csv import os import re import numpy as np import tensorflow as tf from PIL import Image FILENAME_PATTERN = re.compile(r'.+-(\d+)-of-(\d+)') if __name__ == "__main__": parser = argparse.ArgumentParser(description='tool that takes tfrecord files and extracts all images + labels from it'...
################################################################# ### Chain Reactor Game Demo For Technites # ### # ################################################################# grid=[[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]...
import re, shlex import math hextag = re.compile('{{(.*?)}}',flags=re.MULTILINE|re.DOTALL) class HexExpression: delimiters = (' ', '=','-','+','*','(',')') quotes = ('\"','\'') def __init__( self, tokens ): self.operations = { '=':self.assign, '-':self.minus, ...
import pytest import json class TestRbdMirrors(object): @pytest.mark.no_docker def test_rbd_mirror_is_installed(self, node, host): assert host.package("rbd-mirror").is_installed def test_rbd_mirror_service_enabled_and_running(self, node, host): service_name = "ceph-rbd-mirror@rbd-mirror....
import pandas as pd from sklearn import model_selection from sklearn.linear_model import LogisticRegression def loadData(): col_names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class'] dataframe = pd.read_csv("./pima-indians-diabetes.data.txt", names = col_names) array = dataframe.v...
import re from PIL import Image, ImageOps from io import BytesIO from django.contrib.auth.models import User from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.http import HttpResponseForbidden from django.shortcuts import get_object_or_404 from django.core.files.uploadedfile import Si...
from __future__ import unicode_literals from django.core.exceptions import FieldError, ValidationError from django.db.models import Model from django.test import SimpleTestCase, TestCase from dynamic_choices.db.models import DynamicChoicesForeignKey from .models import ALIGNMENT_EVIL, ALIGNMENT_GOOD, Enemy, Master, ...
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import import time_benchmark import os import sys import json import re import time import numpy as np import ConfigParser import subprocess from tornado...
import client_conn import filelist import rsa import hashlib import getpass import log import os import signal import sys # filename of list mylist = "list" password = None def print_help(): """ Print the available command list. """ print() print() if client_conn.is_login(): print("Lo...
import glob import os import tempfile import shutil import unittest from avocado.core import exit_codes from avocado.utils import process basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..') basedir = os.path.abspath(basedir) AVOCADO = os.environ.get("UNITTEST_AVOCADO_CMD", "./scripts/avoc...
import collections from data import chain, crossword, warehouse from data.alphabets import cryptic_keywords from puzzle.problems.crossword import _base_crossword_problem class CrypticProblem(_base_crossword_problem._BaseCrosswordProblem): def __init__(self, name, lines, **kwargs): super(CrypticProblem, self)._...
""" Cement core argument module. """ from ..core import backend, exc, interface, handler Log = backend.minimal_logger(__name__) def argument_validator(klass, obj): """Validates a handler implementation against the IArgument interface.""" members = [ '_setup', 'parse', 'parsed_args', ...
#!/usr/bin/python """************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** Yo...
# 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...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Inventory Management', 'version': '1.1', 'summary': 'Inventory, Logistics, Warehousing', 'description': "", 'website': 'https://www.odoo.com/page/warehouse', 'depends': ['product', 'bar...
#!/usr/bin/python2.7 # Copyright 2011 Google Inc. All Rights Reserved. """Targets class describes which languages/platforms we support.""" __author__ = 'wclarkso@google.com (Will Clarkson)' import logging import os from googleapis.codegen.filesys import files from googleapis.codegen.utilities import json_expander ...
#!usr/bin/env python import sys import re import shelve from parameter.common_parameters import common_parameters import utils.setting_utils as utils utils.now_time("phastcons_score_list script starting...") p = utils.Bunch(common_parameters) def main(): utils.now_time("Input_file: " + p.phastcons_sc...
# -*- coding: utf-8 -*- # # Copyright (C) 2005, TUBITAK/UEKAE # # 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. # # Plea...
#!/usr/local/bin/python2.7 from sys import exit, stdout, argv from os import environ, system environ['KERAS_BACKEND'] = 'tensorflow' environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" environ["CUDA_VISIBLE_DEVICES"] = "" import numpy as np import signal from keras.layers import Input, Dense, Dropout, concatenate, LSTM, Ba...
# -*- coding: utf-8 -*- """ /*************************************************************************** XPlan A QGIS plugin Fachschale XPlan für XPlanung ------------------- begin : 2011-03-08 copyright : (C) 2011 by Bernhard Stroebl, KIJ/DV email :...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
#!/usr/bin/env python3 # iset-match.py: Report where iset.mm statements differ from set.mm. # Author: David A. Wheeler # SPDX-License-Identifier: MIT import os,re # Generate list of statements in set.mm and iset.mm. os.system("metamath 'read set.mm' 'set width 9999' 'show statement *' quit > ,set-mm-statements") os.s...
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # python-quilt - A Python implementation of the quilt patch system # # Copyright (C) 2012 - 2017 Björn Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of python-quilt for details. from quilt.cli.meta import Command from quilt.cli.parser import Argum...
# 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 agreed to in writing, ...
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
import json import random from enum import Enum from PyQt5.QtCore import QObject, pyqtSignal class PlayerAffiliation(Enum): SELF = "self" FRIEND = "friend" FOE = "foe" CLANNIE = "clan" OTHER = "default" class PlayerColors(QObject): changed = pyqtSignal() def __init__(self, me, user_rela...
import numpy as np import tensorflow as tf import h5py from sklearn.preprocessing import OneHotEncoder import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import time import scipy.io # Functions for initializing neural nets parameters def weight_variable(shape, var_name): initial = ...
import asyncio import logging import os import signal from struct import Struct import time from .base import (WorkerProcess, ChildProcess, IDLE_CHECK, IDLE_TIME) MSG_HEAD = 0x0 MSG_PING = 0x1 MSG_PONG = 0x2 MSG_CLOSE = 0x3 PACK_MSG = Struct('!BB').pack UNPACK_MSG = Struct('!BB').unpack logger =...
# test client - Simon Lees simon@simotek.net # Copyright (C) 2015 Simon Lees # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) an...
#!/usr/bin/env python import serial import re import time import sys import argparse # import threading RX_BUFFER_SIZE = 128 def send(job=None,sname='/dev/ttyACM0'): if job == None: yield 'Invalid Job' try: s = serial.Serial(sname,9600) except Exception, e: yield str(e).spl...
import urllib2 import urlparse import zeit.cms.browser.preview import zeit.cms.interfaces import zeit.connector.interfaces import zope.component class WorkingcopyPreview(zeit.cms.browser.preview.Preview): """Preview for workingcopy versions of content objects. This supports two modes of operation: 1. Up...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) Pootle contributors. # # This file is a part of the Pootle project. It is distributed under the GPL3 # or later license. See the LICENSE file for a copy of the license and the # AUTHORS file for copyright and authorship information. import os import pytes...
from django.contrib.sites.models import Site, RequestSite from django.test import TestCase, RequestFactory from sitesutils.context_processors import site from sitesutils.middleware import RequestSiteMiddleware def create_request(host): request_factory = RequestFactory(HTTP_HOST=host) return request_factory.g...
import subprocess import pytest from ..helpers import BaseWFC3 @pytest.mark.xfail(reason="Temporary xfail. New input/truth files on Artifactory, but branch not merged.") class TestUVIS32Single(BaseWFC3): """ Test pos UVIS2 subarray data with CTE correction """ detector = 'uvis' def _single_...
#coding=utf-8 import numpy as np # 通过PBC边界条件计算两个原子之间的最小镜像距离 def dis_pbc(a, b, c, alpha, beta, gamma, t1, t2): cosalpha = np.cos(alpha * np.pi / 180) sinalpha = np.sin(alpha * np.pi / 180) cosbeta = np.cos(beta * np.pi / 180) cosgamma = np.cos(gamma * np.pi / 180) singamma = np.sin(...
#!/usr/bin/env python ''' 011.py: https://projecteuler.net/problem=11 Largest Product in a Grid In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 ...
## # Copyright 2009-2020 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), # Flemish Research Foundation (F...
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015 CERN. # # Invenio 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...
#! /usr/bin/env python # From IRC: # # "I was thinking about a toy idea for my kid to teach multiplication through # area representation. 2x3 is a two-inch-by-three-inch slab of something with # lines on it, etc. I'd need 45 pieces (since AxB = BxA, you can drop almost # half) but if I wanted to put it away in almos...
''' Created on 2016/4/13 :author: hubo ''' from vlcp.service.sdn.flowbase import FlowBase from vlcp.server.module import depend, ModuleNotification, call_api,api import vlcp.service.sdn.ofpportmanager as ofpportmanager import vlcp.service.sdn.ovsdbportmanager as ovsdbportmanager import vlcp.service.kvdb.objectdb as ob...
# Copyright 2013-2015 The Meson development team # 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 agree...
#!/usr/bin/env python3 import imp import os import unittest from pprint import pprint imp.load_source('ufw_forward', os.path.join(os.path.dirname(__file__), os.path.pardir, 'library', 'ufw_forward.py')) from ufw_forward import UFWForwards class TestBase(unittest.TestCase): def test_do_magic(self): test = { ...
from __future__ import absolute_import import re import logging logger = logging.getLogger(__name__) def clean_extract(sel, path, path_type='xpath', limit_from=None, limit_to=None, sep='\n', unicode=True): if path_type == 'xpath': return clean(sep.join(x.strip() ...
# # Copyright 2018 Analytics Zoo 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 agreed to...
"""Utils for testing autocompletes.""" from django.apps import apps class Fixtures(object): """Callback for post_migrate to create many objects.""" def __init__(self, model_name=None): """Preset a model name, ie. 'auth.user'.""" self.model_name = model_name def get_model(self, sender): ...
# encoding: utf-8 """Test the schema objects.""" from unittest import TestCase from marrow.interface import schema class TestAttributeSuccesses(TestCase): foo = 27 basic = schema.Attribute() basic.__name__ = 'basic' value = schema.Attribute(value=27) value.__name__ = 'foo' exact = schema.Attribute() ...
# -*- coding: utf-8 -*- # # Copyright (c) 2013 Paul Brossier <piem@piem.org> # This file is part of TimeSide. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
# Copyright 2016 Autodesk 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 writing...
#!/usr/bin/env python #coding:utf-8 """ Consecutive prime sum The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below one-thousand that adds to a p...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2016-2019 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in ...
import numpy as np import matplotlib.pyplot as plt def plot_venn_diagram(): fig, ax = plt.subplots(subplot_kw=dict(frameon=False, xticks=[], yticks=[])) ax.add_patch(plt.Circle((0.3, 0.3), 0.3, fc='red', alpha=0.5)) ax.add_patch(plt.Circle((0.6, 0.3), 0.3, fc='blue', alpha=0.5)) ax.add_patch(plt.Recta...
# Copyright 2020 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
from __future__ import unicode_literals import logging import warnings from functools import update_wrapper from django import http from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import NoReverseMatch, reverse from django.template.response import TemplateResponse from ...
# -*- coding: utf-8 -*- ''' Created on 21.05.2012 @author: bach ''' import unittest from shotgun_replica.utilities import entityNaming class Test( unittest.TestCase ): def setUp( self ): pass def tearDown( self ): pass def testUnderScoreReplacement( self ): testPairs = [ ...
import psycopg2 from googlemaps import client import sys key= "A GOOGLE API KEY AUTHORIZED ON SEVERAL DIRECTIONS APIS" myClient = client.Client(key) def getRoutes(cursor) : valsToText = [] cursor.execute("""select * from person""") person=cursor.fetchone() while(person): [minCluster,minDirecti...
""" Exposes the 5 parameter unital channel. """ import numpy as np import scipy as sp from scipy.linalg import polar PDIAG = np.zeros((9, 9)) for esi in np.eye(3): one = np.kron(esi, esi) PDIAG = PDIAG + np.outer(one, one) PDIAG = PDIAG.astype(np.int) FIXEDQ = np.array([[-0.1911, 0.3136, -0.9301], ...
# -*- coding: utf-8 -*- import xbmc import xbmcaddon import re import sys import logging import json as json # read settings ADDON = xbmcaddon.Addon() logger = logging.getLogger(__name__) def notification(header, message, time=5000, icon=ADDON.getAddonInfo('icon'), sound=True): xbmcgui.Dialog().notification(h...
#------------------------------------------------------------------------- # Copyright (c) Microsoft. 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.apa...
import re import csv import ipaddress __version__ = 1.0 # Each route will have the following values class Route_Template(object): def __init__(self): self.route = {} self.protocol = [] self.metric = [] self.next_hop = [] self.age = [] self.interface = [] def __r...
# This file contains some code to test the DAAPClient as stand-alone application. import sys import logging from .client import DAAPClient log = logging.getLogger(__name__) def main(): connection = DAAPClient() if len(sys.argv) > 1: host = sys.argv[1] else: host = "localhost" if le...
from django.shortcuts import render, HttpResponse, redirect from forms import LoginForm, RegistrationForm from django.contrib.auth import login, logout, authenticate from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from taskManager.forms import TaskCreate,MultipleSel...
# -*- coding: utf-8 -*- from pytest import raises # The parametrize function is generated, so this doesn't work: # # from pytest.mark import parametrize # import pytest parametrize = pytest.mark.parametrize # from duckomatic import metadata from duckomatic.utils.subscriber import (Subscriber, NoDataException) c...