src
stringlengths
721
1.04M
# -*- coding: utf-8 -*- # Python stdlib import unittest # py.test import pytest # Python tfstate from tfstate.provider.aws import AwsResource, AwsKeyPairResource from tfstate.exceptions import InvalidResource # Unit tests from unit_tests.base import BaseResourceUnitTest @pytest.mark.provider_aws class AwsKeyPairR...
""" This program is free and open source, released into the public domain. Daniel Barnes http://nasonfish.com/ A library for linear equation operations, specifically designed for linear_programming.py Here, you can create an object simply by passing an equation in the form ax+by>=c to the __init__ function. The op...
# 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/. import json from itsdangerous import BadData from relengapi.blueprints.tokenauth.tables import Token from relengapi.lib...
# 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 may ...
# -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # 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 lim...
# -*- coding: utf-8 -*- # HORTON: Helpful Open-source Research TOol for N-fermion systems. # Copyright (C) 2011-2016 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 License # as published by th...
from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) try: import pypandoc long_description = pypandoc.convert(path.join(here, "README.md"), 'rst') except(IOError, ImportError) as e: raise Exception("Failed to convert README.md...
"""Database model for a person """ import collections import operator import json from sreachievementswebapp.dbmodels import db from sqlalchemy.ext.hybrid import hybrid_property m2m_person_achievement = db.Table( 'm2m_person_achievement', db.Column('achievement_id', db.Integer, db.ForeignKey('achievement.i...
#! /usr/bin/env python2 import argparse import re import os import sys from collections import OrderedDict def create_reference_and_index(config): ''' Create the reference and index for NCLscan. 1. Repeat_ChrM 2. AllRef.fa 3. Bwa index 4. Novoalign index ''' config...
#!/usr/bin/env python3 # envelopes.py - Envelopes program by Sergey 2017 import unittest import random import collections import operator ############################################################################### # Envelopes Class (Main Program) ###################################################################...
#!/usr/bin/env python import logging class TreeFile(object): """Handling functions for tree files, as produced by Infomap. The file should be a plain text file with the following format: <cluster_id> <score> <paper_id> 1:1:1:1 0.000021 "123456" 1:1:1:2 0.023122 "8675309" """ def __init__(...
""" Caching framework. This package defines set of cache backends that all conform to a simple API. In a nutshell, a cache is a set of values -- which can be any object that may be pickled -- identified by string keys. For the complete API, see the abstract BaseCache class in django.core.cache.backends.base. Client ...
# -*- coding: utf8 -*- # # 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...
import boto3 from contextlib import contextmanager import logging from hashlib import md5 from io import BytesIO logger = logging.getLogger(__name__) # Using MD5 for shorter string names as Sha256 is larger than allowed bucket name characters HASH = md5 # Use Hash Blocksize to determine number of bytes read BLOCKSIZE...
# # DX Analytics # Helper Function for Plotting # dx_plot.py # # DX Analytics is a financial analytics library, mainly for # derviatives modeling and pricing by Monte Carlo simulation # # (c) Dr. Yves J. Hilpisch # The Python Quants GmbH # # This program is free software: you can redistribute it and/or modify # it unde...
import numpy as np class merge_dihedrals: def __init__(self,filepath,filelist,dihetype='9',fmerged='merged_dihedrals.itp'): clist=[] for fi in filelist: flist1 = self.read_dihedrals(filepath+fi,t=dihetype) clist=clist+flist1 #print 'processing',fi print '...
from fastavro import writer import io import uuid from .avroschema import schema, event_schema class AvroSerialiser: def __init__(self): pass @staticmethod def serialise_message(message): buffer = io.BytesIO() writer(buffer, schema, [{'id': uuid.uuid4().int, ...
__author__ = 'CarbonBlack, byt3smith' # stdlib imports import re import sys import time import urllib import json import optparse import socket import base64 import hashlib # cb imports sys.path.insert(0, "../../") from cbfeeds.feed import CbReport from cbfeeds.feed import CbFeed from cbfeeds.feed import CbFeedInfo ...
#!/usr/bin/env python import requests import re import json import utm from riverfromdb import findRiver from arpapiemonte_scrap import getData def main(): url = 'http://www.arpa.piemonte.it/rischinaturali/tematismi/meteo/osservazioni/rete-meteoidrografica/rete-meteo-idrografica.html' print(url) r = reque...
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
# -*- coding: utf-8 -*- # Copyright (c) 2009 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the bookmarks manager. """ from __future__ import unicode_literals import os from PyQt5.QtCore import pyqtSignal, Qt, QT_TRANSLATE_NOOP, QObject, QFile, \ QIODevice, QXmlStreamReader, QDate...
""" /* * This file is part of PySide: Python for Qt * * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). * * Contact: PySide team <contact@pyside.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * versio...
# -*- coding: utf-8 -*- # # stexchange documentation build configuration file, created by # sphinx-quickstart on Sun Feb 17 11:46:20 2013. # # 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. # # ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals """ sockjs.tornado.transports.xhr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Xhr-Polling transport implementation """ import logging from tornado.web import asynchronous from octoprint.vendor.sockjs.tornado imp...
''' Copyright (C) 2005-17 www.interpss.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 b...
# pylint: disable=C0111,R0902,R0913 # Smartsheet Python SDK. # # Copyright 2016 Smartsheet.com, 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/LICE...
# -*- coding: utf-8 -*- ''' Genesis Add-on Copyright (C) 2015 lambda 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 ...
""" This file contains all the NEGRAV functions. for all kind of devices (Base station BS, Mobile node MN and Stationary node SN) """ import json """List of keys in each cmd type. this is used to verify""" ADD_REQUEST_keys = ["source_ip"] ADD_RESPONSE_keys = ["assign_ip"] NODE_REPORT_keys = ["node_ip","type","senso...
## @package convnet_benchmarks # Module caffe2.python.convnet_benchmarks from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals """ Benchmark for common convnets. Speed on Titan X, with 10 warmup steps and 10 main steps and w...
#!/usr/bin/python3 """Application and persistence management.""" # pylint: disable=no-member, import-error, no-init, too-few-public-methods # pylint: disable=cyclic-import, no-name-in-module, invalid-name import os from flask import Flask from flask.ext import restful from flask.ext.cors import CORS from flask.ext.s...
### # Copyright (c) 2014, KG-Bot # All rights reserved. # # 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 notice, # this list of condition...
# -*- coding: utf-8 -*- # ------------------------------------------------------------ # Controlador para HTML # ------------------------------------------------------------ import json import os import re import threading import time import channelselector from controller import Controller from controller import Plat...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime from django.db import migrations, models from django.db.models import Q def forwards_func(apps, schema_editor): # We get the model from the versioned app registry; # if we directly import it, it'll be the wrong version Titol...
# Copyright 2019 Verizon Media # # 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 a...
"""Test for uwg.py""" import os import pytest from copy import deepcopy from .test_base import auto_setup_uwg, set_input_manually from uwg import SchDef, BEMDef, Building, Element, Material, UWG from uwg.utilities import is_near_zero def test_init(): """Test initialization methods.""" test_dir = os.path.abs...
# -*- coding: UTF-8 -*- import csv import os import re from datetime import datetime from pymongo import MongoClient import json # Connect to defualt local instance of MongoClient client = MongoClient() # Get database and collection db = client.bpo collection = db.idams def parse(): collection.remove({}) p...
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011, Nicira Networks, 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/LICENS...
""" SAX driver for the Pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. """ version = "0.20" from xml.sax._exceptions import * # xml.parsers.expat does not raise ImportError in Jython import sys if sys.platform[:4] == "java": raise SAXReaderNotAvailable("expat not available in Java", None...
#!/usr/bin/env python2 # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net> from __future__ import absolute_import, division, print_function, unicode_literals import os from calibre.customize.ui import available_catalog_formats, plugin_for_catalog_format from calibre.db.cl...
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. import atexit import platform import re from os import getenv, listdir, remove, sep, walk from os.path import basename, dirname, isdir, isfile, join, normpath from time import sleep from SCons.Script import Exit, SConscript, SConscriptChdir fro...
# -*- coding: utf-8 -*- import os import csv import datetime import pandas as pd from itertools import chain from functools import partial from anacode import codes def backup(root, files): """Backs up `files` from `root` directory and return list of backed up file names. Backed up files will have datetime s...
#!/usr/bin/env python ############################################################################## ## ## This file is part of Sardana ## ## http://www.sardana-controls.org/ ## ## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain ## ## Sardana is free software: you can redistribute it and/or modify ## it und...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 IBM Corp. # # 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 # # ...
# # Copyright (c) 2014 - 2019 StorPool. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
# This file is part of curious. # # curious 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 3 of the License, or # (at your option) any later version. # # curious is distributed in the ho...
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from Tkinter import * from tkFileDialog import askopenfilenames from ip import get_ip_addr import time from threading import Thread """ Display landing webpage at IP_ADDR:PORT and allow download of PATH file. """ class MyHandler(BaseHTTPRequestHandler): ...
from discord import DiscordException, Forbidden, HTTPException from discord.ext import commands from discord.ext.commands import Context from bot import Yasen from scripts.checks import has_manage_message, is_admin, no_pm from scripts.discord_utils import leading_members from scripts.helpers import parse_number clas...
#!/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ """Wordcount exercise Google's Python class The main() below is already defined and comp...
from commando import management BaseSchemaMigrationCommand = management.get_command_class( "schemamigration", exclude_packages=("commando",)) if BaseSchemaMigrationCommand is not None: base = BaseSchemaMigrationCommand() class SchemaMigrationCommandOptions(management.CommandOptions): ""...
########################################################################## # # Copyright (c) 2013-2016, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
# 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 # di...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # python_vuejs documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # 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 ...
# Copyright (c) 2013 Charles University in Prague, Faculty of Arts, # Institute of the Czech National Corpus # Copyright (c) 2013 Tomas Machalek <tomas.machalek@gmail.com> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License #...
from sklearn.datasets import make_classification from collections import Counter import matplotlib.pyplot as plt from sklearn.datasets import load_iris from imblearn.datasets import make_imbalance from imblearn.under_sampling import RandomUnderSampler print (__doc__) def plot_pie(y): target_stats = Counter(y) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on Feb 24, 2014 @author: Chunwei Yan @ PKU @mail: yanchunwei@outlook.com ''' import sys sys.path.append('..') import numpy import theano from theano import tensor as T from softmax_regression import SoftmaxRegression class HiddenLayer(object): ''' a laye...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/bin/python import fasttext from multiprocessing import Pool import contextlib import sys import argparse from functools import partial im...
from django.core.urlresolvers import reverse from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponseRedirect, Http404 from django.template import RequestContext from django.contrib.auth.decorators import login_required try: from django.contrib.syndication.views impor...
""" Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application. """ import ast import logging import os import re import sys import warnings import urllib.parse as urlparselib from urllib.parse import urlparse, urlunparse, ParseResult, parse_qs, unquote_plus from...
# -*- coding: utf-8 -*- # GUI Application automation and testing library # Copyright (C) 2006-2018 Mark Mc Mahon and Contributors # https://github.com/pywinauto/pywinauto/graphs/contributors # http://pywinauto.readthedocs.io/en/latest/credits.html # All rights reserved. # # Redistribution and use in source and b...
# # Copyright (C) 2011, 2012 UNINETT AS # # This file is part of Network Administration Visualized (NAV). # # NAV is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License version 2 as published by the Free # Software Foundation. # # This program is distributed in th...
import cherrypy from cherrypy import _cprequest from cherrypy.lib import httputil try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident def patch_cherrypy(): cherrypy.serving = Greenl...
# 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/. import atexit import logging import os import psutil import signal import sys import subprocess from time import sleep ...
from luna.ast import * ## Highest to lowest precedence: tests for associativity def test_power1(parse_expr): assert Expr( Power( Number('3'), Power( Number('4'), Number('5'), ), ), ) == parse_expr('3 ^ 4 ^ 5') def test_unar...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Version: 2.7 # Author: FEE1DE4D """ This is an unofficial python API for kat.cr (formerly kickass.to) partially inspired by https://github.com/karan/TPB by FEE1DE4D (fee1de4d@gmail.com) under GPLv2 (http://www.gnu.org/licenses/gpl-2.0.html) """ # IMPORTS from pyquery...
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance wi...
#----------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root for license information. #-------------------------------------------------------------------------...
"""Dirac notation for states.""" from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.printing.pretty.stringpict import prettyForm, stringPict from sympy.physics.quantum.qexpr import QExpr, dispatch_method __all__ = [ 'KetBase', 'BraBase', 'Stat...
import sys from thrift.protocol.TBinaryProtocol import TBinaryProtocol from thrift.transport.TSocket import TSocket from thrift.transport.TTransport import TBufferedTransport import sasl from cloudera.thrift_sasl import TSaslClientTransport from TCLIService import TCLIService from TCLIService.ttypes import TOpenSessi...
r""" Test ec.utils. """ import unittest from ec.utils import get, static, custom, walk from support.helpers import RawInputHook as RIH, expect_exception # Tests class TestUtils(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_get(self): Inputs = 'a', 1 RIH.values(*I...
# -*- coding: utf-8 -*- # # This file is part of the bliss project # # Copyright (c) 2016 Beamline Control Unit, ESRF # Distributed under the GNU LGPLv3. See LICENSE for more info. from bliss.common.task_utils import cleanup, error_cleanup, task from bliss.common.measurement import SamplingCounter from bliss.common.ta...
# Copyright (c) 2014-2020 Cloudify Platform 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 # # Unless required b...
import subprocess import os import re import collections import sys import shutil import urllib import urlparse from flask import Flask, redirect, render_template, url_for, request app=Flask(__name__) class WordCounter(dict): def __missing__(self, key): return 0 # Debug mode True or False DEBUG=(len(sys....
""" Problem Statement ================= Given set of jobs with start and end interval and profit, how to maximize profit such that jobs in subset do not overlap. Video ----- * https://youtu.be/cr6Ip0J9izc Complexity ---------- * Runtime Complexity: O(n^2) * Space Complexity: O(n) Reference Link -------------- * ht...
from unittest import TestCase from unittest.mock import create_autospec from nose.tools import istest, raises from bigorna.commons.config import Config from bigorna.tasks import TaskFactory, TaskDefinition class TaskFactoryTest(TestCase): def setUp(self): TestCase.setUp(self) self.out = "%s.out"...
# -*- coding: utf-8 -*- """ :copyright: Copyright 2014 by Łukasz Mierzwa :contact: l.mierzwa@gmail.com """ from __future__ import unicode_literals import logging from django.utils.translation import ugettext as _ from upaas.config.base import (Config, ConfigurationError, StringEntry, ...
import sys import os import gzip import zipfile from optparse import make_option from django.core.management.base import BaseCommand from django.core.management.color import no_style try: set except NameError: from sets import Set as set # Python 2.3 fallback try: import bz2 has_bz2 = True except I...
#!/usr/bin/env python2 # To get started with the join, # try creating a new directory in HDFS that has both the fwiki data AND the maxmind data. import mrjob from mrjob.job import MRJob from mrjob.step import MRStep from weblog import Weblog # imports class defined in weblog.py import os import re import heapq...
""" Copyright (c) 2015 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from __future__ import unicode_literals import json import os from atomic_reactor.core import DockerTasker from atomic_reactor.inner import...
# pykarta/maps/layers/marker.py # A simple marker layer # Copyright 2013, 2014, 2015, Trinity College # Last modified: 3 February 2015 from pykarta.maps.layers import MapLayer from pykarta.draw import poi_label from pykarta.geometry import Point, BoundingBox from pykarta.geometry.projection import project_to_tilespace...
""" The connector for i2c __author__ = "Alex Xiao <http://www.alexxiao.me/>" __date__ = "2017-04-22" __version__ = "0.5" """ import smbus class connector_i2c(): ''' The standard I2c connector implementation ''' def __init__(self,bus_num): ''' bus_num: i2c bus number, start from ...
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import click from images_of import command, settings, Reddit @command @click.option('--print-mods', is_flag=True, help='List the non-default moderators for all subreddits') def main(print_mods): """Find subs without mods and disenfranchised mods""" mods = settings.DEFAULT_MODS r = Reddit('Moderator ...
# -*- coding: utf-8 -*- # Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net> # This program is free software: you can r...
# # Extended VT100 terminal text editor, etc. widgets # Copyright (c) 2015 Paul Sokolovsky # Distributed under MIT License # import sys import os from .editor import * # Edit single line, quit on Enter/Esc class LineEditor(Editor): def handle_cursor_keys(self, key): if super().handle_cursor_keys(key): ...
""" jsonspec.validators.draft04 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Implements JSON Schema draft04. """ from __future__ import absolute_import import logging import re from copy import deepcopy from decimal import Decimal from six import integer_types, string_types from six.moves.urllib.parse import urljoin from...
import cv2 import numpy as np import imutils import serial #ser = serial.Serial('/dev/ttyACM0', baudrate = 9600) #ACM0 #ser.write(b'70') cp1 = cv2.imread('ph1.jpg') hsa = cv2.cvtColor(cp1, cv2.COLOR_BGR2HSV) lower_blue = np.array([110,50,50]) upper_blue = np.array([130,255,255]) mask2 = cv2.inRange(...
# add to kfkd.py from lasagne import layers from lasagne.updates import nesterov_momentum from nolearn.lasagne import NeuralNet,BatchIterator import os import numpy as np from sklearn.utils import shuffle import cPickle as pickle import matplotlib.pyplot as plt import Image import ImageOps from scipy import misc import...
from django.db import models class initial_connection(models.Model): attacker_ip = models.IPAddressField() attacker_port = models.PositiveIntegerField() victim_ip = models.IPAddressField() victim_port = models.PositiveIntegerField() count = models.PositiveIntegerField(default=1) first_seen = models.DateTimeField...
# Copyright Anne M. Archibald 2008 # Released under the scipy license import numpy as np from heapq import heappush, heappop import scipy.sparse def minkowski_distance_p(x,y,p=2): """Compute the pth power of the L**p distance between x and y For efficiency, this function computes the L**p distance but does ...
## # Copyright (C) 2013 Jessica Tallon & Matt Molyneaux # # This file is part of Inboxen. # # Inboxen 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 License, o...
#!/usr/bin/env python # # Copyright 2011 Facebook # # 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 a...
"""Test the module neighbourhood cleaning rule.""" from __future__ import print_function import os import numpy as np from numpy.testing import assert_raises from numpy.testing import assert_equal from numpy.testing import assert_array_equal from numpy.testing import assert_warns from sklearn.datasets import make_cl...
####################################### ##Author Skye Ouyang ##Date 19th Apr. ####################################### import glob import os def IsNotNull(value): return value is not None and len(value) > 0 #create weapon list dict_weapon = [] weapons = open('D:/1. msba/Trimester II Jan.2017-May.2017...
# -*- coding: utf-8 -*- from odoo import models, api, _ from odoo.exceptions import UserError class AccountInvoiceConfirm(models.TransientModel): """ This wizard will confirm the all the selected draft invoices """ _name = "account.invoice.confirm" _description = "Confirm the selected invoices" ...
#!/usr/bin/python3 import sys, os, re import dao, constants, zimuzu, boxdownload from requests import Request, Session sys.stdout = open("/root/autodownloadjob/schedule.download.log", encoding='utf-8', mode='w') sys.stderr = open("/root/autodownloadjob/schedule.download.error.log", encoding='utf-8', mode='w') def dow...
# -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> import logging import pytest import pytest_twisted from bunch import Bunch from test.conftest import create_machinery from test.settings.mqttkit import PROCESS_DELAY_MQTT from test.util import mqtt_json_sensor, sleep, InfluxWrapper, GrafanaW...
#!/usr/bin/env python import sys import numpy as np from find_boxes import rfits, daofind pixel_scale = 1.22 dx = pixel_scale / 206265.0 rd = 0.13 d = 0.06 lamb = 0.65e-6 def moments(data): """Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution by calculating its moment...
# PyTransit: fast and easy exoplanet transit modelling in Python. # Copyright (C) 2010-2019 Hannu Parviainen # # 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 Licen...
#!/usr/bin/env python # encoding: utf-8 import asyncio import logging from functools import singledispatch from bson.objectid import ObjectId from bson.errors import InvalidId from tbone.data.fields.mongo import DBRefField from tbone.db.models import MongoCollectionMixin, post_save from tbone.dispatch.channels.mongo i...