src
stringlengths
721
1.04M
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' from PyQt4.Qt import Qt, QAbstractListModel, QVariant, SIGNAL from calibre.gui2.conv...
# encoding: utf-8 """ fragment.py Created by Thomas Mangin on 2010-02-04. Copyright (c) 2009-2015 Exa Networks. All rights reserved. """ # =================================================================== Fragment # Uses bitmask operand format defined above. # 0 1 2 3 4 5 6 7 # +---+---+---+---+---...
''' SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D. 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. ...
# coding: utf8 from __future__ import unicode_literals LOOKUP = { 'berabad-abad': 'abad', 'keabadian': 'abadi', 'keabadiannya': 'abadi', 'mengabadi': 'abadi', 'mengabadikan': 'abadi', 'mengabadikannya': 'abadi', 'mengabadian': 'abadi', 'pengabadian': 'abadi', 'pengabadiannya': 'abad...
from supplies.annotate import attr, delay, refer __author__ = 'dwae' class Test: def __init__(self, cnt=0): self.cnt = cnt @attr def foo(self): cnt = self.cnt self.cnt += 1 return cnt @delay def bar(self): cnt = self.cnt self.cnt += 1 retu...
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
import datetime import json import random from peewee import * from peewee import sqlite3 from playhouse.sqlite_ext import SqliteExtDatabase from playhouse.sqlite_udf import register_all from .base import IS_SQLITE_9 from .base import ModelTestCase from .base import TestModel from .base import db_loader from .base im...
from base64 import b64encode from urllib.parse import parse_qs, urlsplit import uuid from funnel.models import AuthToken def test_authcode_requires_login(client): """The authcode endpoint requires a login.""" rv = client.get('/api/1/auth') assert rv.status_code == 302 assert urlsplit(rv.location).pat...
# Make a grid with all equilateral triangles # Currently only supports a rectangular domain, constant density, # and either vertical or horizontal orientation import trigrid import numpy as np class EquilateralPaver(trigrid.TriGrid): def __init__(self,L,W,dens,orientation='horizontal',**kwargs): super(Equ...
#/usr/bin/env python3 import argparse import glob import json import logging import datetime import os from local import DATA_DIR, LOG_DIR, REPROCESS_DIR def parse_files(fnames): for fname in fnames: stat = os.stat(fname) f_date = str(datetime.datetime.utcfromtimestamp(stat.st_birthtime).isoforma...
import numpy as np from ray.rllib.models.torch.misc import SlimFC from ray.rllib.models.torch.torch_modelv2 import TorchModelV2 from ray.rllib.utils.framework import try_import_torch, get_activation_fn torch, nn = try_import_torch() class DDPGTorchModel(TorchModelV2, nn.Module): """Extension of standard TorchMo...
#!/usr/bin/python3.5 import os import shutil import subprocess from common.serializers.compact_serializer import CompactSerializer from common.serializers.json_serializer import JsonSerializer from common.serializers.mapping_serializer import MappingSerializer from ledger.compact_merkle_tree import CompactMerkleTree f...
""" The MIT License (MIT) Copyright (c) 2016 mhan-team 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, pu...
import create import time import io import os import sys import argparse # define silence r = 30 # map note names in the lilypad notation to irobot commands c4 = 60 cis4 = des4 = 61 d4 = 62 dis4 = ees4 = 63 e4 = 64 f4 = 65 fis4 = ges4 = 66 g4 = 67 gis4 = aes4 = 68 a4 = 69 ais4 = bes4 = 70 b4 = 71 c5 = 72 cis5 = des5 ...
#!/usr/local/bin/python import unittest import sys import os.path import glob import ConfigParser from pdftools.PdfSeparate import * from abbyy.AbbyyPdfTextExtractor import * from urllib2 import HTTPError class AbbyyPdfTextExtractorNetworkTest(unittest.TestCase): def setUp(self): self.outdir = "tests/out/...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This file tests the TauP_Time utility against the original TauPy using both the high-level tau interface of TauPy and the java-like old script-based interface. """ from __future__ import (absolute_import, division, print_function, unicode_liter...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2010-2013 Zuza Software Foundation # # This file is part of Pootle. # # 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...
# -*- coding: utf-8 -*- """ Created on Sun Jan 7 14:02:01 2018 @author: jie-yu """ import numpy as np np.random.seed(1337) # for reproducibility #from keras.datasets import mnist from keras.models import Model from keras.layers import Dense, Input import matplotlib.pyplot as plt from PIL import Image...
## # Hardware.py: Class implementing control of WEINBot alarm tones via GPIO. # # Copyright 2015, Egan McComb # ## import Adafruit_BBIO.GPIO as GPIO import threading import time import logging class Alarm(): """ Alarm: A class that provides an interface to control the WEINBot STI minicontro...
from cheetax.exceptions import RuntimeException class RunManager(object): """ RunManager is responsible for handling runners based on its status. """ def __init__(self): self.runners = [] self.total_time = 0 @property def num_runners(self): return len(self.runners)...
""" Contains possible interactions with the Apollo's Annotations """ import logging import sys import time from enum import Enum from timeit import default_timer from BCBio import GFF from apollo import util from apollo.client import Client from apollo.util import features_to_feature_schema, retry log = logging.getL...
# _______ _______ __ __ _______ __ __ _______ # | _ || || |_| || || | | || _ | # | |_| || _ || || _ || | | || |_| | # | || | | | | | | |_| || |_| || | # | _ | | |_| | | | | ___|| || _ | # | |_| || || _ || | ...
# -*- coding: utf-8 -*- """ Human Resource Management """ module = request.controller resourcename = request.function if module not in deployment_settings.modules: raise HTTP(404, body="Module disabled: %s" % module) s3db.hrm_vars(module) # ==================================================================...
import time from Code import ControlPosicion from Code import Gestor from Code import Jugada from Code import TurnOnLights from Code.QT import QTUtil from Code.QT import QTUtil2 from Code.Constantes import * class GestorTurnOnLights(Gestor.Gestor): def inicio(self, num_theme, num_block, tol): if hasattr...
# -*- coding: utf-8 -*- import random import numpy def createCGraph(n): Edges = [] Vertices = [] counter = n while counter > 0: if Vertices == []: v0 = vertex('0') v1 = vertex('1') e0 = edge(v0,v1) Vertices.append(v0) Vertices.append...
# Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import copy import hashlib import multiprocessing import os.path import re import signal import subprocess import sys import gyp import gyp.common import gyp.msvs_...
#!/usr/bin/env python2.7 import BaseHTTPServer import collections import logging import os import re import socket import sys import signal import time import traceback import urllib import urlparse from snmpy import log_error, __version__ LOG = logging.getLogger() class HTTPError(Exception): code = 500 d...
# coding=utf-8 # Copyright 2019 The Google AI Language Team 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 ...
#!/usr/bin/env python3 MOD = 2 ** 16 def func0(): if j < 0: return x1 << -j else: return x1 >> j def func1(): if j < 0: return y >> -j else: return y << j x1 = int(input(), 16) x0 = 0 a = 0 y = 0 n = 0 c = 0 t = x1 while t > 0: t >>= 1 n += 1 n += 16 n += n &...
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 CORTIER Benoît # 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 # ...
#!/usr/bin/env python import fileinput import sys ///<summary> ///Provides a bunch of operations to format and manage hard disks. /// ///One cool thing that this class does is allow you to generate a fstab file ///based on disk formatting operations conducted earlier using this class. This ///is helpful when installin...
# Copyright 2012 Nebula, 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 agree...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function, absolute_import try: from urllib.parse import urlsplit except ImportError: from urlparse import urlsplit from datetime import timedelta from django.conf import settings as django_settings from django.test import Client from djang...
"""Module that provides classes that encapsulate model parts with states. There are three classes: `Stateful`, `TemporalStateful`, and `SpatialStateful`. Model parts that do not keep states in time but have a single tensor on the output should be instances of `Stateful`. Model parts that keep their hidden states in a...
# -*- coding: utf-8 -*- import sys import logging import six from six.moves import http_client from redis import StrictRedis import django if django.VERSION[:2] >= (1, 7): django.setup() from django.conf import settings from django.contrib.auth import get_user from django.core.handlers.wsgi import WSGIRequest from...
# Copyright 2017 FUJITSU LIMITED # 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 req...
# main script file run by VoxelCut from vc import * import wx import math voxels_per_mm = float(0) x = float(0) y = float(0) z = float(0) rad = float(0) def jump_to(nx, ny, nz): global x global y global z x, y, z = nx, ny, nz def get_voxel_pos(nx, ny, nz): global voxels_per_mm vx = int(512 ...
from django.conf import settings from .account.serializers import ( UserDetailsSerializer as DefaultUserDetailsSerializer, LoginSerializer as DefaultLoginSerializer, ChangePasswordSerializer as DefaultChangePasswordSerializer, SetPasswordSerializer as DefaultSetPasswordSerializer, EmailSerializer a...
# -*- coding: UTF-8 -*- from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from meregistro.shortcuts import my_render from apps.seguridad.decorators import login_required, credential_required from apps.titulos.models import CarreraJurisdiccional, Cohorte, CohorteEstablecimiento, ...
from PIL import Image import numpy as np import h5py import os import sys import cv2 # Maybe consider implemeting more involved auto-balancing # http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook#automatic_brightnesscontrast_button def open(fn): print "Opening " + fn ext = os.path.splitext(fn...
import glob import sys import time import json import click import jellyfish import numpy as np from sklearn.metrics import recall_score, precision_score from difflib import SequenceMatcher from simindex import DySimII, DyLSH, DyKMeans, RecordTimer, read_csv from simindex import MultiSimAwareAttributeIndex, WeakLabels,...
from PyQt4 import QtGui from PyQt4 import QtCore import sys sys.path.append('..') from aei import board ANIMATE_ONE = 0.2 DIRECTIONS = {'n' : -8, 'w' : -1, 'e' : 1, 's': 8} MAX_MOVE_INTERVAL = 1500 STEP_INTERVAL = 300 ERROR = -1 BSIDE = 8 BSIZE = 64 COL_EMPTY = 2 COLORS = ['Gold', 'Silver', ''] PIECE_EMPTY_STR...
""" This module deals with everything related to the overlay text generated, as well as formating how to display stats """ from game_objects.item import ItemInfo class Overlay(object): """The main class to handle output to overlay text files""" def __init__(self, prefix, tracker_state): self.state = t...
__author__ = 'July' import threading import time import logging import random import Queue ''' from redis import Redis from rq import Queue ''' from functools import partial from multiprocessing.pool import Pool # Below example implement P-C using Queue.Queue - a sync queue class # Queue encapsulates the behaviour of ...
import numpy as np import chromathicity.defaults from chromathicity.illuminant import D from chromathicity.interfaces import RgbSpecification, Compander from chromathicity.observer import Standard from chromathicity.util import SetGet class Custom(RgbSpecification, SetGet): def __init__(self, **kwargs): ...
import json lexicon = { 'pron_me': ['i', "i'd", "i'll", "i'm", "i've", 'id', 'im', 'ive', 'me', 'mine', 'my', 'myself'], 'pron_we': ["let's", 'lets', 'our', 'ours', 'ourselves', 'us', 'we', "we'd", "we'll", "we're", "we've", 'weve'], 'pron_you': ["y'all", 'yall', 'you', "you...
""" Admin views for loading and editing puzzles. Puzzles and blank grids are viewed as whole units using inline elements. Some extra fields are added to upload XML and ipuz files instead of relying on manual data entry. """ import json from xml.etree import ElementTree from django.contrib import admin from django.db....
import numpy as np import pytest from hypothesis.control import assume from hypothesis.core import given from scipy.spatial.qhull import QhullError, Voronoi from crowddynamics.core.quantities import density_voronoi_1 from crowddynamics.testing import reals def all_unique(data: np.ndarray) -> bool: """Test that a...
# -*- coding: utf-8 -*- from openprocurement.api.utils import raise_operation_error, error_handler from openprocurement.tender.belowthreshold.views.award_document import TenderAwardDocumentResource from openprocurement.tender.core.utils import optendersresource @optendersresource(name='aboveThresholdUA:Tender Award D...
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-16 17:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='SensorRe...
# -*- coding: utf-8 -*- # # Copyright (c) 2016-2017 Ircam # Copyright (c) 2016-2017 Guillaume Pellerin # Copyright (c) 2016-2017 Emilie Zawadzki # This file is part of mezzanine-organization. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Will Brennan' import argparse import logging import cv2 import skin_detector logger = logging.getLogger('main') if __name__ == '__main__': parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('image_paths', type=str, nargs='+'...
# -*- 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): # Changing field 'Game.host' db.alter_column(u'game_game', 'host_id', self.gf('django.db.models.fields.rela...
#!/Users/kevanahlquist/Dropbox/dev/dci_notify/env/bin/python ''' Monitor the dci.org website for new score postings. ''' from __future__ import print_function #Initialize Sentry before others, requires SENTRY_DSN environment variable from raven import Client client = Client() # Imports from bs4 import BeautifulSoup ...
# coding=utf8 # """ 跟远程API服务器交互的通用逻辑 """ import os import json import socket import urllib import datetime import requests import traceback import config API_HOST = "http://180.76.149.212:8083" GRAPHQL_HOST = "%s/graphql?query=%%s" % API_HOST def to_url_params(params): """ 根据GET参数的请求对URL进行编码 ...
from django.conf import settings from django.core.mail import send_mail from django.core.management.base import BaseCommand from ...models import Win, Notification from ...notifications import generate_customer_email, generate_officer_email class Command(BaseCommand): def add_arguments(self, parser): pa...
''' * * Copyright [2011] [Red Hat, Inc.] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or ag...
#!/usr/bin/env python import asyncio import logging logger = logging.getLogger("chatkit:" + __name__) class WSClientManager: def __init__(self): self._clients = [] def all(self): return self._clients def add(self, client): logging.info("+ WSClient {}".format(client)) self...
''' Copyright 2009, 2010 Anthony John Machin. All rights reserved. Supplied subject to The GNU General Public License v3.0 Created on 28 Jan 2009 Last Updated on 10 July 2010 As test20 with tests of: rules instantiation and query inference Related: single dict TS recursion rule plus generic rule + minimal da...
"""Parse Suffolk County data file and emit OpenElections CSV. @author n.o.franklin@gmail.com @date 2017-07-11 """ import sys def parse_information_record(line): """Type I. Read and parse information record data.""" information = line[5:].rstrip() return {'information': information} def parse_office_r...
from setuptools import setup, find_packages #from Cython.Build import cythonize import numpy as np import os, sys, glob __version__ = '0.2' #this needs to be kept up to date with shapelets/__init__.py setup(name = 'shapelets', version = __version__, description = 'Shapelet fitting and plotting', long_desc...
from django.db import models from django.template import loader import requests class AdSource(models.Model): name = models.CharField(max_length=10) get_url = models.URLField() def fetch_ad_domains(self): url = self.get_url response = requests.get(url) if response.status_code == 2...
from .resource import Resource # # The MIT License (MIT) # # Copyright (C) 2014 hellosign.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitat...
import os import re import codecs import numpy as np import theano models_path = "./models" eval_path = "./evaluation" eval_temp = os.path.join(eval_path, "temp") eval_script = os.path.join(eval_path, "conlleval") def get_name(parameters): """ Generate a model name from its parameters. """ l = [] ...
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Herald XMPP transport directory :author: Thomas Calmant :copyright: Copyright 2014, isandlaTech :license: Apache License 2.0 :version: 0.0.1 :status: Alpha .. Copyright 2014 isandlaTech Licensed under the Apache License, Version 2.0 (the "License"); ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function, division, absolute_import from django.utils.encoding import force_bytes, force_text from django.utils.http import urlquote import unicodedata def create_content_disposition(filename, attachment=True): """Create the Content-Dispositio...
# Copyright 2019 Eficent Business and IT Consulting Services # Copyright 2017-2018 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields from odoo.tests.common import Form, SavepointCase class TestPurchaseStockPickingReturnInvoicing(SavepointCase): at_...
import thermeq3 import datetime def add_dummy(status): """ :param status: is window open? :return: nothing """ # valves = {valve_adr: [valve_pos, valve_temp, valve_curtemp, valve_name]} # rooms = {id : [room_name, room_address, is_win_open, curr_temp, average valve position]} # devices = {...
# Copyright (c) 2015, MapR Technologies # # 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...
#!/usr/bin/env python import sys, os script_path = os.path.dirname(os.path.realpath(__file__)) modules_path = os.path.normcase("../../") modules_directory = os.path.join(script_path, modules_path) sys.path.append(modules_directory) from PyQt4 import QtGui, QtCore from omelette.fromage.ui import Ui_MainWindow #from om...
# -*- conding=utf-8 -*- """ train module """ import mxnet as mx import numpy as np import json import config import logging import time import collections from sym import vgg16_fc7, caption_module from data_provider import caption_dataIter, init_cnn from mxnet.model import save_checkpoint import argparse logging.basic...
# -*- encoding: utf-8 -*- import datetime import os import string from src.convertors.base.bqt.currentbooksettings import CurrentBookSettings from src.utils import commonscript from src.utils.logger import log from src.convertors.base.bqt.bqtdata import * from src.utils.common import getFileNameInProperCase class In...
"""Class to manage the entities for a single platform.""" import asyncio from contextvars import ContextVar from typing import Optional from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.core import callback, split_entity_id, valid_entity_id from homeassistant.exceptions import HomeAssistantError, ...
# -*- coding: utf-8 -*- import operator import pytest import numpy as np from pandas.compat import range import pandas as pd import pandas.util.testing as tm from pandas.tests.frame.common import _check_mixed_float, _check_mixed_int # ------------------------------------------------------------------- # Compariso...
# Copyright 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. """Runs Chromium's IndexedDB performance test. These test: Databases: create/delete Keys: create/delete Indexes: create/delete Data access: Random r...
# -*- coding: utf-8 -*- """ *************************************************************************** GrassUtils.py --------------------- Date : February 2015 Copyright : (C) 2014-2015 by Victor Olaya Email : volayaf at gmail dot com *********************...
""" Author: Shraey Bhatia Date: October 2016 File: extract.py This file uses WikiExtractor tool to generate documents from wikipedia xml dump. WikExtractor tool can be found at https://github.com/attardi/wikiextractor. If you use a diffferent path than to one mentioned in readme update it ...
# vi: ts=4 expandtab # # Copyright (C) 2011 Canonical Ltd. # Copyright (C) 2012 Hewlett-Packard Development Company, L.P. # # Author: Scott Moser <scott.moser@canonical.com> # Author: Juerg Haefliger <juerg.haefliger@hp.com> # # This program is free software: you can redistribute it and/or modify # it...
# -*- coding: utf-8 -*- import os import shutil import unittest from gits import fs_utils test_dir_root = os.path.dirname(os.path.realpath(__file__)) class MethodsInput(unittest.TestCase): """ Tests behavior of methods which take input arguments. """ scratch_dir = os.path.join(test_dir_root, "scratch"...
## FD_1D_DX4_DT4_LW.py 1-D acoustic Finite-Difference modelling # GNU General Public License v3.0 # # Author: Florian Wittkamp 2016 # # Finite-Difference acoustic seismic wave simulation # Discretization of the first-order acoustic wave equation # # Temporal second-order accuracy O(DT^4) # Spatial fourth-order accuracy...
# Copyright (C) 2015 by Clearcode <http://clearcode.cc> # and associates (see AUTHORS). # This file is part of matchbox. # matchbox 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 ...
from django.core.management.base import BaseCommand, CommandError from django.conf import settings from harvest import untappd class Command(BaseCommand): args = '<poll_id poll_id ...>' help = 'Closes the specified poll for voting' def handle(self, *args, **options): cmd = args[0] u = un...
import unittest from satellite import tree_from_traversals # Tests adapted from `problem-specifications//canonical-data.json` @ v2.0.0 class SatelliteTest(unittest.TestCase): def test_empty_tree(self): preorder = [] inorder = [] expected = {} self.assertEqual(tree_from_traversal...
import arrayfire as af import numpy as np import pylab as pl from bolt.lib.physical_system import physical_system from bolt.lib.nonlinear_solver.nonlinear_solver \ import nonlinear_solver from bolt.lib.nonlinear_solver.tests.performance.input_files \ import domain from bolt.lib.nonlinear_solver.tests.performa...
import json from django.forms.widgets import Widget from django.conf import settings from django.utils.safestring import mark_safe from django.template.loader import render_to_string from collections import OrderedDict from react_cms.finders import ComponentFinder class ResourceEditorWidget(Widget): template_name ...
# -*- coding: utf-8 -*- """ Created on Tue Sep 19 17:20:10 2017 @author: eduardo """ import funcs.patch_loader as pl import tensorflow as tf import funcs.utils as ut import cnns.cnn_models as models import numpy as np import os import funcs.image_processing as iproc from matplotlib import pyplot as plt import pickle ...
import json import uuid import networkx as nx import redis from solar import utils from .traversal import states r = redis.StrictRedis(host='10.0.0.2', port=6379, db=1) def save_graph(name, graph): # maybe it is possible to store part of information in AsyncResult backend r.set('{}:nodes'.format(name), ...
from __future__ import print_function from keras.models import Sequential from keras.layers import Dense, Activation, Dropout from keras.layers import LSTM from keras.optimizers import RMSprop from keras.utils.data_utils import get_file import numpy as np import random import sys import h5py from utils import * import ...
import re def add_value(my_bots, bot_i, val_n): if bot_i in my_bots: my_bots[bot_i].append(val_n) else: my_bots[bot_i] = [val_n] def transfer_chips(my_bots, bot_id): # note: does not cater to both high and low going to same bot that currently holds one chip for key, v...
# Copyright 2021 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 a...
import json from pathlib import Path from nltk.tree import ParentedTree from nose import SkipTest from nose.tools import eq_ from rstfinder.discourse_parsing import Parser from rstfinder.extract_actions_from_trees import extract_parse_actions MY_DIR = Path(__file__).parent def test_extract_parse_actions(): """C...
from django import forms from models import MailUser class PasswordChangeForm(forms.Form): username = forms.CharField(max_length=50) old_password = forms.CharField(max_length=50, widget=forms.PasswordInput) new_password = forms.CharField(max_length=50, widget=forms.PasswordInput) confirm_new_password ...
import numpy as np import pyflux as pf # Generate some random data noise = np.random.normal(0,1,200) data = np.zeros(200) for i in range(1,len(data)): data[i] = 0.9*data[i-1] + noise[i] countdata = np.random.poisson(3,200) exponentialdata = np.random.exponential(3,200) def test_cauchy_no_terms(): """ Tests an GA...
from __future__ import absolute_import from __future__ import print_function from .BlockScan import BlockScan from amitools.fs.FSString import FSString from amitools.fs.FileName import FileName from amitools.fs.validate.Log import Log import amitools.fs.DosType as DosType class DirChainEntry: """entry of the hash c...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Compute semantic similarities between GO terms. Borrowed from book chapter from Alex Warwick Vesztrocy and Christophe Dessimoz (thanks). For details, please check out: notebooks/semantic_similarity.ipynb """ from __future__ import print_function import sys from collec...
# Copyright 2014 NetApp # 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 applic...
class LazyRef(object): def __init__(self, fget): self.fget = fget self.name = fget.__name__ def __get__(self, instance, cls): value = self.fget(instance) instance.__dict__[self.name] = value return value class LazyProperty(object): def __init__(self, fget=None, fse...
import numpy as np import pickle import cv2 from skimage.feature import hog from skimage.transform import pyramid_gaussian print(cv2.__version__) windowSize = [120,120] stepSize = 60 def sliding_window(image, stepSize, windowSize): # slide a window across the image for x in range(0, image.shape[0], stepSize):...
# -*- coding: utf-8 -*- # Copyright 2017 ProjectQ-Framework (www.projectq.ch) # # 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 # # ...
__author__ = 'Dennis' import csv class Log(object): """ Simple log that contains all experiment information (actions, observations). Time based. Logs for every time step what happened. Can (not yet) be read from/to files etc. """ def __init__(self): """ Attrib...