src
stringlengths
721
1.04M
""" Test cases for ldaptor.protocols.ldap.delta """ from twisted.trial import unittest from ldaptor import testutil from ldaptor import delta, entry, attributeset, inmemory from ldaptor.protocols.ldap import ldapsyntax, distinguishedname, ldaperrors class TestModifications(unittest.TestCase): def setUp(self): ...
"""Estimate resources required for processing a set of tasks. Uses annotations provided in multitasks.py for each function to identify utilized programs, then extracts resource requirements from the input bcbio_system file. """ import copy import math import operator from bcbio.pipeline import config_utils from bcbio...
#-*- coding:utf-8 -*- ############################################################################## # # Copyright (C) 2015 One Click Software (http://oneclick.solutions) # and Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>. # # This program is free software: you can redistribute it and/or m...
#!/usr/bin/env python3 from itertools import permutations as pm def is_sqr(n): i = round(n**0.5) if i ** 2 == n: return True else: return False def main(): words = [] with open("../data/p98_words.txt", "r") as fin: for lines in fin: for i in lines.split(','): ...
from __future__ import unicode_literals import base64 import datetime import hashlib import json import netrc import os import re import socket import sys import time import math from ..compat import ( compat_cookiejar, compat_cookies, compat_etree_fromstring, compat_getpass, compat_http_client, ...
# -*- coding: utf-8 -*- __author__ = 'XuWeitao' from django.db.transaction import connections from django.db import transaction from tempfile import TemporaryFile class Raw_sql(object): """ 创建Django与数据库的短连接,通过给sql传递原始sql语句,query_one来返回单条记录,query_all返回所有查询结果的记录 如果查询不到返回False,若对数据库执行删除,插入或者更新操作,需要在传入SQL之后,调用update函数...
""" Django settings for conceptual project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)...
# -*- coding: utf8 -*- import sys, os sys.path.append(os.path.abspath('.')) import re from operator import attrgetter import difflib # Pylons model init sequence import pylons.test import logging from quanthistling.config.environment import load_environment from quanthistling.model.meta import Sessi...
from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks, returnValue, Deferred from twisted.internet.task import deferLater from twisted.internet.threads import blockingCallFromThread from Tribler.Test.Community.Trustchain.test_community import BaseTestTrustChainCommunity from Tribler.T...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- from OpenSSL import crypto, SSL from os import path ''' PyKI - PKI openssl for managing TLS certificates Copyright (C) 2016 MAIBACH ALAIN This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public Li...
# pylint: disable=too-few-public-methods '''Backends for documents.''' from sqlalchemy import create_engine, Column, Integer, String, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship, backref __base_class__ = declarative_base() class Node(__bas...
#!/usr/bin/env python #to create a file in codesnippets folder import pyperclip import os import re import subprocess def get_extension(file_name): if file_name.find('.')!=-1: ext = file_name.split('.') return (ext[1]) else: return 'txt' def cut(str, len1): return str[len1 + ...
#! /usr/bin/python # ... try: from matplotlib import pyplot as plt PLOT=True except ImportError: PLOT=False # ... import numpy as np from pigasus.gallery.poisson import * import sys import inspect filename = inspect.getfile(inspect.currentframe()) # script filename (usually with path) # ......
# coding=utf-8 # Copyright 2021 The TensorFlow Datasets 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 appl...
# -*- coding: utf-8 -*- # Copyright (c) 2012-2015, Anima Istanbul # # This module is part of anima-tools and is released under the BSD 2 # License: http://www.opensource.org/licenses/BSD-2-Clause import os from anima import logger, log_file_handler from anima.recent import RecentFileManager class EnvironmentBase(obj...
from PyQt4.QtGui import QUndoCommand, QTreeWidgetItem # QUndoCommand for creating a new THING and adding it's name to the # QTreeWidget class LoadThings(QUndoCommand): def __init__(self, widget, thing): super(LoadThings, self).__init__() self.widget = widget self.createdThing = thing ...
# Copyright (c) 2011 OpenStack, 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 wr...
#!/usr/bin/env python """ This script generates simulated RNA-Seq reads (in .bed format) from known gene annotations. USAGE gensimreads.py {OPTIONS} <BED-File|-> PARAMETER BED-File\tThe gene annotation file (in BED format). Use '-' for STDIN input OPTIONS -e/--expression [expression level file] \tSpecify ...
from __future__ import division, print_function, absolute_import import math import numpy as np from scipy.lib.six import xrange from scipy.lib.six import string_types __all__ = ['tri', 'tril', 'triu', 'toeplitz', 'circulant', 'hankel', 'hadamard', 'leslie', 'all_mat', 'kron', 'block_diag', 'companion', ...
"""Test the auth mixins. """ from django.conf import settings from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import Client class LoginRequiredTestCase(TestCase): """Test the LoginRequiredMixin. """ def setUp...
''' Test cases for pyclbr.py Nick Mathewson ''' import sys from textwrap import dedent from types import FunctionType, MethodType, BuiltinFunctionType import pyclbr from unittest import TestCase, main as unittest_main from test.test_importlib import util as test_importlib_util StaticMethodType = type(staticmet...
""" # Copyright (c) 06 2015 | surya # 26/06/15 nanang.ask@kubuskotak.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 the License, or (at your option) any later ve...
import calendar import datetime import json import os import os.path import shutil import traceback from concurrent.futures import ThreadPoolExecutor import urllib.error import urllib.parse from sqlalchemy import and_ from sqlalchemy import or_ import sqlalchemy.exc from sqlalchemy_continuum_vendored.utils import ve...
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt, cint from erpnext.accounts.report.trial_balance.trial_balance import validate_filters def exe...
#!/usr/bin/python # # Copyright (C) Roman V. Posudnevskiy (ramzes_r@yahoo.com) # # This program 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; version 2.1 only. # # This program is distributed in the h...
# -*- coding: utf-8 -*- """QGIS Unit tests for the OGR/GPKG provider. .. note:: 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 module is for testing stocks""" from unittest import mock from django.test import TestCase from stocks.models import Stock, DailyStockQuote import pandas as pd from yahoo_historical import Fetcher from authentication.plaid_middleware import PlaidMiddleware import pytest class StocksViewTests(TestCase): ""...
# -*- coding: utf-8 -*- from threading import RLock from oupyc.application.condition import ConditionGenerator from oupyc.application.generator import GeneratorThread from oupyc.application.processor import ProcessorThread from oupyc.application.router import RouterThread from oupyc.application.transformer import Tran...
# -*- encoding: utf-8 -*- ############################################################################### # # # Copyright (C) 2015 TrustCode - www.trustcode.com.br # # Danimar Ribeiro <danimaribeiro@gmail.co...
#!/usr/bin/python3 stats_version="0.11" # Include custom libs import sys sys.path.append( '../../include/python' ) import serverutils.config as config import serverutils.mongohelper as mongohelper import re from pymongo import MongoClient print("Word stats v.", stats_version) print("================================...
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # Copyright (C) 2006 Lukáš Lalinský # # 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- # import sys import pandas as pd from functools import partial from pprint import pprint def main(): # Args indosage = sys.argv[1] inweights = sys.argv[2] insample = sys.argv[3] outf = sys.argv[4] # Load weights into dict weight_dict = load_...
#!/usr/bin/env python #coding=utf8 import copy import math import re from dataclasses import dataclass from typing import Dict, Optional, Set @dataclass class ThingFlag: key: str field: str name: Optional[str] index: Optional[int] alias: Optional[str] description: Optional[str] @staticme...
IRON_SHOVEL = 'iron_shovel' IRON_PICKAXE = 'iron_pickaxe' IRON_AXE = 'iron_axe' FLINT_AND_STEEL = 'flint_and_steel' APPLE = 'apple' BOW = 'bow' ARROW = 'arrow' COAL = 'coal' DIAMOND = 'diamond' IRON_INGOT = 'iron_ingot' GOLD_INGOT = 'gold_ingot' IRON_SWORD = 'iron_sword' WOODEN_SWORD = 'wooden_sword' WOODEN_SHOVEL = 'w...
# Copyright 2015 Mirantis 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 required by...
""" Cisco_IOS_XR_ipv4_telnet_cfg This module contains a collection of YANG definitions for Cisco IOS\-XR ipv4\-telnet package configuration. This module contains definitions for the following management objects\: ipv6\-telnet\: IPv6 telnet configuration ipv4\-telnet\: ipv4 telnet Copyright (c) 2013\-2015 by Cis...
#!/usr/bin/env python # normalDate.py - version 1.0 - 20000717 #hacked by Robin Becker 10/Apr/2001 #major changes include # using Types instead of type(0) etc # BusinessDate class # __radd__, __rsub__ methods # formatMS stuff # derived from an original version created # by Jeff Bauer of Rubicon Research and us...
from collections import defaultdict from functools import partial import http.client import threading from typing import Mapping, Sequence, Union from urllib.parse import parse_qs, quote, urlparse import attr from maasserver.macaroon_auth import ( APIError, AuthInfo, get_auth_info, MacaroonClient, ...
# Copyright (c) 2010 OpenStack Foundation # 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 ...
#!/usr/bin/python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # # iobase - wrapper to wrap local and dist io in one # Copyright (C) 2003-2014 The MiG Project lead by Brian Vinter # # This file is part of MiG. # # MiG is free software: you can redistribute it and/or modify # it under the terms of the GNU General P...
class Node(object): last_id = 0 @classmethod def next_id(cls): if (len(Node.tree.keys()) > 0) and (Node.last_id == 0): Node.last_id = max([id for id in Node.tree.keys()]) id = Node.last_id + 1 Node.last_id = id return id # tree = { node_id : node } tree = {} ...
# 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...
# # 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 # "License"); you may not...
#!/usr/bin/env python ######################################################################################### # # Perform mathematical operations on images # # --------------------------------------------------------------------------------------- # Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca> # A...
# Copyright 2012-2017 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Exceptions.""" __all__ = [ "ClusterUnavailable", "MAASException", "MAASAPIBadRequest", "MAASAPIException", "MAASAPINotFound", "NodeStateViolation",...
""" A context object for caching a function's return value each time it is called with the same input arguments. """ # Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # Copyright (c) 2009 Gael Varoquaux # License: BSD Style, 3 clauses. import os import shutil import sys import time import pydoc tr...
# Copyright 2017 Google 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 required by applicable law or agre...
import logging import os.path import shutil import subprocess import sys from djangocms_installer.utils import query_yes_no logger = logging.getLogger("") def check_install(config_data): """ Here we do some **really** basic environment sanity checks. Basically we test for the more delicate and failing-...
########################################################################## # # Copyright (c) 2015, Esteban Tovagliari. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistribution...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Station' db.create_table('djpandora_station', ( ('id', self.gf('django.db.mode...
#import pyodbc import odbc import _winreg import ConfigParser config_file = 'AutoPermit.ini' def get_config_dict(config_file, section): """ Reads a config file :param config_file: a config file usable by ConfigParser :param section: a section in the config file :return: a dictionary section's en...
from xml.etree.ElementTree import XMLParser class GuestXmlParser: int_tags = ["currentMemory", "memory"] int_attribs = ["index", "port", "startport", "vram"] def __init__(self): self.json = {} self.stack = [self.json] self.catogory = None def start(self, tag, attrib): ...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import collections import json import os from metrics import power from telemetry import test from telemetry.page import page_measurement from telemetry....
#!/usr/bin/env python # Euler tilting angles extraction test # Author: Evgeny Blokhin """ Data for this test are published in: [1] Surf.Sci.602, 3674 (2008), http://dx.doi.org/10.1016/j.susc.2008.10.002 [2] Evgeny Blokhin's MSc. thesis (in Russian), http://dx.doi.org/10.13140/RG.2.1.4276.2727 [3] PRB83, 134108 (2011),...
import sys import os import hashlib class Duplitector: filesizes = {} total_files = 0 duplicated_files = 0 used_space = 0 autodelete = False def chunk_reader(self, fobj, chunk_size=1024): while True: chunk = fobj.read(chunk_size) if not chunk: r...
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-04-22 17:40 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('qms_core', '0009_geojsonservice'), ] operations = [ migrations.AddField( ...
from docutils.nodes import Text from docutils.parsers.rst.directives.body import CodeBlock from okapi.core.exceptions import InvalidHeaderException from okapi.rst.nodes import headers_block from okapi.settings import settings from okapi.core.utils import parse_headers class HeadersDirective(CodeBlock): """ E...
from emdp import build_chain_MDP import numpy as np def test_build_chain_MDP(): mdp = build_chain_MDP(n_states=3, starting_distribution=np.array([0, 0, 1]), terminal_states=[0], reward_spec=[(1, 0, +5)], p_success=0.9) """ this MDP looks like this: [ 0 ] --> [ 0 ] with probabi...
#!/usr/bin/python # -*- coding: iso-8859-15 -*- # # module_daemon.py - WIDS/WIPS framework frame daemon base class module # Copyright (C) 2009 Peter Krebs, Herbert Haas # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published...
# coding: utf-8 import sys import re import os import zipfile import shutil import requests import sqlite3 from nhentai import constant from nhentai.logger import logger from nhentai.serializer import serialize_json, serialize_comic_xml, set_js_database def request(method, url, **kwargs): session = requests.Ses...
#!/usr/bin/python # electronicdos.py v0.5 5-16-2012 Jeff Doak jeff.w.doak@gmail.com import numpy as np from scipy.interpolate import UnivariateSpline from scipy.integrate import quad from scipy.optimize import fsolve import sys, subprocess BOLTZCONST = 8.617e-5 #eV/K class ElectronicDOS: """ Class to calcula...
import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.advanced_construction import SurfacePropertyHeatTransferAlgorithmSurfaceList log = logging.getLogger(__name__) class TestSurfacePropertyHeatTransferAlgorithmSurfaceList(unittest...
#!/usr/bin/env python '''CREMA structured chord model''' import argparse import sys import os import pickle from tqdm import tqdm from joblib import Parallel, delayed from jams.util import smkdirs import pumpp import crema.utils OUTPUT_PATH = 'resources' def process_arguments(args): parser = argparse.Argume...
""" export qXXX quantiser functions, and general make_quant function use function closures to return the following pre-defined qXXX functions qE3 to qE192, the standard resistor ranges qE2 [1, 3, 10] qE5 [1, 1.6, 2.5, 4, 6.3, 10] qE10 [1, 1.25, 1.6, 2, 2.5, 3.2, 4, 5, 6.3, 8, 10] return a function that quantises ac...
# This file was created automatically by SWIG. # Don't modify this file, modify the SWIG interface instead. # This file is compatible with both classic and new-style classes. import _win32_maxpriority def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "this"): if isinstance(val...
def autodiscover(): import copy from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule from .conf import settings from .registry import plugins """ Auto-discover INSTALLED_APPS plugin modules and fail silently when not present. T...
"""Raw representations of every data type in the AWS ECR service. See Also: `AWS developer guide for ECR <https://docs.aws.amazon.com/AmazonECR/latest/userguide/index.html>`_ This file is automatically generated, and should not be directly edited. """ from attr import attrib from attr import attrs from ..co...
# -*- coding: utf-8 -*- # StockScreener.py """ Version: 03.08.2015 A basic functionality Stock Screener class. Stock Data from yahoo api. NOTE: needs two supplied .csv files of stock names. @author: Luke_Wortsmann """ import csv import datetime import numpy as np import matplotlib.colors as colors import matplotlib...
""" Declaration of CourseOverview model """ import json import logging from urlparse import urlparse, urlunparse from django.conf import settings from django.db import models, transaction from django.db.models.fields import BooleanField, DateTimeField, DecimalField, TextField, FloatField, IntegerField from django.db.u...
#!/usr/bin/python # encoding: utf-8 from __future__ import unicode_literals import os.path import sys sys.path.append(os.path.join(os.path.dirname(__file__), u'..')) sys.path.append( os.path.join( os.path.dirname(__file__), u'..', u'lib', u'python{0:d}.{1:d}'.format( sys.version_info.m...
#!/usr/bin/env python # encoding: utf-8 # # spectrum.py # # Licensed under a 3-clause BSD license. # Revision history: # 13 Apr 2016 J. Sánchez-Gallego # Initial version from __future__ import division from __future__ import print_function import sys import numpy as np import matplotlib.pyplot as plt cla...
# -*- coding: utf-8 -*- # Copyright 2017 Adrien Vergé # # 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 program...
# 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. # --------------------------------------------------------------------...
# Copyright (c) 2016-present, Facebook, 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...
#!/usr/bin/python """ Op5 check to get the health of the VCenter Appliance via REST API. Copyright 2017 Martin Persson 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, includi...
"""Tasks related to projects This includes fetching repository code, cleaning ``conf.py`` files, and rebuilding documentation. """ import os import shutil import json import logging import socket import requests import hashlib from collections import defaultdict from celery import task, Task from djcelery import cel...
import warnings from copy import deepcopy from astropy.units import Quantity import math from astropy import wcs as astropy_wcs from astropy import units import numpy import logging __author__ = "David Rusk <drusk@uvic.ca>" PI180 = 57.2957795130823208767981548141052 class WCS(astropy_wcs.WCS): def __init__(self, ...
"""Benchmarking dictionary learning algorithms on random dataset""" from multiprocessing import cpu_count from time import time import matplotlib.pyplot as plt import numpy as np from numpy import array from numpy.linalg import norm from numpy.random import permutation, rand, randint, randn from mdla import MiniBatc...
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """code generator for GLES2 command buffers.""" import itertools import os import os.path import sys import re import platform fro...
import sqlite3 import urllib import re from urllib.request import urlopen from bs4 import BeautifulSoup, NavigableString import nltk nltk.download('punkt') from nltk import sent_tokenize def parseRes2(soup, title, url, cur, author, date, collectiontitle): chapter = 0 sen = "" num = 1 [e.extract() fo...
""" Usage: visualizer.py Visualize the classified data as histogram and line graph with min/max/mean/std/availability information """ import matplotlib.pyplot as plt import matplotlib.dates as dates import numpy as np import pandas as pd import os from datetime import datetime from datetime import timedelta from date...
import msgpack, math with open("test_msgpack.msgpack", 'w') as f: def write(str): f.write(str) def dump(item, **kwargs): msgpack.dump(item, f, **kwargs) def dumpList(list): for item in list: dump(item) write(b"\xdc\x00\x24"); dumpList([None,...
#!/usr/bin/env python3 import os import random import numpy as np from pyplanknn.preprocess import read_train from pyplanknn.network import Network, load WEIGHTS_FILE = '../../test_dump.txt' N_TRAINS = 50 N_RANDS = 1 if __name__ == '__main__': if os.path.exists(WEIGHTS_FILE): model = load(WEIGHTS_FILE) ...
# Copyright (C) 2017 East Asian Observatory # All Rights Reserved. # # 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 script takes as input the LSTM or RNN weights found by train.py change the path in line 178 of this script to point to the h5 file with LSTM or RNN weights generated by train.py Author: Niek Tax ''' from __future__ import division from keras.models import load_model import csv import copy import numpy as np ...
from materials import MCMaterials classicMaterials = MCMaterials(defaultName = "Not present in Classic"); classicMaterials.name = "Classic" cm = classicMaterials cm.Air = cm.Block(0, name="Air", texture=(0x80,0xB0), ) cm.Rock = cm.Block(1, name="Rock", texture=(0x10,0x00), ) cm.Grass = cm.B...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from __future__ import unicode_literals from django.contrib.auth ...
# -*- coding: utf-8 -*- # EForge project management system, Copyright © 2010, Element43 # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWA...
import unittest import cmac from numpy import * import numpy as np import random class TestCmac(unittest.TestCase): def setUp(self): self._sense_conf = cmac.SignalConfiguration(0., 12., 13) self._sense_conf_2 = cmac.SignalConfiguration(0.1, 1., 10) self._sense_conf_3 = cmac.SignalConfigura...
#coding:utf-8 import re import nltk import gensim import logging import numpy as np import mysql.connector from gensim.models.word2vec import Word2Vec class Environment: def __init__(self, args): #logging.debug( 'Initializing the Environment...' ) model_dir = args.model_dir vec...
''' Created on 2013-09-28, revised 2014-06-17, added daily output 2020-05-04 A script to average WRF output; the default settings are meant for my 'fineIO' output configuration and process the smaller diagnostic files. The script can run in parallel mode, with each process averaging one filetype and domain, producing...
import numpy as np import math def sum_squared_error( outputs, targets, derivative=False ): if derivative: return outputs - targets else: return 0.5 * np.mean(np.sum( np.power(outputs - targets,2), axis = 1 )) #end cost function def hellinger_distance( outputs, targets, derivative=False ): ...
from distutils.core import setup, Extension from distutils.sysconfig import get_python_lib import os, os.path import sys try: import platform is_cpython = not hasattr(platform, 'python_implementation') or platform.python_implementation() == 'CPython' except (ImportError, NameError): is_cpython = True # CPy...
# gen_deffile.py # Drew Levin # September 2 2015 # # Automates the evaluation of many CyCells models on a machine. # Requires in the same directory: # 1) The CyCells executable # 2) gen_deffile.py # 3) hypercube text files # 4) immune.init # # Takes 5 command line arguments in this order: # 1: strain letter (a,...
import datetime from gi.repository import Gtk from kiwi.currency import currency from kiwi.ui.widgets.entry import ProxyEntry from kiwi.ui.widgets.label import ProxyLabel window = Gtk.Window() window.connect('delete-event', Gtk.main_quit) window.set_border_width(6) vbox = Gtk.VBox() window.add(vbox) data_types = [ ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib.sites.models import Site from django.conf import settings class DynamicSiteMiddleware(object): def hosting_parse(self, hosting): """ Returns ``(host, port)`` for ``hosting`` of the form ``'host:port'``. If hosting does not...
# This file runs the websockets. import string, cgi, time import sys sys.path.insert(0, 'PyWebPlug') from wsserver import * from time import sleep def setupMessages(): return class Client: def __init__(self, socket): self.socket = socket self.needsConfirmation = True def handle(se...
import unittest import sys from py65.utils.hexdump import load, Loader class TopLevelHexdumpTests(unittest.TestCase): def test_load(self): text = 'c000: aa bb' start, data = load(text) self.assertEqual(0xC000, start) self.assertEqual([0xAA, 0xBB], data) class HexdumpLoaderTests(u...
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListTy...
# -*- coding: utf-8 -*- ''' Twitter bot who replies with the best guesses of what a @mention'ed image is. ''' from __future__ import absolute_import from __future__ import print_function from __future__ import division import functools import logging import os import random import time import tweepy import deploy im...